Files
outline/app/scenes/DocumentPermanentDelete.tsx
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

52 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { observer } from "mobx-react";
import { useTranslation, Trans } from "react-i18next";
import { useHistory } from "react-router-dom";
import { toast } from "sonner";
import type Document from "~/models/Document";
import ConfirmationDialog from "~/components/ConfirmationDialog";
import Flex from "~/components/Flex";
import useStores from "~/hooks/useStores";
type Props = {
document: Document;
onSubmit: () => void;
};
function DocumentPermanentDelete({ document, onSubmit }: Props) {
const { t } = useTranslation();
const { documents } = useStores();
const history = useHistory();
const handleSubmit = async () => {
await documents.delete(document, {
permanent: true,
});
toast.success(t("Document permanently deleted"));
onSubmit();
history.push("/trash");
};
return (
<Flex column>
<ConfirmationDialog
submitText={t("Im sure Delete")}
savingText={`${t("Deleting")}`}
onSubmit={handleSubmit}
danger
>
<Trans
defaults="Are you sure you want to permanently delete the <em>{{ documentTitle }}</em> document? This action is immediate and cannot be undone."
values={{
documentTitle: document.titleWithDefault,
}}
components={{
em: <strong />,
}}
/>
</ConfirmationDialog>
</Flex>
);
}
export default observer(DocumentPermanentDelete);