From e3f6ae874d6efdaa38e31f0924733b56fadb1788 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Fri, 22 May 2026 15:30:15 +0200 Subject: [PATCH] feat: add settings template for multi-email .zip filename --- components/settings/downloads-settings.tsx | 26 ++++++++++++++++ hooks/use-email-drag.ts | 36 ++++++++++++++++------ lib/download-filename.ts | 30 ++++++++++++++++++ locales/cs/common.json | 4 +++ locales/da/common.json | 4 +++ locales/de/common.json | 4 +++ locales/en/common.json | 4 +++ locales/es/common.json | 4 +++ locales/fr/common.json | 4 +++ locales/it/common.json | 4 +++ locales/ja/common.json | 4 +++ locales/ko/common.json | 4 +++ locales/lv/common.json | 4 +++ locales/nl/common.json | 4 +++ locales/pl/common.json | 4 +++ locales/pt/common.json | 4 +++ locales/ru/common.json | 4 +++ locales/tr/common.json | 4 +++ locales/uk/common.json | 4 +++ locales/zh/common.json | 4 +++ stores/settings-store.ts | 2 ++ 21 files changed, 152 insertions(+), 10 deletions(-) diff --git a/components/settings/downloads-settings.tsx b/components/settings/downloads-settings.tsx index eabf46e3..5fc9b4f4 100644 --- a/components/settings/downloads-settings.tsx +++ b/components/settings/downloads-settings.tsx @@ -8,9 +8,12 @@ import { RotateCcw } from "lucide-react"; import { cn } from "@/lib/utils"; import { DEFAULT_ATTACHMENT_TEMPLATE, + DEFAULT_BUNDLE_TEMPLATE, DEFAULT_EMAIL_TEMPLATE, EMAIL_TOKENS, ATTACHMENT_TOKENS, + BUNDLE_TOKENS, + bundleExportFilename, emailExportFilename, attachmentDownloadFilename, buildSampleEmail, @@ -130,6 +133,7 @@ export function DownloadsSettings() { const { emailDownloadTemplate, attachmentDownloadTemplate, + bundleDownloadTemplate, filenameSpaceReplacement, filenameLowercase, filenameStripDiacritics, @@ -158,6 +162,10 @@ export function DownloadsSettings() { () => ({ ...transform, template: attachmentDownloadTemplate || DEFAULT_ATTACHMENT_TEMPLATE }), [transform, attachmentDownloadTemplate], ); + const bundleOptions: EmailFilenameOptions = useMemo( + () => ({ ...transform, template: bundleDownloadTemplate || DEFAULT_BUNDLE_TEMPLATE }), + [transform, bundleDownloadTemplate], + ); const emlPreview = useMemo( () => emailExportFilename(sampleEmail, emailOptions), @@ -167,6 +175,12 @@ export function DownloadsSettings() { () => attachmentDownloadFilename(sampleEmail, sampleAttachment, attachmentOptions), [sampleEmail, sampleAttachment, attachmentOptions], ); + const bundlePreview = useMemo( + // Render with the email's fixed sample date so the preview is stable as the + // user types in the template field. + () => bundleExportFilename(3, bundleOptions, sampleEmail.receivedAt ?? undefined), + [bundleOptions, sampleEmail], + ); return ( @@ -194,6 +208,18 @@ export function DownloadsSettings() { previewLabel={t("preview")} placeholder={DEFAULT_ATTACHMENT_TEMPLATE} /> + updateSetting("bundleDownloadTemplate", next)} + resetLabel={t("reset")} + previewLabel={t("preview")} + placeholder={DEFAULT_BUNDLE_TEMPLATE} + />