The minimalistic document archiving platform.
feat(tagging-rules): add confirmation dialog for rule deletion (#1407)
Corentin Thomasset30760f53f116
diff --git a/.changeset/full-walls-wait.md b/.changeset/full-walls-wait.mdnew file mode 100644index 00000000..584e8212--- /dev/null+++ b/.changeset/full-walls-wait.md@@ -0,0 +1,5 @@+---+'@papra/app': patch+---++Added a deletion confirmation modal when deleting a tagging rule, to prevent accidental deletion of tagging rules.diff --git a/apps/papra-client/src/locales/en.dictionary.ts b/apps/papra-client/src/locales/en.dictionary.tsindex 916013bc..33af21e0 100644--- a/apps/papra-client/src/locales/en.dictionary.ts+++ b/apps/papra-client/src/locales/en.dictionary.ts@@ -878,6 +878,11 @@ export const translations = {'tagging-rules.apply.success': 'Rule application started in the background','tagging-rules.apply.error': 'Failed to start rule application','tagging-rules.apply.processing': 'Starting...',+ 'tagging-rules.delete.confirm.title': 'Delete tagging rule?',+ 'tagging-rules.delete.confirm.message':+ 'Are you sure you want to delete this tagging rule? This action cannot be undone.',+ 'tagging-rules.delete.confirm.confirm-button': 'Delete rule',+ 'tagging-rules.delete.confirm.cancel-button': 'Cancel',// Intake emailsdiff --git a/apps/papra-client/src/modules/tagging-rules/pages/tagging-rules.page.tsx b/apps/papra-client/src/modules/tagging-rules/pages/tagging-rules.page.tsxindex f7179619..67d78c3b 100644--- a/apps/papra-client/src/modules/tagging-rules/pages/tagging-rules.page.tsx+++ b/apps/papra-client/src/modules/tagging-rules/pages/tagging-rules.page.tsx@@ -72,6 +72,25 @@ const TaggingRuleCard: Component<{ taggingRule: TaggingRule }> = (props) => {},}));+ const handleDeleteRule = async () => {+ const isConfirmed = await confirm({+ title: t('tagging-rules.delete.confirm.title'),+ message: t('tagging-rules.delete.confirm.message'),+ cancelButton: {+ text: t('tagging-rules.delete.confirm.cancel-button'),+ variant: 'secondary',+ },+ confirmButton: {+ text: t('tagging-rules.delete.confirm.confirm-button'),+ variant: 'destructive',+ },+ });++ if (isConfirmed) {+ deleteTaggingRuleMutation.mutate();+ }+ };+const handleApplyRule = async () => {const isConfirmed = await confirm({title: t('tagging-rules.apply.confirm.title'),@@ -135,7 +154,7 @@ const TaggingRuleCard: Component<{ taggingRule: TaggingRule }> = (props) => {<Buttonvariant="outline"size="icon"- onClick={() => deleteTaggingRuleMutation.mutate()}+ onClick={handleDeleteRule}disabled={deleteTaggingRuleMutation.isPending}aria-label={t('tagging-rules.list.card.delete')}class="size-8"