diff --git a/app/src/components/views/settings-view.tsx b/app/src/components/views/settings-view.tsx index 3f3373e3..eac56179 100644 --- a/app/src/components/views/settings-view.tsx +++ b/app/src/components/views/settings-view.tsx @@ -4,19 +4,12 @@ import { useState } from "react"; import { useAppStore } from "@/store/app-store"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; -import { Settings, Trash2, Folder } from "lucide-react"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; +import { Settings } from "lucide-react"; import { useCliStatus } from "./settings-view/hooks/use-cli-status"; import { useScrollTracking } from "./settings-view/hooks/use-scroll-tracking"; import { NAV_ITEMS } from "./settings-view/config/navigation"; import { KeyboardMapDialog } from "./settings-view/components/keyboard-map-dialog"; +import { DeleteProjectDialog } from "./settings-view/components/delete-project-dialog"; import { ApiKeysSection } from "./settings-view/api-keys/api-keys-section"; import { ClaudeCliStatus } from "./settings-view/cli-status/claude-cli-status"; import { CodexCliStatus } from "./settings-view/cli-status/codex-cli-status"; @@ -209,59 +202,12 @@ export function SettingsView() { /> {/* Delete Project Confirmation Dialog */} - - - - - - Delete Project - - - Are you sure you want to move this project to Trash? - - - - {currentProject && ( - - - - - - - {currentProject.name} - - - {currentProject.path} - - - - )} - - - The folder will remain on disk until you permanently delete it from - Trash. - - - - setShowDeleteDialog(false)}> - Cancel - - { - if (currentProject) { - moveProjectToTrash(currentProject.id); - setShowDeleteDialog(false); - } - }} - data-testid="confirm-delete-project" - > - - Move to Trash - - - - + ); } diff --git a/app/src/components/views/settings-view/components/delete-project-dialog.tsx b/app/src/components/views/settings-view/components/delete-project-dialog.tsx new file mode 100644 index 00000000..0ac5870b --- /dev/null +++ b/app/src/components/views/settings-view/components/delete-project-dialog.tsx @@ -0,0 +1,78 @@ +import { Trash2, Folder } from "lucide-react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Button } from "@/components/ui/button"; +import type { Project } from "@/store/app-store"; + +interface DeleteProjectDialogProps { + open: boolean; + onOpenChange: (open: boolean) => void; + project: Project | null; + onConfirm: (projectId: string) => void; +} + +export function DeleteProjectDialog({ + open, + onOpenChange, + project, + onConfirm, +}: DeleteProjectDialogProps) { + const handleConfirm = () => { + if (project) { + onConfirm(project.id); + onOpenChange(false); + } + }; + + return ( + + + + + + Delete Project + + + Are you sure you want to move this project to Trash? + + + + {project && ( + + + + + + {project.name} + {project.path} + + + )} + + + The folder will remain on disk until you permanently delete it from Trash. + + + + onOpenChange(false)}> + Cancel + + + + Move to Trash + + + + + ); +}
- {currentProject.name} -
- {currentProject.path} -
- The folder will remain on disk until you permanently delete it from - Trash. -
{project.name}
{project.path}
+ The folder will remain on disk until you permanently delete it from Trash. +