"use client" import { Bubble, BubbleContent } from "@/styles/base-rhea/ui/bubble" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/styles/base-rhea/ui/card" import { Message, MessageContent } from "@/styles/base-rhea/ui/message" import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, useMessageScrollerScrollable, } from "@/styles/base-rhea/ui/message-scroller" const messages = Array.from({ length: 12 }, (_, index) => ({ id: `state-${index + 1}`, role: index % 2 === 0 ? "user" : "assistant", text: index % 2 === 0 ? `Check section ${index + 1} of the transcript.` : `Section ${index + 1} is ready. Scroll state updates without rerendering the rows.`, })) satisfies Array<{ id: string role: "user" | "assistant" text: string }> export function MessageScrollerState() { return ( Scroll State Read scroll state in JavaScript with the state hook. {messages.map((message) => ( {message.text} ))} ) } function StatusBar() { const { start, end } = useMessageScrollerScrollable() const states = [ { label: "At top", on: !start }, { label: "At bottom", on: !end }, { label: "Older above", on: start }, { label: "Newer below", on: end }, ] return (
{states.map((state) => ( {state.label} ))}
) }