From 1b55b3f7ea8f3425947ab1bccd57ab8e2a0407e3 Mon Sep 17 00:00:00 2001 From: Catalin Pit Date: Fri, 26 Jun 2026 14:21:44 +0300 Subject: [PATCH] feat: add DocumentPreferencesResetDialog component --- .../document-preferences-reset-dialog.tsx | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx diff --git a/apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx b/apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx new file mode 100644 index 000000000..f528ed27f --- /dev/null +++ b/apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx @@ -0,0 +1,144 @@ +import { Alert, AlertDescription } from '@documenso/ui/primitives/alert'; +import { Button } from '@documenso/ui/primitives/button'; +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from '@documenso/ui/primitives/dialog'; +import { Trans } from '@lingui/react/macro'; +import { useState } from 'react'; + +export type DocumentPreferencesResetDialogProps = { + disabled?: boolean; + isSubmitting: boolean; + onReset: () => Promise; + showAiFeatures?: boolean; + showDocumentVisibility?: boolean; + showIncludeSenderDetails?: boolean; + trigger?: React.ReactNode; +}; + +export const DocumentPreferencesResetDialog = ({ + disabled = false, + isSubmitting, + onReset, + showAiFeatures = false, + showDocumentVisibility = false, + showIncludeSenderDetails = false, + trigger, +}: DocumentPreferencesResetDialogProps) => { + const [open, setOpen] = useState(false); + const [isResetting, setIsResetting] = useState(false); + + const isLoading = isSubmitting || isResetting; + + const handleResetToDefaults = async () => { + setIsResetting(true); + + try { + await onReset(); + setOpen(false); + } finally { + setIsResetting(false); + } + }; + + return ( + !isLoading && setOpen(value)}> + + {trigger ?? ( + + )} + + + + + + Reset document preferences + + + + + This will reset all document preferences to their default values and save the changes immediately. + + + + + + +

+ Once confirmed, the following will be reset: +

+ +
    + {showDocumentVisibility && ( +
  • + Default document visibility +
  • + )} +
  • + Default document language +
  • +
  • + Default date format +
  • +
  • + Default time zone +
  • +
  • + Default signature settings +
  • + {showIncludeSenderDetails && ( +
  • + Send on behalf of team +
  • + )} +
  • + Include the signing certificate in the document +
  • +
  • + Include the audit logs in the document +
  • +
  • + Default recipients +
  • +
  • + Delegate document ownership +
  • +
  • + Default envelope expiration +
  • +
  • + Default signing reminders +
  • + {showAiFeatures && ( +
  • + AI features +
  • + )} +
+
+
+ + + + + + + + +
+
+ ); +};