"use client"; import { memo } from "react"; import { cls, shouldUseInvertedText } from "@/lib/utils"; import { useTheme } from "@/providers/themeProvider/ThemeProvider"; import type { LucideIcon } from "lucide-react"; import { Send } from "lucide-react"; import type { InvertedBackground } from "@/providers/themeProvider/config/constants"; export type ChatExchange = { userMessage: string; aiResponse: string; }; interface BentoChatAnimationProps { aiIcon: LucideIcon; userIcon: LucideIcon; exchanges: ChatExchange[]; placeholder: string; useInvertedBackground: InvertedBackground; className?: string; } const BentoChatAnimation = ({ aiIcon: AiIcon, userIcon: UserIcon, exchanges, placeholder, useInvertedBackground, className = "", }: BentoChatAnimationProps) => { const theme = useTheme(); const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle); const messages = exchanges.flatMap((exchange) => [ { content: exchange.userMessage, isUser: true }, { content: exchange.aiResponse, isUser: false }, ]); const duplicatedMessages = [...messages, ...messages]; return (
{duplicatedMessages.map((message, index) => (
{message.isUser ? (
) : (
)}
{message.content}
))}

{placeholder}

); }; BentoChatAnimation.displayName = "BentoChatAnimation"; export default memo(BentoChatAnimation);