mirror of
https://github.com/docmost/docmost.git
synced 2026-05-19 07:54:05 +08:00
ec12e80423
* initial commit * added recycle bin modal, updated api routes * updated page service & controller, recycle bin modal * updated page-query.ts, use-tree-mutation.ts, recycled-pages.ts * removed quotes from openRestorePageModal prompt * Updated page.repo.ts * move button to space menu * fix react issues * opted to reload to enact changes in the client * lint * hide deleted pages in recents, handle restore child page * fix null check * WIP * WIP * feat: implement dedicated trash page - Replace modal-based trash view with dedicated route `/s/:spaceSlug/trash` - Add pagination support for deleted pages - Other improvements * fix translation * trash cleanup cron * cleanup --------- Co-authored-by: Philipinho <16838612+Philipinho@users.noreply.github.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { modals } from "@mantine/modals";
|
|
import { Text } from "@mantine/core";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
type UseDeleteModalProps = {
|
|
onConfirm: () => void;
|
|
isPermanent?: boolean;
|
|
};
|
|
|
|
export function useDeletePageModal() {
|
|
const { t } = useTranslation();
|
|
const openDeleteModal = ({
|
|
onConfirm,
|
|
isPermanent = false,
|
|
}: UseDeleteModalProps) => {
|
|
modals.openConfirmModal({
|
|
title: isPermanent
|
|
? t("Are you sure you want to delete this page?")
|
|
: t("Move this page to trash?"),
|
|
children: (
|
|
<Text size="sm">
|
|
{isPermanent
|
|
? t(
|
|
"Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.",
|
|
)
|
|
: t("Pages in trash will be permanently deleted after 30 days.")}
|
|
</Text>
|
|
),
|
|
centered: true,
|
|
labels: {
|
|
confirm: isPermanent ? t("Delete") : t("Move to trash"),
|
|
cancel: t("Cancel"),
|
|
},
|
|
confirmProps: { color: "red" },
|
|
onConfirm,
|
|
});
|
|
};
|
|
|
|
return { openDeleteModal } as const;
|
|
} |