import { SessionSummary } from "@/hooks/use-chat-storage"; import { Button } from "@/components/ui/button"; import { Trash2, Plus } from "lucide-react"; import { cn } from "@/lib/utils"; interface SidebarListProps { sessions: SessionSummary[]; currentSessionId: string | null; onSelectSession: (id: string) => void; onDeleteSession: (id: string) => void; onNewChat: () => void; } function formatDate(dateString: string) { const date = new Date(dateString); return new Intl.DateTimeFormat('pt-BR', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' }).format(date); } export function SidebarList({ sessions, currentSessionId, onSelectSession, onDeleteSession, onNewChat }: SidebarListProps) { return (
{sessions.length === 0 && (
Nenhuma conversa salva
)} {sessions.map((session) => (
onSelectSession(session.id)} >
{session.emoji || '💬'}
{session.title} {formatDate(session.updated_at)}
))}
); }