"use client"
import * as React from "react"
import { Avatar, AvatarFallback, AvatarImage, AvatarLeoAssistant } from "@/components/ui/avatar"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"
import {
Message,
MessageAvatar,
MessageContent,
} from "@/components/ui/message"
import {
MessageScroller,
MessageScrollerButton,
MessageScrollerContent,
MessageScrollerItem,
MessageScrollerProvider,
MessageScrollerViewport,
} from "@/components/ui/message-scroller"
import type { LeoThreadMessage } from "@/lib/use-leo-thread"
import { NAV_USER } from "@/lib/mock/navigation"
import { cn } from "@/lib/utils"
export interface LeoThreadMessagesProps {
messages: LeoThreadMessage[]
isThinking?: boolean
/** Center content when the thread is empty (hero, suggestion chips). */
emptyState?: React.ReactNode
className?: string
contentClassName?: string
/** Wider max width for the landing canvas. */
maxWidthClassName?: string
ariaLabel?: string
}
function LeoThinkingMarker() {
return (
Leo is thinking…
)
}
function LeoThreadTurn({ message }: { message: LeoThreadMessage }) {
if (message.role === "user") {
return (
{NAV_USER.name.slice(0, 2).toUpperCase()}
{message.content}
)
}
return (
{message.pending ? (
) : (
{message.content}
)}
)
}
/**
* Shared Leo conversation transcript — Message / Bubble / Marker / MessageScroller.
* Used by the Ask Leo rail and the focused Leo landing canvas.
*/
export function LeoThreadMessages({
messages,
isThinking: _isThinking,
emptyState,
className,
contentClassName,
maxWidthClassName = "max-w-none",
ariaLabel = "Conversation with Leo",
}: LeoThreadMessagesProps) {
const isEmpty = messages.length === 0
return (
{isEmpty ? (
emptyState
) : (
messages.map((message) => (
))
)}
{!isEmpty ? : null}
)
}