"use client"
import * as React from "react"
import { RotateCwIcon } from "lucide-react"
import { Bubble, BubbleContent } from "@/styles/base-rhea/ui/bubble"
import { Button } from "@/styles/base-rhea/ui/button"
import {
Card,
CardAction,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/styles/base-rhea/ui/card"
import { Marker, MarkerContent } from "@/styles/base-rhea/ui/marker"
import {
Message,
MessageContent,
MessageHeader,
} from "@/styles/base-rhea/ui/message"
import {
MessageScroller,
MessageScrollerButton,
MessageScrollerContent,
MessageScrollerItem,
MessageScrollerProvider,
MessageScrollerViewport,
} from "@/styles/base-rhea/ui/message-scroller"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/styles/base-rhea/ui/tooltip"
const currentUser = "Grace"
const initialItems = [
{
id: "group-1",
type: "message",
sender: "Grace",
role: "participant",
text: "@mary, the astrophage line keeps matching Venus energy output. Can you check my math?",
},
{
id: "group-2",
type: "message",
sender: "Mary (Agent)",
role: "assistant",
text: "Yes. Confirmed. The curve points to a microorganism harvesting stellar energy and breeding near carbon dioxide. If @rocky agrees, this is the clue we need.",
},
{
id: "group-3",
type: "message",
sender: "Grace",
role: "participant",
text: "ping @rocky",
scrollAnchor: true,
},
] satisfies GroupChatItem[]
const rockyMarker = {
id: "group-4",
type: "event",
text: "Rocky has joined the chat",
scrollAnchor: true,
} satisfies GroupChatItem
const rockyMessage = {
id: "group-5",
type: "message",
sender: "Rocky",
role: "participant",
text: "Amaze. Astrophage eats light, makes heat, goes to carbon dioxide. Rocky has fuel model. Grace is smart.",
} satisfies GroupChatItem
type GroupChatItem =
| {
id: string
type: "event"
text: string
scrollAnchor?: boolean
}
| {
id: string
type: "message"
sender: string
role: "assistant" | "participant"
text: string
scrollAnchor?: boolean
}
export function MessageScrollerGroupChat() {
const [demoKey, setDemoKey] = React.useState(0)
const [rockyTurn, setRockyTurn] = React.useState<
"idle" | "marker" | "message"
>("idle")
const items =
rockyTurn === "message"
? [...initialItems, rockyMarker, rockyMessage]
: rockyTurn === "marker"
? [...initialItems, rockyMarker]
: initialItems
const buttonLabel =
rockyTurn === "idle" ? "Add Rocky" : "Send Message as Rocky"
const isComplete = rockyTurn === "message"
return (
Group Chat
A group chat with several participants and an assistant. The
Marker is marked as a turn.
{
setRockyTurn("idle")
setDemoKey((key) => key + 1)
}}
/>
}
>