import { Bookmark } from "lucide-react"; import { useChatBookmarks } from "../hooks/useChatBookmarks"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Skeleton } from "@/components/ui/skeleton"; interface ChatBookmarkListProps { companyId: string; onNavigate: (conversationId: string, messageId: string) => void; } function formatRelativeTime(dateStr: string): string { const date = new Date(dateStr); const now = new Date(); const diffMs = now.getTime() - date.getTime(); const diffMin = Math.floor(diffMs / 60000); if (diffMin < 1) return "just now"; if (diffMin < 60) return `${diffMin}m ago`; const diffHr = Math.floor(diffMin / 60); if (diffHr < 24) return `${diffHr}h ago`; const diffDays = Math.floor(diffHr / 24); if (diffDays < 30) return `${diffDays}d ago`; return date.toLocaleDateString(); } export function ChatBookmarkList({ companyId, onNavigate }: ChatBookmarkListProps) { const { data, isLoading } = useChatBookmarks(companyId); const bookmarks = data?.items ?? []; return (
{isLoading ? ( Array.from({ length: 4 }).map((_, i) => ( )) ) : bookmarks.length === 0 ? (

No bookmarks yet

) : ( bookmarks.map((bookmark) => ( )) )}
); }