From 7d0b414f1f5681dcc73254fe97cb67de4c0cb748 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 28 Sep 2025 17:49:20 +0100 Subject: feat: recursive list delete (#1989) --- .../lists/DeleteListConfirmationDialog.tsx | 44 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'apps/web/components/dashboard/lists') diff --git a/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsx b/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsx index 7eb25e6d..4996ddf1 100644 --- a/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsx +++ b/apps/web/components/dashboard/lists/DeleteListConfirmationDialog.tsx @@ -1,7 +1,11 @@ +import React from "react"; import { usePathname, useRouter } from "next/navigation"; import { ActionButton } from "@/components/ui/action-button"; import ActionConfirmingDialog from "@/components/ui/action-confirming-dialog"; +import { Label } from "@/components/ui/label"; +import { Switch } from "@/components/ui/switch"; import { toast } from "@/components/ui/use-toast"; +import { useTranslation } from "@/lib/i18n/client"; import type { ZBookmarkList } from "@karakeep/shared/types/lists"; import { useDeleteBookmarkList } from "@karakeep/shared-react/hooks/lists"; @@ -17,13 +21,15 @@ export default function DeleteListConfirmationDialog({ open: boolean; setOpen: (v: boolean) => void; }) { + const { t } = useTranslation(); const currentPath = usePathname(); const router = useRouter(); + const [deleteChildren, setDeleteChildren] = React.useState(false); const { mutate: deleteList, isPending } = useDeleteBookmarkList({ onSuccess: () => { toast({ - description: `List "${list.icon} ${list.name}" is deleted!`, + description: `List "${list.icon} ${list.name}" ${deleteChildren ? "and all its children are " : "is "} deleted!`, }); setOpen(false); if (currentPath.includes(list.id)) { @@ -42,16 +48,44 @@ export default function DeleteListConfirmationDialog({ +

+ Are you sure you want to delete {list.icon} {list.name}? +

+

+ {t("lists.delete_list.description")} +

+ +
+
+ +

+ {t("lists.delete_list.delete_children_description")} +

+
+ +
+ + } actionButton={() => ( deleteList({ listId: list.id })} + onClick={() => deleteList({ listId: list.id, deleteChildren })} > - Delete + {t("actions.delete")} )} > -- cgit v1.2.3-70-g09d2