diff --git a/frontend/src/components/ChatHistoryList.tsx b/frontend/src/components/ChatHistoryList.tsx index c86bc3af3..67c1a6152 100644 --- a/frontend/src/components/ChatHistoryList.tsx +++ b/frontend/src/components/ChatHistoryList.tsx @@ -8,6 +8,7 @@ import { DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { RenameChatDialog } from "@/components/RenameChatDialog"; +import { DeleteChatDialog } from "@/components/DeleteChatDialog"; import { useOpenAI } from "@/ai/useOpenAi"; import { useOpenSecret } from "@opensecret/react"; import { useRouter } from "@tanstack/react-router"; @@ -47,6 +48,7 @@ export function ChatHistoryList({ const queryClient = useQueryClient(); const localState = useContext(LocalStateContext); const [isRenameDialogOpen, setIsRenameDialogOpen] = useState(false); + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); const [selectedChat, setSelectedChat] = useState<{ id: string; title: string } | null>(null); const [isArchivedExpanded, setIsArchivedExpanded] = useState(false); @@ -330,6 +332,17 @@ export function ChatHistoryList({ setIsRenameDialogOpen(true); }, []); + const handleOpenDeleteDialog = useCallback((conv: Conversation) => { + const title = conv.metadata?.title || "Untitled Chat"; + setSelectedChat({ id: conv.id, title }); + setIsDeleteDialogOpen(true); + }, []); + + const handleOpenDeleteDialogArchived = useCallback((chat: ArchivedChat) => { + setSelectedChat({ id: chat.id, title: chat.title }); + setIsDeleteDialogOpen(true); + }, []); + // Handle conversation renaming via API const handleRenameConversation = useCallback( async (conversationId: string, newTitle: string) => { @@ -467,7 +480,7 @@ export function ChatHistoryList({ Rename Chat - handleDeleteConversation(conv.id)}> + handleOpenDeleteDialog(conv)}> Delete Chat @@ -544,7 +557,7 @@ export function ChatHistoryList({ Rename Chat - handleDeleteConversation(chat.id)}> + handleOpenDeleteDialogArchived(chat)}> Delete Chat @@ -560,13 +573,21 @@ export function ChatHistoryList({ )} {selectedChat && ( - + <> + + handleDeleteConversation(selectedChat.id)} + /> + )} ); diff --git a/frontend/src/components/ComparisonChart.tsx b/frontend/src/components/ComparisonChart.tsx index e9176c924..d13187aa9 100644 --- a/frontend/src/components/ComparisonChart.tsx +++ b/frontend/src/components/ComparisonChart.tsx @@ -169,13 +169,11 @@ export function ComparisonChart() { {/* Header Row */}
-
- -
+
{products.map((product) => (
diff --git a/frontend/src/components/DeleteChatDialog.tsx b/frontend/src/components/DeleteChatDialog.tsx new file mode 100644 index 000000000..d9ee8b41d --- /dev/null +++ b/frontend/src/components/DeleteChatDialog.tsx @@ -0,0 +1,52 @@ +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle +} from "@/components/ui/alert-dialog"; + +interface DeleteChatDialogProps { + open: boolean; + onOpenChange: (open: boolean) => void; + onConfirm: () => void; + chatTitle: string; +} + +export function DeleteChatDialog({ + open, + onOpenChange, + onConfirm, + chatTitle +}: DeleteChatDialogProps) { + const handleConfirm = (e: React.MouseEvent) => { + e.preventDefault(); + onConfirm(); + onOpenChange(false); + }; + + return ( + + + + Are you sure you want to delete this chat? + + This will permanently delete "{chatTitle}". This action cannot be undone. + + + + Cancel + + Delete + + + + + ); +}