From 87cf284b3bb1697231033c76ae6b928f828ce542 Mon Sep 17 00:00:00 2001 From: Connor Yoh Date: Fri, 12 Sep 2025 16:31:14 +0100 Subject: [PATCH] Split placeholders per split by... --- .../public/locales/en-GB/translation.json | 22 ++++++++ .../components/tools/split/SplitSettings.tsx | 52 +++++++++++++------ 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index 16b32499d..97aed97b3 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -691,6 +691,28 @@ "label": "Choose split method", "placeholder": "Select how to split the PDF" }, + "methods": { + "byPages": "Split by Pages", + "bySections": "Split by Sections", + "bySize": "Split by File Size", + "byPageCount": "Split by Page Count", + "byDocCount": "Split by Document Count", + "byChapters": "Split by Chapters" + }, + "value": { + "fileSize": { + "label": "File Size", + "placeholder": "e.g. 10MB, 500KB" + }, + "pageCount": { + "label": "Pages per File", + "placeholder": "e.g. 5, 10" + }, + "docCount": { + "label": "Number of Files", + "placeholder": "e.g. 3, 5" + } + }, "tooltip": { "header": { "title": "Split Methods Overview" diff --git a/frontend/src/components/tools/split/SplitSettings.tsx b/frontend/src/components/tools/split/SplitSettings.tsx index e17f65190..5b447aa18 100644 --- a/frontend/src/components/tools/split/SplitSettings.tsx +++ b/frontend/src/components/tools/split/SplitSettings.tsx @@ -57,15 +57,37 @@ const SplitSettings = ({ ); - const renderSplitValueForm = () => ( - onParameterChange('splitValue', e.target.value)} - disabled={disabled} - /> - ); + const renderSplitValueForm = () => { + let label, placeholder; + + switch (parameters.method) { + case SPLIT_METHODS.BY_SIZE: + label = t("split.value.fileSize.label", "File Size"); + placeholder = t("split.value.fileSize.placeholder", "e.g. 10MB, 500KB"); + break; + case SPLIT_METHODS.BY_PAGE_COUNT: + label = t("split.value.pageCount.label", "Pages per File"); + placeholder = t("split.value.pageCount.placeholder", "e.g. 5, 10"); + break; + case SPLIT_METHODS.BY_DOC_COUNT: + label = t("split.value.docCount.label", "Number of Files"); + placeholder = t("split.value.docCount.placeholder", "e.g. 3, 5"); + break; + default: + label = t("split-by-size-or-count.value.label", "Split Value"); + placeholder = t("split-by-size-or-count.value.placeholder", "e.g. 10MB or 5 pages"); + } + + return ( + onParameterChange('splitValue', e.target.value)} + disabled={disabled} + /> + ); + }; const renderByChaptersForm = () => ( @@ -101,12 +123,12 @@ const SplitSettings = ({ onChange={(v) => isSplitMethod(v) && onParameterChange('method', v)} disabled={disabled} data={[ - { value: SPLIT_METHODS.BY_PAGES, label: t("split.header", "Split by Pages") + " (e.g. 1,3,5-10)" }, - { value: SPLIT_METHODS.BY_SECTIONS, label: t("split-by-sections.title", "Split by Grid Sections") }, - { value: SPLIT_METHODS.BY_SIZE, label: t("split-by-size-or-count.type.size", "By Size") }, - { value: SPLIT_METHODS.BY_PAGE_COUNT, label: t("split-by-size-or-count.type.pageCount", "By Page Count") }, - { value: SPLIT_METHODS.BY_DOC_COUNT, label: t("split-by-size-or-count.type.docCount", "By Document Count") }, - { value: SPLIT_METHODS.BY_CHAPTERS, label: t("splitByChapters.title", "Split by Chapters") }, + { value: SPLIT_METHODS.BY_PAGES, label: t("split.methods.byPages", "Split by Pages") }, + { value: SPLIT_METHODS.BY_SECTIONS, label: t("split.methods.bySections", "Split by Sections") }, + { value: SPLIT_METHODS.BY_SIZE, label: t("split.methods.bySize", "Split by Size") }, + { value: SPLIT_METHODS.BY_PAGE_COUNT, label: t("split.methods.byPageCount", "Split by Page Count") }, + { value: SPLIT_METHODS.BY_DOC_COUNT, label: t("split.methods.byDocCount", "Split by Document Count") }, + { value: SPLIT_METHODS.BY_CHAPTERS, label: t("split.methods.byChapters", "Split by Chapters") }, ]} />