"use client" import { ArrowDownIcon } from "lucide-react" import type { ComponentProps } from "react" import { useCallback } from "react" import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom" import { Button } from "@/components/ui/button" import { cn } from "@/lib/utils" import { Message, MessageContent } from "@/components/ai/message" export type ConversationProps = ComponentProps export const Conversation = ({ className, ...props }: ConversationProps) => ( ) export type ConversationContentProps = ComponentProps export const ConversationContent = ({ className, ...props }: ConversationContentProps) => ( ) export type ConversationEmptyStateProps = ComponentProps<"div"> & { title?: string description?: string icon?: React.ReactNode } export const ConversationEmptyState = ({ className, title = "No messages yet", description = "Start a conversation to see messages here", icon, children, ...props }: ConversationEmptyStateProps) => (
{children ?? ( <> {icon &&
{icon}
}

{title}

{description &&

{description}

}
)}
) export type ConversationScrollButtonProps = ComponentProps export const ConversationScrollButton = ({ className, ...props }: ConversationScrollButtonProps) => { const { isAtBottom, scrollToBottom } = useStickToBottomContext() const handleScrollToBottom = useCallback(() => { scrollToBottom() }, [scrollToBottom]) return ( !isAtBottom && ( ) ) } /** Demo component for preview */ export default function ConversationDemo() { const messages = [ { id: "1", from: "user" as const, text: "Hello, how are you?" }, { id: "2", from: "assistant" as const, text: "I'm good, thank you! How can I assist you today?", }, { id: "3", from: "user" as const, text: "I'm looking for information about your services." }, { id: "4", from: "assistant" as const, text: "Sure! We offer a variety of AI solutions. What are you interested in?", }, ] return ( {messages.map(msg => ( {msg.text} ))} ) }