import type { ComponentProps, ReactNode } from 'react' import { motion } from 'motion/react' import { IconGhost } from '@/client/components/shared/IconGhost' import { Button } from '@/client/components/ui/button' import { Popover, PopoverContent, PopoverTrigger } from '@/client/components/ui/popover' type ChatPopupProps = { loading: boolean open: boolean onOpenChange: (open: boolean) => void onOpenChangeComplete: (open: boolean) => void children: (onClose: () => void) => ReactNode } export function ChatPopup({ loading, open, onOpenChange, onOpenChangeComplete, children }: ChatPopupProps) { const onClose = () => onOpenChange(false) const handleOpenChange: NonNullable['onOpenChange']> = ( nextOpen, eventDetails ) => { if (!nextOpen && eventDetails.reason === 'outside-press') { eventDetails.cancel() return } onOpenChange(nextOpen) } return ( {/* Floating over a themed workspace — use the card pair so it stays legible regardless of the active theme background. */} } /> {children(onClose)} ) }