diff --git a/apps/desktop/src/pages/artifacts/ArtifactsPage.tsx b/apps/desktop/src/pages/artifacts/ArtifactsPage.tsx index b69cc52..2ceff07 100644 --- a/apps/desktop/src/pages/artifacts/ArtifactsPage.tsx +++ b/apps/desktop/src/pages/artifacts/ArtifactsPage.tsx @@ -1,11 +1,12 @@ import { useEffect, useState } from "react"; -import { FileText } from "lucide-react"; +import { FileText, Trash2 } from "lucide-react"; import { EmptyState, ErrorState, LoadingSpinner } from "@/components/common"; import { useWorkspaces } from "@/features/workspace/hooks/useWorkspaces"; import { useArtifacts, useDeleteArtifact } from "@/features/artifacts"; import { ArtifactViewer } from "@/features/artifacts/components/ArtifactViewer"; import { CompanyComparisonArtifactForm } from "@/features/plugins"; import { useLocale } from "@/lib/i18n/useLocale"; +import type { MessageKey } from "@/lib/i18n/locale"; import type { Artifact } from "@/lib/desktop-api/artifacts"; export function ArtifactsPage() { @@ -13,6 +14,7 @@ export function ArtifactsPage() { const workspaces = useWorkspaces(); const [workspaceId, setWorkspaceId] = useState(""); const [selectedArtifactId, setSelectedArtifactId] = useState(null); + const [deleteError, setDeleteError] = useState(null); const artifacts = useArtifacts(workspaceId); const deleteArtifact = useDeleteArtifact(); @@ -31,13 +33,17 @@ export function ArtifactsPage() { // Handle artifact deletion const handleDeleteArtifact = async (id: string) => { + if (!window.confirm(t("confirmDeleteArtifact"))) { + return; + } + setDeleteError(null); try { await deleteArtifact.mutateAsync(id); if (selectedArtifactId === id) { setSelectedArtifactId(null); } - } catch (error) { - console.error("Failed to delete artifact:", error); + } catch { + setDeleteError(t("failedToDeleteArtifact")); } }; @@ -102,6 +108,15 @@ export function ArtifactsPage() { + {deleteError && ( +
+ {deleteError} +
+ )} + void; _onDelete: () => void; - t: (key: any) => string; + t: (key: MessageKey) => string; } function ArtifactListItem({ @@ -176,7 +191,6 @@ function ArtifactListItem({ _onDelete, t, }: ArtifactListItemProps) { - void _onDelete; const getStatusColor = (status: string) => { switch (status) { case "completed": @@ -203,9 +217,18 @@ function ArtifactListItem({ }; return ( - - + ); }