⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat: replace browser confirm with Archive modal
Frank Smeets9ed268f89ac2
diff --git a/apps/web/src/components/list-view/index.tsx b/apps/web/src/components/list-view/index.tsxindex 224e0e02b..3979b75c3 100644--- a/apps/web/src/components/list-view/index.tsx+++ b/apps/web/src/components/list-view/index.tsx@@ -32,6 +32,7 @@ import useBulkSelectionStore from "@/store/bulk-selection";import useProjectStore from "@/store/project";import type { ProjectWithTasks } from "@/types/project";import BulkToolbar from "../bulk-selection/bulk-toolbar";+import { ArchiveTasksModal } from "../shared/modals/archive-tasks-modal";import CreateTaskModal from "../shared/modals/create-task-modal";import TaskRow from "./task-row";@@ -66,6 +67,10 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {});const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);const [activeColumn, setActiveColumn] = useState<string | null>(null);+ const [isArchiveModalOpen, setIsArchiveModalOpen] = useState(false);+ const [columnToArchive, setColumnToArchive] = useState<+ ProjectWithTasks["columns"][number] | null+ >(null);useEffect(() => {if (project?.columns) {@@ -234,16 +239,18 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {}));};- const handleArchiveTasks = (column: ProjectWithTasks["columns"][number]) => {+ const handleArchiveClick = (column: ProjectWithTasks["columns"][number]) => {if (!column.isFinal || column.tasks.length === 0) return;+ setColumnToArchive(column);+ setIsArchiveModalOpen(true);+ };- if (!confirm(`Archive all ${column.tasks.length} completed tasks?`)) {- return;- }+ const handleConfirmArchive = () => {+ if (!columnToArchive) return;const updatedProject = produce(project, (draft) => {const archivedColumn = draft?.columns?.find(- (col) => col.id === column.id,+ (col) => col.id === columnToArchive.id,);if (!archivedColumn) return;@@ -258,7 +265,10 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {});setProject(updatedProject);- toast.success(`Archived ${column.tasks.length} tasks`);+ toast.success(`Archived ${columnToArchive.tasks.length} tasks`);++ setIsArchiveModalOpen(false);+ setColumnToArchive(null);};function ColumnSection({@@ -322,7 +332,7 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {{column.isFinal && column.tasks.length > 0 && (<buttontype="button"- onClick={() => handleArchiveTasks(column)}+ onClick={() => handleArchiveClick(column)} // Verander dit naar de nieuwe naamclassName="p-1 hover:bg-accent rounded text-muted-foreground hover:text-foreground transition-colors"title="Archive all completed tasks">@@ -420,6 +430,15 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {onClose={() => setIsTaskModalOpen(false)}status={activeColumn ?? "done"}/>+ <ArchiveTasksModal+ open={isArchiveModalOpen}+ onClose={() => {+ setIsArchiveModalOpen(false);+ setColumnToArchive(null);+ }}+ onConfirm={handleConfirmArchive}+ taskCount={columnToArchive?.tasks.length ?? 0}+ /><BulkToolbar /></DndContext>diff --git a/apps/web/src/components/shared/modals/archive-tasks-modal.tsx b/apps/web/src/components/shared/modals/archive-tasks-modal.tsxnew file mode 100644index 000000000..eb0a27b49--- /dev/null+++ b/apps/web/src/components/shared/modals/archive-tasks-modal.tsx@@ -0,0 +1,66 @@+import { AlertTriangle } from "lucide-react";+import { Button } from "@/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "@/components/ui/dialog";++type ArchiveTasksModalProps = {+ open: boolean;+ onClose: () => void;+ onConfirm: () => void;+ taskCount: number;+};++export function ArchiveTasksModal({+ open,+ onClose,+ onConfirm,+ taskCount,+}: ArchiveTasksModalProps) {+ return (+ <Dialog open={open} onOpenChange={onClose}>+ <DialogContent className="max-w-md" showCloseButton={false}>+ <DialogHeader className="px-3 pt-6 pb-2 gap-3">+ <div className="flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10">+ <AlertTriangle className="h-6 w-6 text-destructive" />+ </div>+ <div className="space-y-1">+ <DialogTitle className="text-xl font-semibold tracking-tight">+ Archive Tasks+ </DialogTitle>+ <DialogDescription className="text-sm text-muted-foreground">+ Are you sure you want to archive all **{taskCount}** completed+ tasks? This will remove them from the active board.+ </DialogDescription>+ </div>+ </DialogHeader>++ <DialogFooter className="border-t border-border bg-muted/30 px-6 py-4 mt-2">+ <Button+ type="button"+ variant="outline"+ onClick={onClose}+ className="border-border text-foreground hover:bg-accent"+ size="sm"+ >+ Cancel+ </Button>+ <Button+ type="button"+ variant="destructive"+ onClick={onConfirm}+ size="sm"+ className="bg-destructive hover:bg-destructive/90 text-destructive-foreground shadow-sm"+ >+ Archive {taskCount} tasks+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+}