From 37f2341e0f454c098559801341b64b67f280b946 Mon Sep 17 00:00:00 2001 From: EthanHealy01 Date: Fri, 26 Sep 2025 01:53:34 +0100 Subject: [PATCH] add multi page layout tool --- .../tools/pageLayout/PageLayoutSettings.tsx | 62 +++++++++++++++++++ .../components/tools/pageLayout/constants.ts | 37 +++++++++++ .../src/data/useTranslatedToolRegistry.tsx | 7 ++- .../pageLayout/usePageLayoutOperation.ts | 33 ++++++++++ .../pageLayout/usePageLayoutParameters.ts | 23 +++++++ frontend/src/tools/PageLayout.tsx | 57 +++++++++++++++++ 6 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 frontend/src/components/tools/pageLayout/PageLayoutSettings.tsx create mode 100644 frontend/src/components/tools/pageLayout/constants.ts create mode 100644 frontend/src/hooks/tools/pageLayout/usePageLayoutOperation.ts create mode 100644 frontend/src/hooks/tools/pageLayout/usePageLayoutParameters.ts create mode 100644 frontend/src/tools/PageLayout.tsx diff --git a/frontend/src/components/tools/pageLayout/PageLayoutSettings.tsx b/frontend/src/components/tools/pageLayout/PageLayoutSettings.tsx new file mode 100644 index 000000000..8df230f2d --- /dev/null +++ b/frontend/src/components/tools/pageLayout/PageLayoutSettings.tsx @@ -0,0 +1,62 @@ +import React from 'react'; +import { Divider, Select, Stack, Switch } from '@mantine/core'; +import { useTranslation } from 'react-i18next'; +import { PageLayoutParameters } from '../../../hooks/tools/pageLayout/usePageLayoutParameters'; +import { getPagesPerSheetOptions } from './constants'; + +export default function PageLayoutSettings({ + parameters, + onParameterChange, + disabled, +}: { + parameters: PageLayoutParameters; + onParameterChange: ( + key: K, + value: PageLayoutParameters[K] + ) => void; + disabled?: boolean; +}) { + const { t } = useTranslation(); + + const options = getPagesPerSheetOptions(t); + const selected = options.find((o) => o.value === parameters.pagesPerSheet) || options[0]; + + return ( + +