"use client"; import { MessageSquarePlus, Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; import { useI18n, type TranslateFn } from "@/i18n/i18n-context"; import { cn } from "@/lib/utils"; import type { ChatSession } from "@/hooks/use-chat-history"; import { ChatHistoryTransfer } from "./chat-history-transfer"; interface ChatHistorySidebarProps { sessions: ChatSession[]; activeSessionId: string | null; onNewSession: () => void; onSelectSession: (id: string) => void; onDeleteSession: (id: string) => void; onClearAll: () => void; activeInstance?: string | null; transferDisabled?: boolean; } /** * Left-hand conversation list. Styled as a minimal rail (256px wide) so * the main chat column retains reading comfort. Each row shows the derived * title and relative timestamp; destructive actions are reveal-on-hover to * avoid accidental clicks. */ export function ChatHistorySidebar({ sessions, activeSessionId, onNewSession, onSelectSession, onDeleteSession, onClearAll, activeInstance = null, transferDisabled = false, }: ChatHistorySidebarProps) { const { t } = useI18n(); return ( ); } function SessionRow({ session, active, onSelect, onDelete, }: { session: ChatSession; active: boolean; onSelect: () => void; onDelete: () => void; }) { const { t } = useI18n(); const mountCount = session.config.mounts.length; return (
); } function formatRelative(ts: number, t: TranslateFn): string { const diff = Date.now() - ts; const mins = Math.floor(diff / 60_000); if (mins < 1) return t("chat.history.justNow"); if (mins < 60) return t("chat.history.minutesAgo", { count: mins }); const hours = Math.floor(mins / 60); if (hours < 24) return t("chat.history.hoursAgo", { count: hours }); const days = Math.floor(hours / 24); if (days < 7) return t("chat.history.daysAgo", { count: days }); return new Date(ts).toLocaleDateString(); }