import { useNavigate } from 'react-router' import { List } from 'lucide-react' import { cn } from '@/lib' import { useChatStore } from '@/features/chat/stores/useChatStore' import { Percent, Price } from '@/features/chat/components/userInputs' import { GO_TO_LIST_TEXT } from '@/features/chat/lib/userButtonConfig' import type { UserButtonConfig } from '@/features/chat/types' // max-[1180px]: 채팅 폭이 좁아지면 버튼 패딩·최소폭 축소, 상품목록은 아이콘만 남긴다 const style = { goToList: 'flex w-[159px] max-[1180px]:w-[48px] h-[48px] bg-neutral-40 hover:brightness-[0.97] rounded-[999px] items-center justify-center title-2 text-neutral-80 cursor-pointer gap-2 max-[1180px]:gap-0 transition-all ease-out hover:scale-[1.01]', black: 'flex min-w-[120px] px-[32px] max-[1180px]:min-w-[100px] max-[1180px]:px-[20px] h-[48px] bg-primary hover:brightness-[0.97] rounded-[999px] items-center justify-center title-2 text-primary-foreground cursor-pointer whitespace-nowrap transition-all duration-200 ease-out hover:scale-[1.01]', gray: 'flex min-w-[120px] px-[32px] max-[1180px]:min-w-[100px] max-[1180px]:px-[20px] h-[48px] bg-neutral-60 rounded-[999px] items-center justify-center title-2 text-neutral-00 cursor-pointer whitespace-nowrap transition-all ease-out hover:scale-[1.01]', white: 'flex min-w-[120px] px-[32px] max-[1180px]:min-w-[100px] max-[1180px]:px-[20px] h-[48px] bg-neutral-00 rounded-[999px] items-center justify-center title-2 text-neutral-80 border border-neutral-80 cursor-pointer whitespace-nowrap transition-all ease-out hover:scale-[1.01]', } export function UserButton({ type, text, textList, priceErrorMessage }: UserButtonConfig) { if (type === '') return null return ( // pr-[16px]: 채팅 스크롤 영역(ChatMessage 바깥 pr-[16px])과 오른쪽 끝 정렬
{type === 'one-black' && } {type === 'one-gray' && } {type === 'black-white' && } {type === 'percent' && } {type === 'three-black' && ( )} {type === 'price' && } {type === 'loading' && }
) } // agent 응답 대기 중(협상 중) 버튼 자리에 표시하는 "..." 점 애니메이션. 비활성(클릭 불가). function LoadingDots() { return (
) } function GoToList() { const navigate = useNavigate() return ( ) } function OneBlack({ text }: { text: string }) { const navigate = useNavigate() const sendMessage = useChatStore((s) => s.sendMessage) const onClick = () => (text === GO_TO_LIST_TEXT ? navigate('/list') : sendMessage(text)) return ( ) } function OneGray({ text }: { text: string }) { const sendMessage = useChatStore((s) => s.sendMessage) return ( ) } function ThreeBlack({ textList }: { textList: [string, string, string] }) { const sendMessage = useChatStore((s) => s.sendMessage) return (
{textList.map((t) => ( ))}
) } function BlackWhite({ textList }: { textList: [string, string] }) { const sendMessage = useChatStore((s) => s.sendMessage) return (
) }