From a5b259b453f2e6f9f2374f6ddadf317f7ba40881 Mon Sep 17 00:00:00 2001 From: Vibe Stack Date: Thu, 9 Apr 2026 06:30:19 -0400 Subject: [PATCH] feat(settings): add default startup view and reader zoom preferences (#6073) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description of Changes Adds two new user preferences to the General settings panel, addressing #5908. **Default view on launch** - a segmented control (Tools / Reader / Automate) that controls which left-column tab is active when the app starts. Previously the app always opened on the Tools tab with no way to change this. Users who spend most of their time reading PDFs had to manually switch to the Reader tab on every launch. **Default reader zoom** - a dropdown (Auto / Fit width / Fit page / 50%–200%) that sets the initial zoom level whenever a PDF is opened in the reader. Previously the app always applied an automatic fit-to-viewport calculation. Both settings are non-breaking. The defaults (`Tools` and `Auto`) reproduce the existing behaviour exactly, so existing users see no difference until they change a preference. ### What changed - `preferencesService.ts` - added `StartupView` and `ViewerZoomSetting` types plus the two new fields to `UserPreferences` with safe defaults - `ToolWorkflowContext.tsx` - one-time startup effect that navigates to the preferred tab on first render (mirrors the existing `defaultToolPanelMode` sync pattern) - `ZoomAPIBridge.tsx` - respects the zoom preference before falling back to auto-zoom logic when a document loads - `GeneralSection.tsx` - two new controls added below "Default tool picker mode"; the Select uses `comboboxProps={{ withinPortal: true }}` so the dropdown renders above the settings modal - `en-GB/translation.toml` - new keys for labels, descriptions, and option values Closes #5908 --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [x] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [x] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) Screenshot 2026-04-05 185718 Screenshot 2026-04-05 185620 ### Testing (if applicable) - [x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --- .../public/locales/en-GB/translation.toml | 14 +++++ .../config/configSections/GeneralSection.tsx | 58 +++++++++++++++++++ .../core/components/viewer/ZoomAPIBridge.tsx | 16 +++++ .../src/core/contexts/ToolWorkflowContext.tsx | 22 +++++++ .../src/core/services/preferencesService.ts | 8 +++ 5 files changed, 118 insertions(+) diff --git a/frontend/public/locales/en-GB/translation.toml b/frontend/public/locales/en-GB/translation.toml index 5a8565d5a5..a91985ee41 100644 --- a/frontend/public/locales/en-GB/translation.toml +++ b/frontend/public/locales/en-GB/translation.toml @@ -6638,9 +6638,13 @@ defaultPdfEditorActive = "Stirling PDF is your default PDF editor" defaultPdfEditorChecking = "Checking..." defaultPdfEditorInactive = "Another application is set as default" defaultPdfEditorSet = "Already Default" +defaultStartupView = "Default view on launch" +defaultStartupViewDescription = "Choose which tab is active in the left column when the app starts" defaultToolPickerMode = "Default tool picker mode" defaultToolPickerModeDescription = "Choose whether the tool picker opens in fullscreen or sidebar by default" description = "Configure general application preferences." +defaultViewerZoom = "Default reader zoom" +defaultViewerZoomDescription = "Set the default zoom level when opening PDFs in the reader" hideUnavailableConversions = "Hide unavailable conversions" hideUnavailableConversionsDescription = "Remove disabled conversion options in the Convert tool instead of showing them greyed out." hideUnavailableTools = "Hide unavailable tools" @@ -6663,6 +6667,16 @@ title = "For System Administrators" fullscreen = "Fullscreen" sidebar = "Sidebar" +[settings.general.startupView] +automate = "Automate" +read = "Reader" +tools = "Tools" + +[settings.general.zoomLevel] +auto = "Auto" +fitPage = "Fit page" +fitWidth = "Fit width" + [settings.general.updates] checkForUpdates = "Check for Updates" currentBackendVersion = "Current Backend Version" diff --git a/frontend/src/core/components/shared/config/configSections/GeneralSection.tsx b/frontend/src/core/components/shared/config/configSections/GeneralSection.tsx index 2d4c9f42de..d65bdcc8bf 100644 --- a/frontend/src/core/components/shared/config/configSections/GeneralSection.tsx +++ b/frontend/src/core/components/shared/config/configSections/GeneralSection.tsx @@ -7,6 +7,7 @@ import { Tooltip, NumberInput, SegmentedControl, + Select, Code, Group, Anchor, @@ -19,6 +20,8 @@ import { useTranslation } from "react-i18next"; import { usePreferences } from "@app/contexts/PreferencesContext"; import { useAppConfig } from "@app/contexts/AppConfigContext"; import type { ToolPanelMode } from "@app/constants/toolPanel"; +import type { StartupView, ViewerZoomSetting } from "@app/services/preferencesService"; +import { Z_INDEX_OVER_CONFIG_MODAL } from "@app/styles/zIndex"; import LocalIcon from "@app/components/shared/LocalIcon"; import { updateService, UpdateSummary } from "@app/services/updateService"; import UpdateModal from "@app/components/shared/UpdateModal"; @@ -293,6 +296,61 @@ const GeneralSection: React.FC = ({ hideTitle = false, hide ]} /> +
+
+ + {t("settings.general.defaultStartupView", "Default view on launch")} + + + {t( + "settings.general.defaultStartupViewDescription", + "Choose which tab is active in the left column when the app starts", + )} + +
+ updatePreference("defaultStartupView", val as StartupView)} + data={[ + { label: t("settings.general.startupView.tools", "Tools"), value: "tools" }, + { label: t("settings.general.startupView.read", "Reader"), value: "read" }, + { label: t("settings.general.startupView.automate", "Automate"), value: "automate" }, + ]} + /> +
+
+
+ + {t("settings.general.defaultViewerZoom", "Default reader zoom")} + + + {t( + "settings.general.defaultViewerZoomDescription", + "Set the default zoom level when opening PDFs in the reader", + )} + +
+