'use client'; import { Chat } from '@prisma/client'; import React from 'react'; import { SelectItem, Select, SelectTrigger, SelectContent, SelectIcon, SelectGroup, SelectSeparator, } from './ui/Select'; import Img from './ui/Img'; import { format } from 'date-fns'; import { useParams, useRouter } from 'next/navigation'; import { IconPlus } from './ui/Icons'; export interface ChatSelectProps { chat: Chat; } const ChatSelectItem: React.FC = ({ chat }) => { const { id, title, mediaUrl, updatedAt } = chat; return (
{`chat-${id}-card-image`}

{title ?? '(no title)'}

{updatedAt ? format(Number(updatedAt), 'yyyy-MM-dd') : '-'}

); }; const ChatSelect: React.FC<{ myChats: Chat[] }> = ({ myChats }) => { const { id: chatIdFromParam } = useParams(); const currentChat = myChats.find(chat => chat.id === chatIdFromParam); const router = useRouter(); return ( ); }; export default ChatSelect;