Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Fix self-hosted Users menu visibility and tidy settings (#8316)

Anthony Stirling0134f4473d7b
diff --git a/frontend/editor/src/cloud/hooks/useOpenPlan.ts b/frontend/editor/src/cloud/hooks/useOpenPlan.ts
index 4d532319f6..3c41a74daa 100644
--- a/frontend/editor/src/cloud/hooks/useOpenPlan.ts
+++ b/frontend/editor/src/cloud/hooks/useOpenPlan.ts
@@ -2,10 +2,9 @@ import { useCallback } from "react";
import { useNavigate } from "react-router-dom";
/**
- * Cloud editor builds open the settings modal on its Plan section, which is
- * where the free grant is explained and the Processor plan is switched on.
- * Routed rather than called directly because the modal is URL-driven here
- * (`/settings/*`), the same path the admin tour uses to open it.
+ * Cloud editor builds open settings on the Plan section, which is where the
+ * free grant is explained and the Processor plan is switched on. Routed, as
+ * settings live at `/settings/*`, the same path the admin tour uses.
*/
export function useOpenPlan(): (() => void) | null {
const navigate = useNavigate();
diff --git a/frontend/editor/src/core/components/shared/config/SettingsMobileBackButton.tsx b/frontend/editor/src/core/components/shared/config/SettingsMobileBackButton.tsx
index 07743c58bc..ab14640abb 100644
--- a/frontend/editor/src/core/components/shared/config/SettingsMobileBackButton.tsx
+++ b/frontend/editor/src/core/components/shared/config/SettingsMobileBackButton.tsx
@@ -8,7 +8,7 @@ interface SettingsMobileBackButtonProps {
onClick: () => void;
}
-/** Returns the settings modal from a section back to the section list. */
+/** Returns the settings page from a section back to the section list. */
export function SettingsMobileBackButton({
show,
onClick,
diff --git a/frontend/editor/src/core/components/shared/config/configNavSections.test.tsx b/frontend/editor/src/core/components/shared/config/configNavSections.test.tsx
new file mode 100644
index 0000000000..aed6b5b850
--- /dev/null
+++ b/frontend/editor/src/core/components/shared/config/configNavSections.test.tsx
@@ -0,0 +1,63 @@
+import { describe, expect, it } from "vitest";
+import type { ReactElement } from "react";
+import type { TFunction } from "i18next";
+import {
+ createPreferencesNavSection,
+ extendPreferences,
+} from "@app/components/shared/config/configNavSections";
+import PreferencesSection, {
+ type PreferencesSectionProps,
+} from "@app/components/shared/config/configSections/preferences/PreferencesSection";
+
+const t = ((key: string, fallback?: string) =>
+ fallback ?? key) as unknown as TFunction<"translation", undefined>;
+
+function page(sections: ReturnType<typeof extendPreferences>) {
+ return sections[0].items[0]
+ .component as ReactElement<PreferencesSectionProps>;
+}
+
+describe("extendPreferences", () => {
+ it("keeps what earlier layers passed when a later one adds its own", () => {
+ const base = [createPreferencesNavSection(t, { hideAdminBanner: true })];
+ const withAccount = extendPreferences(base, { accountSlot: "account" });
+ const withUpdates = extendPreferences(withAccount, {
+ hideUpdateSection: true,
+ });
+
+ const props = page(withUpdates).props;
+ expect(page(withUpdates).type).toBe(PreferencesSection);
+ expect(props.hideAdminBanner).toBe(true);
+ expect(props.accountSlot).toBe("account");
+ expect(props.hideUpdateSection).toBe(true);
+ });
+
+ it("keeps a wrapper page when a later layer adds props", () => {
+ const Wrapper = (_props: PreferencesSectionProps) => null;
+ const wrapped = extendPreferences(
+ [createPreferencesNavSection(t, { accountSlot: "account" })],
+ {},
+ Wrapper,
+ );
+ const extended = extendPreferences(wrapped, { hideAdminBanner: true });
+
+ expect(page(extended).type).toBe(Wrapper);
+ expect(page(extended).props.accountSlot).toBe("account");
+ expect(page(extended).props.hideAdminBanner).toBe(true);
+ });
+
+ it("leaves every other row alone", () => {
+ const other = {
+ key: "about" as const,
+ label: "About",
+ icon: "settings" as const,
+ };
+ const sections = extendPreferences(
+ [{ title: "About", items: [{ ...other, component: null }] }],
+ {
+ accountSlot: "account",
+ },
+ );
+ expect(sections[0].items[0].component).toBeNull();
+ });
+});
diff --git a/frontend/editor/src/core/components/shared/config/configNavSections.tsx b/frontend/editor/src/core/components/shared/config/configNavSections.tsx
index c31bcc7f38..3112241415 100644
--- a/frontend/editor/src/core/components/shared/config/configNavSections.tsx
+++ b/frontend/editor/src/core/components/shared/config/configNavSections.tsx
@@ -1,9 +1,9 @@
-import React from "react";
+import { isValidElement, type ComponentType } from "react";
import { useTranslation } from "react-i18next";
import type { TFunction } from "i18next";
-import PreferencesSection from "@app/components/shared/config/configSections/preferences/PreferencesSection";
-import GeneralSection from "@app/components/shared/config/configSections/GeneralSection";
-import HotkeysSection from "@app/components/shared/config/configSections/HotkeysSection";
+import PreferencesSection, {
+ type PreferencesSectionProps,
+} from "@app/components/shared/config/configSections/preferences/PreferencesSection";
import AboutSection from "@app/components/shared/config/configSections/AboutSection";
import type {
ConfigNavItem,
@@ -24,6 +24,63 @@ export interface ConfigColors {
headerBorder: string;
}
+/** Nav key of the Preferences page every flavor shares. */
+export const PREFERENCES_ITEM_KEY = "general";
+
+/**
+ * The Preferences group. A plain builder rather than a hook so the SaaS nav,
+ * which is assembled outside a component, renders the same page.
+ */
+export function createPreferencesNavSection(
+ t: TFunction<"translation", undefined>,
+ props: PreferencesSectionProps = {},
+): ConfigNavSection {
+ return {
+ id: "preferences",
+ title: t("settings.preferences.title", "Preferences"),
+ items: [
+ {
+ key: PREFERENCES_ITEM_KEY,
+ label: t("settings.general.title", "General"),
+ description: t(
+ "settings.preferences.description",
+ "How the editor looks and behaves for you, and your account.",
+ ),
+ icon: "sliders-horizontal",
+ component: <PreferencesSection {...props} />,
+ },
+ ],
+ };
+}
+
+/**
+ * Lays `extra` over the Preferences page's props so layers compose, not clobber.
+ * `Page` swaps in a wrapper for extras that need hooks; omitted, the page is kept.
+ */
+export function extendPreferences(
+ sections: ConfigNavSection[],
+ extra: PreferencesSectionProps,
+ Page?: ComponentType<PreferencesSectionProps>,
+): ConfigNavSection[] {
+ return sections.map((section) => ({
+ ...section,
+ items: section.items.map((item) => {
+ if (item.key !== PREFERENCES_ITEM_KEY) return item;
+ const current = isValidElement<PreferencesSectionProps>(item.component)
+ ? item.component
+ : null;
+ const Component =
+ Page ??
+ (current?.type as ComponentType<PreferencesSectionProps> | undefined) ??
+ PreferencesSection;
+ return {
+ ...item,
+ component: <Component {...current?.props} {...extra} />,
+ };
+ }),
+ }));
+}
+
export const useConfigNavSections = (
_isAdmin: boolean = false,
_runningEE: boolean = false,
@@ -34,22 +91,7 @@ export const useConfigNavSections = (
const { t } = useTranslation();
const sections: ConfigNavSection[] = [
- {
- id: "preferences",
- title: t("settings.preferences.title", "Preferences"),
- items: [
- {
- key: "general",
- label: t("settings.general.title", "General"),
- description: t(
- "settings.preferences.description",
- "How the editor looks and behaves for you, and your account.",
- ),
- icon: "sliders-horizontal",
- component: <PreferencesSection />,
- },
- ],
- },
+ createPreferencesNavSection(t),
// Reference material: read once and rarely revisited, so it is one page
// rather than four rows you have to open in turn.
{
@@ -74,35 +116,3 @@ export const useConfigNavSections = (
return sections;
};
-
-/**
- * The editor's own preference sections, for builders that are plain functions
- * rather than hooks (the cloud navs assemble their tree outside a component)
- * and so must be handed a `t` instead of calling useTranslation themselves.
- *
- * Replaces a hardcoded-English copy of this list: the SaaS nav was its only
- * caller, which is why "Preferences", "General" and "Keyboard Shortcuts" never
- * translated there.
- */
-export const createConfigNavSections = (
- t: TFunction<"translation", undefined>,
-): ConfigNavSection[] => [
- {
- id: "preferences",
- title: t("settings.preferences.title", "Preferences"),
- items: [
- {
- key: "general",
- label: t("settings.general.title", "General"),
- icon: "settings",
- component: <GeneralSection hideTitle />,
- },
- {
- key: "hotkeys",
- label: t("settings.hotkeys.title", "Keyboard Shortcuts"),
- icon: "keyboard",
- component: <HotkeysSection />,
- },
- ],
- },
-];
diff --git a/frontend/editor/src/core/components/shared/config/configSections/GeneralSection.stories.tsx b/frontend/editor/src/core/components/shared/config/configSections/GeneralSection.stories.tsx
deleted file mode 100644
index 08047afb17..0000000000
--- a/frontend/editor/src/core/components/shared/config/configSections/GeneralSection.stories.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import type { Meta, StoryObj } from "@storybook/react-vite";
-import GeneralSection from "@app/components/shared/config/configSections/GeneralSection";
-import { PreferencesProvider } from "@app/contexts/PreferencesContext";
-import { ThemeProvider } from "@app/components/shared/ThemeProvider";
-import { AppConfigProvider } from "@app/contexts/AppConfigContext";
-
-// Reads theme/tool-panel preferences via usePreferences()/useTheme() and server
-// config via useAppConfig() — none of which the Storybook preview's own provider
-// tree supplies (those are the portal contexts), so wrap here. AppConfigProvider
-// uses autoFetch off so stories render a fixed config instead of hitting the API.
-const meta = {
- title: "Shared/Config/ConfigSections/GeneralSection",
- component: GeneralSection,
- parameters: { layout: "padded" },
- decorators: [
- (Story) => (
- <PreferencesProvider>
- <ThemeProvider>
- <Story />
- </ThemeProvider>
- </PreferencesProvider>
- ),
- ],
-} satisfies Meta<typeof GeneralSection>;
-export default meta;
-type Story = StoryObj<typeof meta>;
-
-/** Login enabled, no backend version known yet — Software Updates section and admin banner stay hidden. */
-export const Default: Story = {
- decorators: [
- (StoryComponent) => (
- <AppConfigProvider
- autoFetch={false}
- bootstrapMode="non-blocking"
- initialConfig={{ enableLogin: true }}
- >
- <StoryComponent />
- </AppConfigProvider>
- ),
- ],
-};
-
-/** Backend version known — shows the Software Updates section with version info. */
-export const WithBackendVersion: Story = {
- decorators: [
- (StoryComponent) => (
- <AppConfigProvider
- autoFetch={false}
- bootstrapMode="non-blocking"
- initialConfig={{ enableLogin: true, appVersion: "1.2.3" }}
- >
- <StoryComponent />
- </AppConfigProvider>
- ),
- ],
-};
-
-/** Login disabled — the "For System Administrators" banner shows, prompting the env vars to enable it. */
-export const AdminBanner: Story = {
- decorators: [
- (StoryComponent) => (
- <AppConfigProvider
- autoFetch={false}
- bootstrapMode="non-blocking"
- initialConfig={{ enableLogin: false }}
- >
- <StoryComponent />
- </AppConfigProvider>
- ),
- ],
-};
diff --git a/frontend/editor/src/core/components/shared/config/configSections/GeneralSection.tsx b/frontend/editor/src/core/components/shared/config/configSections/GeneralSection.tsx
deleted file mode 100644
index 0231729c42..0000000000
--- a/frontend/editor/src/core/components/shared/config/configSections/GeneralSection.tsx
+++ /dev/null
@@ -1,843 +0,0 @@
-import React, { useId, useState, useEffect } from "react";
-import { InfoTooltip } from "@app/ui/InfoTooltip";
-import {
- Paper,
- Stack,
- Switch,
- Text,
- NumberInput,
- Select,
- Code,
- Group,
- Anchor,
- Badge,
-} from "@mantine/core";
-import { Button } from "@app/ui/Button";
-import { ActionIcon } from "@app/ui/ActionIcon";
-import { SegmentedControl } from "@app/ui/SegmentedControl";
-import { useTranslation } from "react-i18next";
-import { usePreferences } from "@app/contexts/PreferencesContext";
-import { useAppConfig } from "@app/contexts/AppConfigContext";
-import { useTheme } from "@app/components/shared/ThemeProvider";
-import LanguageSelector from "@app/components/shared/LanguageSelector";
-import type { ToolPanelMode } from "@app/constants/toolPanel";
-import {
- type StartupView,
- type ViewerZoomSetting,
-} from "@app/services/preferencesService";
-import { Z_INDEX_OVER_CONFIG_MODAL } from "@app/styles/zIndex";
-import { Icon } from "@app/ui/Icon";
-import { updateService, UpdateSummary } from "@app/services/updateService";
-import UpdateModal from "@app/components/shared/UpdateModal";
-import type {
- DesktopInstallState,
- DesktopInstallProgress,
- DesktopInstallActions,
- DesktopInstallCanInstall,
-} from "@app/components/shared/UpdateModal";
-import { useFrontendVersionInfo } from "@app/hooks/useFrontendVersionInfo";
-
-const DEFAULT_AUTO_UNZIP_FILE_LIMIT = 4;
-const BANNER_DISMISSED_KEY = "stirlingpdf_features_banner_dismissed";
-
-/**
- * Desktop-only: user-facing update policy control, rendered inside the
- * Software Updates section alongside the version info. Passed from the
- * desktop GeneralSection override so this core component doesn't have to
- * import any Tauri APIs directly.
- */
-export interface DesktopUpdateModeControl {
- /** Current mode. */
- mode: "prompt" | "auto" | "disabled";
- /** `true` when the mode was written by a provisioning file — disables the control. */
- locked: boolean;
- /** Called when the user picks a new mode. Async: surface errors via toast. */
- onChange: (mode: "prompt" | "auto" | "disabled") => Promise<void> | void;
-}
-
-interface GeneralSectionProps {
- hideTitle?: boolean;
- hideUpdateSection?: boolean;
- hideAdminBanner?: boolean;
- /** Desktop-only: Tauri updater install state, passed from the desktop override. */
- desktopInstall?: {
- state: DesktopInstallState;
- progress: DesktopInstallProgress | null;
- errorMessage: string | null;
- tauriInstallReady: boolean;
- /** Result of the `can_install_updates` probe, used to show an inline
- * warning when msiexec would need UAC elevation this user doesn't have. */
- canInstall?: DesktopInstallCanInstall | null;
- actions: DesktopInstallActions;
- };
- /** Desktop-only: update-mode toggle (prompt/auto/disabled). */
- desktopUpdateMode?: DesktopUpdateModeControl;
-}
-
-const GeneralSection: React.FC<GeneralSectionProps> = ({
- hideTitle = false,
- hideUpdateSection = false,
- hideAdminBanner = false,
- desktopInstall,
- desktopUpdateMode,
-}) => {
- const { t } = useTranslation();
- // Each setting is a row of label text next to a bare control, so the controls
- // are named by pointing at that text rather than by a <label> association.
- const labelIds = useId();
- const updateModeLabelId = `${labelIds}-update-mode`;
- const viewerZoomLabelId = `${labelIds}-viewer-zoom`;
- const hideToolsLabelId = `${labelIds}-hide-tools`;
- const hideConversionsLabelId = `${labelIds}-hide-conversions`;
- const autoUnzipLabelId = `${labelIds}-auto-unzip`;
- const autoUnzipLimitLabelId = `${labelIds}-auto-unzip-limit`;
- const { preferences, updatePreference } = usePreferences();
- const { config } = useAppConfig();
- const { setTheme, themeMode } = useTheme();
- const [fileLimitInput, setFileLimitInput] = useState<number | string>(
- preferences.autoUnzipFileLimit,
- );
- const [bannerDismissed, setBannerDismissed] = useState(() => {
- // Check localStorage on mount
- return localStorage.getItem(BANNER_DISMISSED_KEY) === "true";
- });
- const [updateSummary, setUpdateSummary] = useState<UpdateSummary | null>(
- null,
- );
- const [updateModalOpened, setUpdateModalOpened] = useState(false);
- const [checkingUpdate, setCheckingUpdate] = useState(false);
- const { appVersion, mismatchVersion } = useFrontendVersionInfo(
- config?.appVersion,
- );
- const frontendVersionLabel = appVersion ?? t("common.loading", "Loading..."); // null = loading, shown only when appVersion !== undefined
-
- // Sync local state with preference changes
- useEffect(() => {
- setFileLimitInput(preferences.autoUnzipFileLimit);
- }, [preferences.autoUnzipFileLimit]);
-
- // The version to use for update checks — on desktop use the Tauri app version,
- // falling back to the backend version
- const currentVersion = appVersion ?? config?.appVersion ?? null;
-
- // Check for updates on mount — skipped when the update UI is hidden (SaaS
- // build, managed-disabled desktop) so no external update call ever fires.
- useEffect(() => {
- if (hideUpdateSection) return;
- if (currentVersion) {
- checkForUpdate();
- }
- }, [currentVersion, config?.machineType, hideUpdateSection]);
-
- const checkForUpdate = async () => {
- if (!currentVersion) return;
-
- setCheckingUpdate(true);
-
- const machineInfo = {
- machineType: config?.machineType ?? "unknown",
- activeSecurity: config?.activeSecurity ?? false,
- licenseType: config?.license ?? "NORMAL",
- };
-
- const summary = await updateService.getUpdateSummary(
- currentVersion,
- machineInfo,
- );
-
- if (
- summary?.latest_version &&
- updateService.compareVersions(summary.latest_version, currentVersion) > 0
- ) {
- setUpdateSummary(summary);
- } else {
- setUpdateSummary(null);
- }
-
- setCheckingUpdate(false);
- };
-
- // Build desktop install props for the UpdateModal (only when provided by desktop override)
- const desktopInstallProps = desktopInstall?.tauriInstallReady
- ? {
- state: desktopInstall.state,
- progress: desktopInstall.progress,
- errorMessage: desktopInstall.errorMessage,
- canInstall: desktopInstall.canInstall,
- actions: desktopInstall.actions,
- }
- : undefined;
-
- // Check if login is disabled
- const loginDisabled = !config?.enableLogin;
-
- const handleDismissBanner = () => {
- setBannerDismissed(true);
- localStorage.setItem(BANNER_DISMISSED_KEY, "true");
- };
-
- return (
- <Stack gap="lg">
- {!hideTitle && (
- <div>
- <Text fw={600} size="lg">
- {t("settings.general.title", "General")}
- </Text>
- <Text size="sm" c="dimmed">
- {t(
- "settings.general.description",
- "Configure general application preferences.",
- )}
- </Text>
- </div>
- )}
-
- {!hideAdminBanner && loginDisabled && !bannerDismissed && (
- <Paper
- withBorder
- p="md"
- radius="md"
- style={{
- background: "var(--mantine-color-blue-0)",
- position: "relative",
- }}
- >
- <ActionIcon
- variant="tertiary"
- size="sm"
- style={{ position: "absolute", top: "0.5rem", right: "0.5rem" }}
- onClick={handleDismissBanner}
- aria-label={t("settings.general.enableFeatures.dismiss", "Dismiss")}
- >
- <Icon name="x" size="1rem" />
- </ActionIcon>
- <Stack gap="sm">
- <Group gap="xs">
- <Icon
- name="shield-user"
- size="1.2rem"
- style={{ color: "var(--c-accent-text)" }}
- />
- <Text
- fw={600}
- size="sm"
- style={{ color: "var(--mantine-color-blue-9)" }}
- >
- {t(
- "settings.general.enableFeatures.title",
- "For System Administrators",
- )}
- </Text>
- </Group>
- <Text size="sm" c="dimmed">
- {t(
- "settings.general.enableFeatures.intro",
- "Enable user authentication, team management, and workspace features for your organization.",
- )}
- </Text>
- <Group gap="xs" wrap="wrap">
- <Text size="sm" c="dimmed">
- {t("settings.general.enableFeatures.action", "Configure")}
- </Text>
- <Code>SECURITY_ENABLELOGIN=true</Code>
- <Text size="sm" c="dimmed">
- {t("settings.general.enableFeatures.and", "and")}
- </Text>
- <Code>DISABLE_ADDITIONAL_FEATURES=false</Code>
- </Group>
- <Text size="xs" c="dimmed" fs="italic">
- {t(
- "settings.general.enableFeatures.benefit",
- "Enables user roles, team collaboration, admin controls, and enterprise features.",
- )}
- </Text>
- <Anchor
- href="https://docs.stirlingpdf.com/Configuration/System%20and%20Security/"
- target="_blank"
- size="sm"
- >
- {t(
- "settings.general.enableFeatures.learnMore",
- "Learn more in documentation",
- )}{" "}
- →
- </Anchor>
- </Stack>
- </Paper>
- )}
-
- {/* Update Check Section — show when backend version is known OR in desktop mode (Tauri version is always available) */}
- {!hideUpdateSection && (config?.appVersion || !!desktopInstall) && (
- <Paper withBorder p="md" radius="md">
- <Stack gap="md">
- <div>
- <Group justify="space-between" align="center">
- <div>
- <Text fw={600} size="sm">
- {t("settings.general.updates.title", "Software Updates")}{" "}
- <InfoTooltip
- label={t(
- "settings.general.updates.description",
- "Check for updates and view version information",
- )}
- />
- </Text>
- </div>
- {updateSummary && (
- <Badge
- color={
- updateSummary.max_priority === "urgent" ? "red" : "blue"
- }
- variant="filled"
- >
- {updateSummary.max_priority === "urgent"
- ? t("update.urgentUpdateAvailable", "Urgent Update")
- : t("update.updateAvailable", "Update Available")}
- </Badge>
- )}
- </Group>
- </div>
- {appVersion !== undefined && (
- <Group justify="space-between" align="center">
- <div>
- <Text size="sm" c="dimmed">
- {t(
- "settings.general.updates.currentFrontendVersion",
- "Current Frontend Version",
- )}
- :{" "}
- <Text component="span" fw={500}>
- {frontendVersionLabel}
- </Text>
- </Text>
- {mismatchVersion && (
- <Text size="sm" c="var(--color-red-dark)" mt={4}>
- {t(
- "settings.general.updates.versionMismatch",
- "Warning: A mismatch has been detected between the client version and the AppConfig version. Using different versions can lead to compatibility issues, errors, and security risks. Please ensure that server and client are using the same version.",
- )}
- </Text>
- )}
- </div>
- </Group>
- )}
- <Group justify="space-between" align="center">
- <div>
- {config?.appVersion && (
- <Text size="sm" c="dimmed">
- {t(
- "settings.general.updates.currentBackendVersion",
- "Current Backend Version",
- )}
- :{" "}
- <Text component="span" fw={500}>
- {config.appVersion}
- </Text>
- </Text>
- )}
- {updateSummary && (
- <Text size="sm" c="dimmed" mt={4}>
- {t(
- "settings.general.updates.latestVersion",
- "Latest Version",
- )}
- :{" "}
- <Text component="span" fw={500} c="var(--c-accent-text)">
- {updateSummary.latest_version}
- </Text>
- </Text>
- )}
- </div>
- <Group gap="sm">
- <Button
- size="sm"
- variant="secondary"
- onClick={checkForUpdate}
- loading={checkingUpdate}
- disabled={!currentVersion}
- leftSection={<Icon name="refresh-cw" size="1rem" />}
- >
- {t(
- "settings.general.updates.checkForUpdates",
- "Check for Updates",
- )}
- </Button>
- {updateSummary && (
- <Button
- size="sm"
- accent={
- updateSummary.max_priority === "urgent"
- ? "danger"
- : "default"
- }
- onClick={() => setUpdateModalOpened(true)}
- leftSection={<Icon name="square-arrow-down" size="1rem" />}
- >
- {t("settings.general.updates.viewDetails", "View Details")}
- </Button>
- )}
- </Group>
- </Group>
-
- {/* Desktop-only: update behaviour selector (prompt / auto / disabled).
- Rendered disabled with a "Managed by administrator" hint when the
- mode was pinned by a provisioning file. */}
- {desktopUpdateMode && (
- <Stack gap="xs">
- <Group gap="xs" align="center">
- <Text id={updateModeLabelId} fw={600} size="sm">
- {t(
- "settings.general.updates.updateBehavior",
- "Update behavior",
- )}
- </Text>
- {desktopUpdateMode.locked && (
- // `color="gray" variant="light"` rendered as near-invisible
- // light-on-dark in dark mode. `blue light` has enough
- // contrast in both themes to read clearly without being
- // shouty.
- <Badge color="blue" variant="light" size="sm" radius="sm">
- {t(
- "settings.general.updates.managedByAdmin",
- "Managed by administrator",
- )}
- </Badge>
- )}
- <InfoTooltip
- label={
- desktopUpdateMode.locked
- ? t(
- "settings.general.updates.updateBehaviorLockedDescription",
- "Your administrator has configured how Stirling-PDF handles updates on this machine. Contact them to change this.",
- )
- : t(
- "settings.general.updates.updateBehaviorDescription",
- "Choose whether to prompt before installing updates, install them automatically, or skip update checks entirely.",
- )
- }
- />
- </Group>
- <Select
- aria-labelledby={updateModeLabelId}
- disabled={desktopUpdateMode.locked}
- value={desktopUpdateMode.mode}
- onChange={(value) => {
- if (!value) return;
- void desktopUpdateMode.onChange(
- value as "prompt" | "auto" | "disabled",
- );
- }}
- data={[
- {
- value: "prompt",
- label: t(
- "settings.general.updates.modePrompt",
- "Ask me before installing updates",
- ),
- },
- {
- value: "auto",
- label: t(
- "settings.general.updates.modeAuto",
- "Install updates automatically",
- ),
- },
- {
- value: "disabled",
- label: t(
- "settings.general.updates.modeDisabled",
- "Don't check for updates",
- ),
- },
- ]}
- maw={360}
- comboboxProps={{
- withinPortal: true,
- zIndex: Z_INDEX_OVER_CONFIG_MODAL,
- }}
- />
- </Stack>
- )}
- </Stack>
- </Paper>
- )}
-
- {/* Appearance */}
- <Paper withBorder p="md" radius="md">
- <Stack gap="md">
- <div
- id="setting-theme"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text fw={500} size="sm">
- {t("settings.general.theme", "Theme")}{" "}
- <InfoTooltip
- label={t(
- "settings.general.themeDescription",
- "Choose light, dark, or follow your system so it switches automatically.",
- )}
- />
- </Text>
- </div>
- <SegmentedControl
- value={themeMode}
- onChange={(val) => setTheme(val)}
- options={[
- {
- label: t("settings.general.themeLight", "Light"),
- value: "light",
- },
- {
- label: t("settings.general.themeDark", "Dark"),
- value: "dark",
- },
- {
- label: t("settings.general.themeSystem", "System"),
- value: "system",
- },
- ]}
- />
- </div>
- </Stack>
- </Paper>
-
- {/* Language */}
- <Paper withBorder p="md" radius="md">
- <div
- id="setting-language"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text fw={500} size="sm">
- {t("settings.general.language", "Language")}{" "}
- <InfoTooltip
- label={t(
- "settings.general.languageDescription",
- "Choose the display language",
- )}
- />
- </Text>
- </div>
- <LanguageSelector position="bottom-end" offset={6} />
- </div>
- </Paper>
-
- <Paper withBorder p="md" radius="md">
- <Stack gap="md">
- <div
- id="setting-tool-picker-mode"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text fw={500} size="sm">
- {t(
- "settings.general.defaultToolPickerMode",
- "Default tool picker mode",
- )}{" "}
- <InfoTooltip
- label={t(
- "settings.general.defaultToolPickerModeDescription",
- "Choose whether the tool picker opens in fullscreen or sidebar by default",
- )}
- />
- </Text>
- </div>
- <SegmentedControl
- value={preferences.defaultToolPanelMode}
- onChange={(val: string) =>
- updatePreference("defaultToolPanelMode", val as ToolPanelMode)
- }
- options={[
- {
- label: t("settings.general.mode.sidebar", "Sidebar"),
- value: "sidebar",
- },
- {
- label: t("settings.general.mode.fullscreen", "Fullscreen"),
- value: "fullscreen",
- },
- ]}
- />
- </div>
- <div
- id="setting-startup-view"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text fw={500} size="sm">
- {t(
- "settings.general.defaultStartupView",
- "Default view on launch",
- )}{" "}
- <InfoTooltip
- label={t(
- "settings.general.defaultStartupViewDescription",
- "Choose which view is active when the app starts",
- )}
- />
- </Text>
- </div>
- <SegmentedControl
- value={preferences.defaultStartupView}
- onChange={(val: string) =>
- updatePreference("defaultStartupView", val as StartupView)
- }
- options={[
- {
- 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",
- },
- ]}
- />
- </div>
- <div
- id="setting-reader-zoom"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text id={viewerZoomLabelId} fw={500} size="sm">
- {t("settings.general.defaultViewerZoom", "Default reader zoom")}{" "}
- <InfoTooltip
- label={t(
- "settings.general.defaultViewerZoomDescription",
- "Set the default zoom level when opening PDFs in the reader",
- )}
- />
- </Text>
- </div>
- <Select
- aria-labelledby={viewerZoomLabelId}
- value={preferences.defaultViewerZoom}
- onChange={(val: string | null) => {
- if (val)
- updatePreference(
- "defaultViewerZoom",
- val as ViewerZoomSetting,
- );
- }}
- data={[
- {
- label: t("settings.general.zoomLevel.auto", "Auto"),
- value: "auto",
- },
- {
- label: t("settings.general.zoomLevel.fitWidth", "Fit width"),
- value: "fitWidth",
- },
- {
- label: t("settings.general.zoomLevel.fitPage", "Fit page"),
- value: "fitPage",
- },
- { label: "50%", value: "50" },
- { label: "75%", value: "75" },
- { label: "100%", value: "100" },
- { label: "125%", value: "125" },
- { label: "150%", value: "150" },
- { label: "200%", value: "200" },
- ]}
- style={{ width: 140 }}
- allowDeselect={false}
- comboboxProps={{
- withinPortal: true,
- zIndex: Z_INDEX_OVER_CONFIG_MODAL,
- }}
- />
- </div>
- <div
- id="setting-hide-unavailable-tools"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text id={hideToolsLabelId} fw={500} size="sm">
- {t(
- "settings.general.hideUnavailableTools",
- "Hide unavailable tools",
- )}{" "}
- <InfoTooltip
- label={t(
- "settings.general.hideUnavailableToolsDescription",
- "Remove tools that have been disabled by your server instead of showing them greyed out.",
- )}
- />
- </Text>
- </div>
- <Switch
- aria-labelledby={hideToolsLabelId}
- checked={preferences.hideUnavailableTools}
- onChange={(event) =>
- updatePreference(
- "hideUnavailableTools",
- event.currentTarget.checked,
- )
- }
- />
- </div>
- <div
- id="setting-hide-unavailable-conversions"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text id={hideConversionsLabelId} fw={500} size="sm">
- {t(
- "settings.general.hideUnavailableConversions",
- "Hide unavailable conversions",
- )}{" "}
- <InfoTooltip
- label={t(
- "settings.general.hideUnavailableConversionsDescription",
- "Remove disabled conversion options in the Convert tool instead of showing them greyed out.",
- )}
- />
- </Text>
- </div>
- <Switch
- aria-labelledby={hideConversionsLabelId}
- checked={preferences.hideUnavailableConversions}
- onChange={(event) =>
- updatePreference(
- "hideUnavailableConversions",
- event.currentTarget.checked,
- )
- }
- />
- </div>
-
- <div
- id="setting-auto-unzip"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text id={autoUnzipLabelId} fw={500} size="sm">
- {t("settings.general.autoUnzip", "Auto-unzip API responses")}{" "}
- <InfoTooltip
- label={t(
- "settings.general.autoUnzipTooltip",
- "Automatically extract ZIP files returned from API operations. Disable to keep ZIP files intact. This does not affect automation workflows.",
- )}
- />
- </Text>
- </div>
- <Switch
- aria-labelledby={autoUnzipLabelId}
- checked={preferences.autoUnzip}
- onChange={(event) =>
- updatePreference("autoUnzip", event.currentTarget.checked)
- }
- />
- </div>
-
- <div
- id="setting-auto-unzip-file-limit"
- style={{
- display: "flex",
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text id={autoUnzipLimitLabelId} fw={500} size="sm">
- {t(
- "settings.general.autoUnzipFileLimit",
- "Auto-unzip file limit",
- )}{" "}
- <InfoTooltip
- label={t(
- "settings.general.autoUnzipFileLimitTooltip",
- "Only unzip if the ZIP contains this many files or fewer. Set higher to extract larger ZIPs.",
- )}
- />
- </Text>
- </div>
- <NumberInput
- aria-labelledby={autoUnzipLimitLabelId}
- value={fileLimitInput}
- onChange={setFileLimitInput}
- onBlur={() => {
- const numValue = Number(fileLimitInput);
- const finalValue =
- !fileLimitInput ||
- isNaN(numValue) ||
- numValue < 1 ||
- numValue > 100
- ? DEFAULT_AUTO_UNZIP_FILE_LIMIT
- : numValue;
- setFileLimitInput(finalValue);
- updatePreference("autoUnzipFileLimit", finalValue);
- }}
- min={1}
- max={100}
- step={1}
- disabled={!preferences.autoUnzip}
- style={{ width: 90 }}
- />
- </div>
- </Stack>
- </Paper>
-
- {/* Update Modal */}
- {updateSummary && (config?.appVersion || !!desktopInstall) && (
- <UpdateModal
- opened={updateModalOpened}
- onClose={() => setUpdateModalOpened(false)}
- onRemindLater={() => {
- localStorage.setItem(
- "stirling-pdf-updater:snoozedUntil",
- String(Date.now() + 24 * 60 * 60 * 1000),
- );
- }}
- currentVersion={appVersion ?? config?.appVersion ?? ""}
- updateSummary={updateSummary}
- machineInfo={{
- machineType: config?.machineType ?? "unknown",
- activeSecurity: config?.activeSecurity ?? false,
- licenseType: config?.license ?? "NORMAL",
- }}
- desktopInstall={desktopInstallProps}
- />
- )}
- </Stack>
- );
-};
-
-export default GeneralSection;
diff --git a/frontend/editor/src/core/components/shared/config/configSections/HotkeysSection.stories.tsx b/frontend/editor/src/core/components/shared/config/configSections/HotkeysSection.stories.tsx
deleted file mode 100644
index 94420ad5cd..0000000000
--- a/frontend/editor/src/core/components/shared/config/configSections/HotkeysSection.stories.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import type { ReactElement } from "react";
-import type { Meta, StoryObj } from "@storybook/react-vite";
-import HotkeysSection from "@app/components/shared/config/configSections/HotkeysSection";
-import { PreferencesProvider } from "@app/contexts/PreferencesContext";
-import { ToolRegistryProvider } from "@app/contexts/ToolRegistryProvider";
-import { NavigationProvider } from "@app/contexts/NavigationContext";
-import { ToolWorkflowProvider } from "@app/contexts/ToolWorkflowContext";
-import { HotkeyProvider } from "@app/contexts/HotkeyContext";
-
-/**
- * HotkeyContext reads the tool registry and selection state off
- * ToolWorkflowContext, so both providers must wrap the story.
- */
-function withProviders(Story: () => ReactElement) {
- return (
- <PreferencesProvider>
- <ToolRegistryProvider>
- <NavigationProvider>
- <ToolWorkflowProvider>
- <HotkeyProvider>
- <Story />
- </HotkeyProvider>
- </ToolWorkflowProvider>
- </NavigationProvider>
- </ToolRegistryProvider>
- </PreferencesProvider>
- );
-}
-
-const meta = {
- title: "Shared/Config/ConfigSections/HotkeysSection",
- component: HotkeysSection,
- decorators: [withProviders],
-} satisfies Meta<typeof HotkeysSection>;
-export default meta;
-
-type Story = StoryObj<typeof meta>;
-
-/** Full tool list with default keyboard shortcuts assigned. */
-export const Default: Story = {};
diff --git a/frontend/editor/src/core/components/shared/config/configSections/HotkeysSection.tsx b/frontend/editor/src/core/components/shared/config/configSections/HotkeysSection.tsx
deleted file mode 100644
index 80126bfc26..0000000000
--- a/frontend/editor/src/core/components/shared/config/configSections/HotkeysSection.tsx
+++ /dev/null
@@ -1,250 +0,0 @@
-import React, { useEffect, useMemo, useState } from "react";
-import {
- Alert,
- Badge,
- Box,
- Divider,
- Group,
- Paper,
- Stack,
- Text,
- TextInput,
-} from "@mantine/core";
-import { Button } from "@app/ui/Button";
-import { useTranslation } from "react-i18next";
-import { useToolWorkflow } from "@app/contexts/ToolWorkflowContext";
-import { useHotkeys } from "@app/contexts/HotkeyContext";
-import { ToolId } from "@app/types/toolId";
-import HotkeyDisplay from "@app/components/hotkeys/HotkeyDisplay";
-import {
- bindingEquals,
- eventToBinding,
- HotkeyBinding,
-} from "@app/utils/hotkeys";
-import { ToolRegistryEntry } from "@app/data/toolsTaxonomy";
-
-const rowStyle: React.CSSProperties = {
- display: "flex",
- flexDirection: "column",
- gap: "0.5rem",
-};
-
-const rowHeaderStyle: React.CSSProperties = {
- display: "flex",
- flexWrap: "wrap",
- alignItems: "center",
- justifyContent: "space-between",
- gap: "0.5rem",
-};
-
-const HotkeysSection: React.FC = () => {
- const { t } = useTranslation();
- const { toolRegistry } = useToolWorkflow();
- const {
- hotkeys,
- defaults,
- updateHotkey,
- resetHotkey,
- pauseHotkeys,
- resumeHotkeys,
- getDisplayParts,
- isMac,
- } = useHotkeys();
- const [editingTool, setEditingTool] = useState<ToolId | null>(null);
- const [error, setError] = useState<string | null>(null);
- const [searchQuery, setSearchQuery] = useState<string>("");
-
- const tools = useMemo(
- () => Object.entries(toolRegistry) as [ToolId, ToolRegistryEntry][],
- [toolRegistry],
- );
-
- const filteredTools = useMemo(() => {
- if (!searchQuery.trim()) return tools;
-
- const query = searchQuery.toLowerCase();
- return tools.filter(
- ([toolId, tool]) =>
- tool.name.toLowerCase().includes(query) ||
- tool.description.toLowerCase().includes(query) ||
- toolId.toLowerCase().includes(query),
- );
- }, [tools, searchQuery]);
-
- useEffect(() => {
- if (!editingTool) {
- return;
- }
- pauseHotkeys();
- return () => {
- resumeHotkeys();
- };
- }, [editingTool, pauseHotkeys, resumeHotkeys]);
-
- useEffect(() => {
- if (!editingTool) {
- return;
- }
-
- const handleKeyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") {
- event.preventDefault();
- event.stopPropagation();
- setEditingTool(null);
- setError(null);
- return;
- }
-
- event.preventDefault();
- event.stopPropagation();
-
- const binding = eventToBinding(event);
- if (!binding) {
- const osKey = isMac ? "mac" : "windows";
- setError(t(`settings.hotkeys.errorModifier.${osKey}`));
- return;
- }
-
- const conflictEntry = (
- Object.entries(hotkeys) as [ToolId, HotkeyBinding][]
- ).find(
- ([toolId, existing]) =>
- toolId !== editingTool && bindingEquals(existing, binding),
- );
-
- if (conflictEntry) {
- const conflictKey = conflictEntry[0];
- const conflictTool =
- conflictKey in toolRegistry
- ? toolRegistry[conflictKey]?.name
- : conflictKey;
- setError(
- t(
- "settings.hotkeys.errorConflict",
- "Shortcut already used by {{tool}}.",
- { tool: conflictTool },
- ),
- );
- return;
- }
-
- updateHotkey(editingTool, binding);
- setEditingTool(null);
- setError(null);
- };
-
- window.addEventListener("keydown", handleKeyDown, true);
- return () => {
- window.removeEventListener("keydown", handleKeyDown, true);
- };
- }, [editingTool, hotkeys, toolRegistry, updateHotkey, t]);
-
- const handleStartCapture = (toolId: ToolId) => {
- setEditingTool(toolId);
- setError(null);
- };
-
- return (
- <Stack gap="lg">
- <TextInput
- id="setting-hotkeys-search"
- placeholder={t("settings.hotkeys.searchPlaceholder", "Search tools...")}
- value={searchQuery}
- onChange={(event) => setSearchQuery(event.currentTarget.value)}
- size="md"
- radius="md"
- />
-
- <Paper withBorder p="md" radius="md">
- <Stack gap="md">
- {filteredTools.length === 0 ? (
- <Text c="dimmed" ta="center" py="xl">
- {t("toolPicker.noToolsFound", "No tools found")}
- </Text>
- ) : (
- filteredTools.map(([toolId, tool], index) => {
- const currentBinding = hotkeys[toolId];
- const defaultBinding = defaults[toolId];
- const isEditing = editingTool === toolId;
- const defaultParts = getDisplayParts(defaultBinding);
- const defaultLabel =
- defaultParts.length > 0
- ? defaultParts.join(" + ")
- : t("settings.hotkeys.none", "Not assigned");
-
- return (
- <React.Fragment key={toolId}>
- <Box style={rowStyle} data-testid={`hotkey-row-${toolId}`}>
- <div style={rowHeaderStyle}>
- <div
- style={{
- display: "flex",
- flexDirection: "column",
- gap: "0.25rem",
- minWidth: 0,
- }}
- >
- <Text fw={600}>{tool.name}</Text>
- <Group gap="xs" wrap="wrap" align="center">
- <HotkeyDisplay binding={currentBinding} size="md" />
- {!bindingEquals(currentBinding, defaultBinding) && (
- <Badge variant="light" color="orange" radius="sm">
- {t("settings.hotkeys.customBadge", "Custom")}
- </Badge>
- )}
- <Text size="xs" c="dimmed">
- {t(
- "settings.hotkeys.defaultLabel",
- "Default: {{shortcut}}",
- { shortcut: defaultLabel },
- )}
- </Text>
- </Group>
- </div>
-
- <Group gap="xs">
- <Button
- size="sm"
- variant={isEditing ? "primary" : "secondary"}
- onClick={() => handleStartCapture(toolId)}
- >
- {isEditing
- ? t(
- "settings.hotkeys.capturing",
- "Press keys… (Esc to cancel)",
- )
- : t("settings.hotkeys.change", "Change shortcut")}
- </Button>
- <Button
- size="sm"
- variant="tertiary"
- disabled={bindingEquals(
- currentBinding,
- defaultBinding,
- )}
- onClick={() => resetHotkey(toolId)}
- >
- {t("settings.hotkeys.reset", "Reset")}
- </Button>
- </Group>
- </div>
-
- {isEditing && error && (
- <Alert color="red" radius="sm" variant="filled">
- {error}
- </Alert>
- )}
- </Box>
-
- {index < filteredTools.length - 1 && <Divider />}
- </React.Fragment>
- );
- })
- )}
- </Stack>
- </Paper>
- </Stack>
- );
-};
-
-export default HotkeysSection;
diff --git a/frontend/editor/src/core/components/shared/config/types.ts b/frontend/editor/src/core/components/shared/config/types.ts
index 70ad653ea2..fc79951588 100644
--- a/frontend/editor/src/core/components/shared/config/types.ts
+++ b/frontend/editor/src/core/components/shared/config/types.ts
@@ -61,7 +61,7 @@ export type NavKey = (typeof VALID_NAV_KEYS)[number];
// some of these are not used yet, but appear in figma designs
-// Nav structure of the settings modal. Lives here (not configNavSections) so
+// Nav structure of the settings page. Lives here (not configNavSections) so
// consumers that only need the shape don't pull the whole section-component
// tree into their build's typecheck graph.
export interface ConfigNavItem {
diff --git a/frontend/editor/src/core/components/shared/superSearch/SuperSearch.tsx b/frontend/editor/src/core/components/shared/superSearch/SuperSearch.tsx
index d917f3f3fd..4a77d7dc24 100644
--- a/frontend/editor/src/core/components/shared/superSearch/SuperSearch.tsx
+++ b/frontend/editor/src/core/components/shared/superSearch/SuperSearch.tsx
@@ -283,8 +283,7 @@ export default function SuperSearch({
if (!combo || e.code !== "KeyK") return;
// Leave the shortcut alone while a modal owns the screen — focusing an
// input underneath the overlay would strand keyboard focus. Modals that
- // want to cede to the search (the settings modal does) close themselves
- // and call openSuperSearch() instead.
+ // want to cede to the search close themselves and call openSuperSearch().
const target = e.target as HTMLElement | null;
if (target?.closest('[role="dialog"]')) return;
e.preventDefault();
diff --git a/frontend/editor/src/core/data/settingsContentSearch.ts b/frontend/editor/src/core/data/settingsContentSearch.ts
index 16d9e7aeb4..222af14e1f 100644
--- a/frontend/editor/src/core/data/settingsContentSearch.ts
+++ b/frontend/editor/src/core/data/settingsContentSearch.ts
@@ -8,7 +8,7 @@ import type { TFunction } from "i18next";
* curated keyword.
*
* Component-free (translation subtrees only) so the always-mounted super
- * search can use it without pulling the lazy settings modal into the main
+ * search can use it without pulling the lazy settings page into the main
* bundle.
*/
diff --git a/frontend/editor/src/core/data/settingsSearchIndex.ts b/frontend/editor/src/core/data/settingsSearchIndex.ts
index cb43c46498..354da10358 100644
--- a/frontend/editor/src/core/data/settingsSearchIndex.ts
+++ b/frontend/editor/src/core/data/settingsSearchIndex.ts
@@ -1,13 +1,13 @@
import { NavKey } from "@app/components/shared/config/types";
/**
- * A single, searchable setting *row* inside the settings modal.
+ * A single, searchable setting *row* on the settings page.
*
* Section-level content matching (settingsContentSearch) only navigates to a
* whole section; this index lets the global super search deep-link to an
* individual control: navigating to `/settings/{section}#{anchor}`,
* where `anchor` is the DOM `id` placed on that control's row (see
- * AppConfigModal's focus-scroll effect and the `id=` attributes added to the
+ * SettingsPage's focus-scroll effect and the `id=` attributes added to the
* matching section components).
*/
export interface SettingsSearchEntry {
diff --git a/frontend/editor/src/core/data/settingsSectionRegistry.ts b/frontend/editor/src/core/data/settingsSectionRegistry.ts
index 933dec1204..8b60e9bb5e 100644
--- a/frontend/editor/src/core/data/settingsSectionRegistry.ts
+++ b/frontend/editor/src/core/data/settingsSectionRegistry.ts
@@ -8,16 +8,16 @@ import { NavKey } from "@app/components/shared/config/types";
* searchable* in a given build. It is intentionally **component-free**: the
* always-mounted top bar imports it (via `@app/data/settingsSectionRegistry`)
* to feed the super search, and pulling the heavy settings component tree in
- * here would defeat the lazy-loaded settings modal (AppConfigModalLazy).
+ * here would defeat the lazy-loaded settings page.
*
* Layering mirrors the nav builders (`configNavSections`): core lists the
* always-present sections; higher layers shadow this module to add their own
* (proprietary admin sections, saas cloud sections, …). A section only belongs
- * in a layer's registry if that layer's settings modal can actually render it —
+ * in a layer's registry if that layer's settings nav can actually render it -
* otherwise search would deep-link to a tab that doesn't exist.
*
* Per-user visibility (admin / login) is expressed by the flags below and
- * applied by the super search at query time, mirroring the modal's own gating.
+ * applied by the super search at query time, mirroring the nav's own gating.
*/
export interface SettingsSectionEntry {
/** Nav key; used for the `/settings/{key}` deep link. */
@@ -27,7 +27,7 @@ export interface SettingsSectionEntry {
/** English fallback / default for the label. */
labelFallback: string;
/**
- * The modal nav group this section sits under ("Preferences",
+ * The nav group this section sits under ("Preferences",
* "Configuration", …) — shown as result context ("Group · match").
* Same keys the nav builder uses.
*/
@@ -38,7 +38,7 @@ export interface SettingsSectionEntry {
/** Surface only when login mode is on (e.g. account, API keys). */
requiresLogin?: boolean;
/**
- * Admin-area section: the self-hosted modal surfaces it when the user is an
+ * Admin-area section: the self-hosted nav surfaces it when the user is an
* admin OR login mode is off (single-user self-host). Mirrors the proprietary
* nav builder's `isAdmin || !loginEnabled` gate.
*/
diff --git a/frontend/editor/src/core/hooks/useSuperSearch.ts b/frontend/editor/src/core/hooks/useSuperSearch.ts
index 1cab3a8c5b..ac4dc5e740 100644
--- a/frontend/editor/src/core/hooks/useSuperSearch.ts
+++ b/frontend/editor/src/core/hooks/useSuperSearch.ts
@@ -472,7 +472,7 @@ export function assembleSuperSearchGroups(
/**
* The editor's results provider: the shared sources wired to in-app select
* actions (open file → viewer, select tool in the workbench, deep-link into
- * the settings modal, route into the Processor).
+ * the settings page, route into the Processor).
*
* @param query current search text
* @param active whether the search surface is open; gates the My Files load
diff --git a/frontend/editor/src/core/pages/SettingsPage.tsx b/frontend/editor/src/core/pages/SettingsPage.tsx
index 6276c7070f..db3661b06a 100644
--- a/frontend/editor/src/core/pages/SettingsPage.tsx
+++ b/frontend/editor/src/core/pages/SettingsPage.tsx
@@ -101,13 +101,12 @@ const SettingsPageInner: React.FC = () => {
// `pending` matters as much as an empty list: the permission-gated sections
// arrive a request later, so a deep link to one of them is not unknown yet.
if (items.length === 0 || activeItem || pending) return;
- const target =
- (urlSection && aliases?.[urlSection]) ??
- items.find((i) => !i.disabled)?.key ??
- items[0].key;
- // The hash rides along: an aliased bookmark addresses a control, and the
- // control it names is still there under whatever absorbed its section.
- navigate(`/settings/${target}${location.search}${location.hash}`, {
+ const alias = urlSection ? aliases?.[urlSection] : undefined;
+ const target = alias ?? items.find((i) => !i.disabled)?.key ?? items[0].key;
+ // An aliased link keeps its hash; without one it lands on the card that
+ // took the retired row's key as its id.
+ const hash = location.hash || (alias ? `#${urlSection}` : "");
+ navigate(`/settings/${target}${location.search}${hash}`, {
replace: true,
});
}, [
diff --git a/frontend/editor/src/desktop/components/settings/useSettingsNav.test.tsx b/frontend/editor/src/desktop/components/settings/useSettingsNav.test.tsx
index 834a71c048..73e210980a 100644
--- a/frontend/editor/src/desktop/components/settings/useSettingsNav.test.tsx
+++ b/frontend/editor/src/desktop/components/settings/useSettingsNav.test.tsx
@@ -1,6 +1,12 @@
import { beforeEach, it, expect, vi } from "vitest";
import { renderHook, waitFor } from "@testing-library/react";
-import { useSettingsNav } from "@app/components/settings/useSettingsNav";
+import type { ReactElement } from "react";
+import {
+ useSettingsNav,
+ type SettingsNav,
+} from "@app/components/settings/useSettingsNav";
+import DesktopGeneralSection from "@app/components/shared/config/configSections/GeneralSection";
+import type { PreferencesSectionProps } from "@core/components/shared/config/configSections/preferences/PreferencesSection";
const state = vi.hoisted(() => ({
mode: "saas",
@@ -10,13 +16,33 @@ const state = vi.hoisted(() => ({
loading: false,
connectionFails: false,
workspace: true,
+ loginEnabled: false,
+ admin: true,
}));
+const ProprietaryPreferences = vi.hoisted(
+ () => (_props: { accountSlot?: string }) => null,
+);
vi.mock("@proprietary/components/shared/config/configNavSections", () => ({
- useConfigNavSections: () => [
+ useConfigNavSections: (
+ _isAdmin: boolean,
+ _runningEE: boolean,
+ loginEnabled: boolean,
+ ) => [
{
id: "preferences",
title: "Preferences",
- items: [{ key: "general", label: "Preferences", component: null }],
+ items: [
+ {
+ key: "general",
+ label: "Preferences",
+ // Stands in for proprietary's PreferencesSection and its account cards.
+ component: (
+ <ProprietaryPreferences
+ accountSlot={loginEnabled ? "account-cards" : undefined}
+ />
+ ),
+ },
+ ],
},
...(state.workspace
? [
@@ -65,11 +91,13 @@ vi.mock("@app/services/authService", () => ({
},
}));
vi.mock("@app/contexts/AppConfigContext", () => ({
- useAppConfig: () => ({ config: { isAdmin: true } }),
+ useAppConfig: () => ({
+ config: { isAdmin: true, enableLogin: state.loginEnabled },
+ }),
}));
vi.mock("@app/auth/context", () => ({
useAuth: () => ({
- isAdmin: true,
+ isAdmin: state.admin,
user: { orgOwner: state.owner },
loading: state.loading,
}),
@@ -96,6 +124,71 @@ beforeEach(() => {
state.loading = false;
state.connectionFails = false;
state.workspace = true;
+ state.loginEnabled = false;
+ state.admin = true;
+});
+
+function preferencesPage(sections: SettingsNav["sections"]) {
+ const item = sections
+ .flatMap((group) => group.items)
+ .find((entry) => entry.key === "general");
+ return item?.component as ReactElement<PreferencesSectionProps>;
+}
+
+it("keeps proprietary's account cards on the desktop Preferences page when self-hosted", async () => {
+ state.mode = "selfhosted";
+ state.loginEnabled = true;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ await waitFor(() => expect(result.current.pending).toBe(false));
+ const page = preferencesPage(result.current.sections);
+ expect(page.type).toBe(DesktopGeneralSection);
+ expect(page.props.accountSlot).toBe("account-cards");
+});
+
+it.each(["saas", "local"])(
+ "drops the self-hosted account cards in mode=%s",
+ async (mode) => {
+ state.mode = mode;
+ state.loginEnabled = true;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ await waitFor(() => expect(result.current.pending).toBe(false));
+ const page = preferencesPage(result.current.sections);
+ expect(page.type).toBe(DesktopGeneralSection);
+ expect(page.props.accountSlot).toBeUndefined();
+ },
+);
+
+it.each([
+ ["local", true],
+ ["saas", true],
+ ["selfhosted", false],
+])("hides the server-setup banner in mode=%s: %s", async (mode, hidden) => {
+ state.mode = mode;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ await waitFor(() => expect(result.current.pending).toBe(false));
+ expect(preferencesPage(result.current.sections).props.hideAdminBanner).toBe(
+ hidden,
+ );
+});
+
+it("drops the account cards while signed out", async () => {
+ state.mode = "selfhosted";
+ state.loginEnabled = true;
+ state.authenticated = false;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ await waitFor(() => expect(result.current.pending).toBe(false));
+ const page = preferencesPage(result.current.sections);
+ expect(page.type).toBe(DesktopGeneralSection);
+ expect(page.props.accountSlot).toBeUndefined();
+});
+
+it("renders the desktop Preferences page in local mode without login", async () => {
+ state.mode = "local";
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ await waitFor(() => expect(result.current.pending).toBe(false));
+ const page = preferencesPage(result.current.sections);
+ expect(page.type).toBe(DesktopGeneralSection);
+ expect(page.props.accountSlot).toBeUndefined();
});
it("finishes loading without billing when the connection lookup fails", async () => {
@@ -228,3 +321,41 @@ it("does not offer billing to a local-mode owner", async () => {
.some((item) => item.key === "billing"),
).toBe(false);
});
+
+it.each([false, true])(
+ "retains the cloud Users entry in SaaS mode without a Spring admin role: owner=%s",
+ async (owner) => {
+ state.admin = false;
+ state.owner = owner;
+ state.loginEnabled = true;
+ state.roster = true;
+ state.workspace = false;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ await waitFor(() => expect(result.current.pending).toBe(false));
+ const users = result.current.sections
+ .flatMap((section) => section.items)
+ .filter((item) => item.key === "users");
+ expect(users).toHaveLength(1);
+ // The cloud factory is mocked with a null component; the lazy Spring roster
+ // would have a React element, so this verifies which entry survives.
+ expect(users[0].component).toBeNull();
+ },
+);
+
+it.each(["selfhosted", "local"])(
+ "hides Users from a non-admin in mode=%s",
+ async (mode) => {
+ state.mode = mode;
+ state.admin = false;
+ state.loginEnabled = true;
+ state.roster = true;
+ state.workspace = false;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ await waitFor(() => expect(result.current.pending).toBe(false));
+ expect(
+ result.current.sections
+ .flatMap((section) => section.items)
+ .some((item) => item.key === "users"),
+ ).toBe(false);
+ },
+);
diff --git a/frontend/editor/src/desktop/components/shared/config/configNavSections.tsx b/frontend/editor/src/desktop/components/shared/config/configNavSections.tsx
index 0a619dbf6a..15281cb258 100644
--- a/frontend/editor/src/desktop/components/shared/config/configNavSections.tsx
+++ b/frontend/editor/src/desktop/components/shared/config/configNavSections.tsx
@@ -1,7 +1,10 @@
import { useTranslation } from "react-i18next";
import { useState, useEffect } from "react";
import { useConfigNavSections as useProprietaryConfigNavSections } from "@proprietary/components/shared/config/configNavSections";
-import { ConfigNavSection } from "@core/components/shared/config/configNavSections";
+import {
+ ConfigNavSection,
+ extendPreferences,
+} from "@core/components/shared/config/configNavSections";
import { ConnectionSettings } from "@app/components/ConnectionSettings";
import DesktopGeneralSection from "@app/components/shared/config/configSections/GeneralSection";
import { createCloudTeamNavItem } from "@app/components/shared/config/cloudConfigNavSections";
@@ -60,25 +63,25 @@ export const useConfigNavSections = (
const isSaasMode = connectionMode === "saas";
const isLocalMode = connectionMode === "local";
- // Get the proprietary sections (includes core Preferences + admin sections)
- const sections = useProprietaryConfigNavSections(
- isAdmin,
- runningEE,
- loginEnabled,
- onRequestClose,
- showSettingsWhenNoLogin,
- ).slice();
-
- // Desktop adds file-association defaults and its own update controls to the
- // Preferences page; core builds the page, desktop supplies its extras.
- const preferences = sections.find((s) => s.id === "preferences");
- if (preferences) {
- preferences.items = preferences.items.map((item) =>
- item.key === "general"
- ? { ...item, component: <DesktopGeneralSection /> }
- : item,
- );
- }
+ // Account cards and the server-setup banner concern a self-hosted server, so
+ // local and cloud mode drop them; desktop adds file defaults and update controls.
+ const isSelfHostedMode = connectionMode === "selfhosted";
+ const sections = extendPreferences(
+ useProprietaryConfigNavSections(
+ isAdmin,
+ runningEE,
+ loginEnabled,
+ onRequestClose,
+ showSettingsWhenNoLogin,
+ ),
+ {
+ hideAdminBanner: !isSelfHostedMode,
+ ...(isSelfHostedMode && isAuthenticated
+ ? {}
+ : { accountSlot: undefined }),
+ },
+ DesktopGeneralSection,
+ );
const connectionModeSection: ConfigNavSection = {
title: t("settings.connection.title", "Connection Mode"),
@@ -165,8 +168,7 @@ export const useConfigNavSections = (
});
}
- // Append remaining proprietary sections, skipping self-hosted admin sections in SaaS mode
- // and hiding the Account section when not authenticated.
+ // Append remaining proprietary sections, skipping self-hosted admin sections in SaaS mode.
for (const section of sections.slice(1)) {
const firstItemKey = section.items[0]?.key;
if (
@@ -176,11 +178,8 @@ export const useConfigNavSections = (
) {
continue;
}
- const filteredItems = isAuthenticated
- ? section.items
- : section.items.filter((item) => item.key !== "account");
- if (filteredItems.length === 0) continue;
- result.push({ ...section, items: filteredItems });
+ if (section.items.length === 0) continue;
+ result.push(section);
}
return result;
diff --git a/frontend/editor/src/desktop/components/shared/config/configSections/GeneralSection.tsx b/frontend/editor/src/desktop/components/shared/config/configSections/GeneralSection.tsx
index 7791f6efe7..b9b240586d 100644
--- a/frontend/editor/src/desktop/components/shared/config/configSections/GeneralSection.tsx
+++ b/frontend/editor/src/desktop/components/shared/config/configSections/GeneralSection.tsx
@@ -1,7 +1,9 @@
import React, { useCallback, useEffect, useState } from "react";
import { Stack, Alert } from "@mantine/core";
import { useTranslation } from "react-i18next";
-import PreferencesSection from "@core/components/shared/config/configSections/preferences/PreferencesSection";
+import PreferencesSection, {
+ type PreferencesSectionProps,
+} from "@core/components/shared/config/configSections/preferences/PreferencesSection";
import { DefaultAppSettings } from "@app/components/shared/config/configSections/DefaultAppSettings";
import { useDesktopInstall } from "@app/hooks/useDesktopInstall";
import {
@@ -10,21 +12,15 @@ import {
type UpdateModeInfo,
} from "@app/services/desktopUpdateService";
-interface GeneralSectionProps {
- /** Forwarded to the core section; the settings modal header already names it. */
- hideTitle?: boolean;
-}
-
/**
- * Desktop extension of GeneralSection.
- *
- * Adds default PDF editor settings, wires up the Tauri auto-updater install
- * flow, and exposes the user-facing update-mode control (prompt / auto /
- * disabled). When the mode is locked by a provisioning file the control is
- * still rendered but disabled, with a "Managed by administrator" hint, so
- * managed-deployment users can see what policy is in effect.
+ * Desktop Preferences page: the lower layers' props plus file defaults, the Tauri
+ * updater and the update-mode control (shown disabled when provisioning locks it).
*/
-const GeneralSection: React.FC<GeneralSectionProps> = () => {
+const GeneralSection: React.FC<PreferencesSectionProps> = ({
+ editorDefaultsSlot,
+ hideUpdateSection = false,
+ ...props
+}) => {
const { t } = useTranslation();
const install = useDesktopInstall();
const [updateModeInfo, setUpdateModeInfo] = useState<UpdateModeInfo | null>(
@@ -96,9 +92,16 @@ const GeneralSection: React.FC<GeneralSectionProps> = () => {
</Alert>
)}
<PreferencesSection
- editorDefaultsSlot={<DefaultAppSettings />}
+ {...props}
+ editorDefaultsSlot={
+ <>
+ {editorDefaultsSlot}
+ <DefaultAppSettings />
+ </>
+ }
// Mounting the card starts its summary request, so policy must be known first.
hideUpdateSection={
+ hideUpdateSection ||
!updateModeInfo ||
(updateModeInfo.mode === "disabled" && updateModeInfo.locked)
}
diff --git a/frontend/editor/src/desktop/data/settingsSectionRegistry.ts b/frontend/editor/src/desktop/data/settingsSectionRegistry.ts
index 44dca8234f..9d33b18fe5 100644
--- a/frontend/editor/src/desktop/data/settingsSectionRegistry.ts
+++ b/frontend/editor/src/desktop/data/settingsSectionRegistry.ts
@@ -1,36 +1,24 @@
-import { type SettingsSectionEntry } from "@core/data/settingsSectionRegistry";
+import {
+ SETTINGS_SECTION_REGISTRY as CORE_SETTINGS_SECTION_REGISTRY,
+ type SettingsSectionEntry,
+} from "@core/data/settingsSectionRegistry";
export type { SettingsSectionEntry };
/**
- * Desktop settings sections. The desktop modal reflows heavily by connection
+ * Desktop settings sections. The desktop nav reflows heavily by connection
* mode (`configNavSections`): local mode shows only Preferences + Connection
- * Mode + Legal, while SaaS mode swaps in the cloud Plan/Team sections and hides
+ * Mode + About, while SaaS mode swaps in the cloud Plan/Team sections and hides
* the self-hosted admin area. To stay safe across both modes without threading
* the (async) connection state into the always-mounted search, this lists only
* the sections guaranteed to render in every desktop mode.
*
* Cloud Plan/Team search on desktop-SaaS is a deliberate Tier-0 gap, not a
- * regression — better to omit them than to deep-link to a dead tab in local
+ * regression: better to omit them than to deep-link to a dead tab in local
* mode.
*/
export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
- {
- key: "general",
- labelKey: "settings.general.title",
- labelFallback: "General",
- keywords: ["theme", "language", "appearance", "preferences", "startup"],
- groupLabelKey: "settings.preferences.title",
- groupLabelFallback: "Preferences",
- },
- {
- key: "hotkeys",
- labelKey: "settings.hotkeys.title",
- labelFallback: "Keyboard Shortcuts",
- keywords: ["hotkey", "shortcut", "keybinding", "keyboard"],
- groupLabelKey: "settings.preferences.title",
- groupLabelFallback: "Preferences",
- },
+ ...CORE_SETTINGS_SECTION_REGISTRY,
{
key: "connectionMode",
labelKey: "settings.connection.title",
@@ -39,12 +27,4 @@ export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
groupLabelKey: "settings.connection.title",
groupLabelFallback: "Connection Mode",
},
- {
- key: "legal",
- labelKey: "settings.legal.label",
- labelFallback: "Legal",
- keywords: ["legal", "terms", "privacy", "licenses"],
- groupLabelKey: "settings.about.title",
- groupLabelFallback: "About",
- },
];
diff --git a/frontend/editor/src/portal-saas/hooks/useOpenPlan.ts b/frontend/editor/src/portal-saas/hooks/useOpenPlan.ts
index ce12e843b3..2c7605e4de 100644
--- a/frontend/editor/src/portal-saas/hooks/useOpenPlan.ts
+++ b/frontend/editor/src/portal-saas/hooks/useOpenPlan.ts
@@ -2,7 +2,7 @@ import { useCallback } from "react";
import { useUI } from "@portal/contexts/UIContext";
/**
- * SaaS processor: the settings modal it hosts carries the same Plan section the
+ * SaaS processor: the settings page it hosts carries the same Plan section the
* editor opens, so the footer's credits row lands both apps in one place.
*/
export function useOpenPlan(): (() => void) | null {
diff --git a/frontend/editor/src/portal/components/settings/accountLinkSettings.tsx b/frontend/editor/src/portal/components/settings/accountLinkSettings.tsx
index 21fcbf08af..ee527860ab 100644
--- a/frontend/editor/src/portal/components/settings/accountLinkSettings.tsx
+++ b/frontend/editor/src/portal/components/settings/accountLinkSettings.tsx
@@ -3,7 +3,7 @@ import type { ComponentType } from "react";
import { AccountLinkPanel } from "@portal/components/account-link/AccountLinkPanel";
export interface AccountLinkSettingsSeam {
- /** Nav key in the shared settings modal (registered in config/types.ts). */
+ /** Nav key in the shared settings page (registered in config/types.ts). */
navKey: "account-link";
/** i18n key for the nav label; resolved with `t()` at the call site. */
labelKey: string;
@@ -14,7 +14,7 @@ export interface AccountLinkSettingsSeam {
}
/**
- * The admin "Account link" section of the shared settings modal (self-hosted
+ * The admin "Account link" section of the shared settings page (self-hosted
* only). The SaaS build shadows this file with `null`: the signed-in account IS
* the SaaS account, so there is no instance to link — the nav item and its
* panel both drop out, and nothing imports the link-only AccountLinkPanel.
diff --git a/frontend/editor/src/portal/components/users/UsersDirectory.test.tsx b/frontend/editor/src/portal/components/users/UsersDirectory.test.tsx
index e47e18c7ff..83b74e293f 100644
--- a/frontend/editor/src/portal/components/users/UsersDirectory.test.tsx
+++ b/frontend/editor/src/portal/components/users/UsersDirectory.test.tsx
@@ -158,14 +158,23 @@ describe("UsersDirectory — team strip", () => {
expect(
screen.queryByRole("columnheader", { name: "Status" }),
).not.toBeInTheDocument();
+ expect(
+ screen.queryByRole("columnheader", { name: "Last active" }),
+ ).not.toBeInTheDocument();
+ expect(
+ screen.queryByRole("button", { name: /^All/ }),
+ ).not.toBeInTheDocument();
});
it("shows identity and status columns when they carry information", () => {
renderDirectory(selfHostedCaps, TEAMS, [
- { ...MEMBER, status: "suspended" },
+ { ...MEMBER, status: "suspended", lastActive: "2 hours ago" },
]);
expect(screen.getByRole("columnheader", { name: "Email" })).toBeVisible();
expect(screen.getByRole("columnheader", { name: "Status" })).toBeVisible();
+ expect(
+ screen.getByRole("columnheader", { name: "Last active" }),
+ ).toBeVisible();
});
it("narrows the flat roster to the selected team", () => {
@@ -340,22 +349,18 @@ describe("read-only role visibility", () => {
[owner, viewer],
transfer,
);
- expect(screen.getByRole("textbox", { name: "Role for Alex" })).toHaveValue(
- "Org Owner",
- );
+ expect(screen.getByRole("cell", { name: "Org Owner" })).toBeVisible();
+ expect(screen.getByRole("cell", { name: "Member" })).toBeVisible();
expect(
- screen.getByRole("textbox", { name: "Role for Alex" }),
- ).toHaveAttribute("readonly");
- expect(screen.getByRole("textbox", { name: "Role for Priya" })).toHaveValue(
- "Member",
- );
+ screen.queryByRole("textbox", { name: /Role for/ }),
+ ).not.toBeInTheDocument();
expect(transfer).not.toHaveBeenCalled();
});
});
it("keeps self-hosted Admin and Team Lead labels readable without editing rights", () => {
const members = [
- { ...MEMBER, id: "1", name: "Admin", role: "admin" as const },
+ { ...MEMBER, id: "1", name: "Administrator", role: "admin" as const },
{ ...MEMBER, name: "Lead", role: "team_owner" as const, teamLead: true },
];
renderDirectory(
@@ -363,10 +368,9 @@ it("keeps self-hosted Admin and Team Lead labels readable without editing rights
TEAMS,
members,
);
- expect(screen.getByRole("textbox", { name: "Role for Admin" })).toHaveValue(
- "Admin",
- );
- expect(screen.getByRole("textbox", { name: "Role for Lead" })).toHaveValue(
- "Team Lead",
- );
+ expect(screen.getByRole("cell", { name: "Admin" })).toBeVisible();
+ expect(screen.getByRole("cell", { name: "Team Lead" })).toBeVisible();
+ expect(
+ screen.queryByRole("textbox", { name: /Role for/ }),
+ ).not.toBeInTheDocument();
});
diff --git a/frontend/editor/src/portal/components/users/UsersDirectory.tsx b/frontend/editor/src/portal/components/users/UsersDirectory.tsx
index 222fac7247..eb4335525e 100644
--- a/frontend/editor/src/portal/components/users/UsersDirectory.tsx
+++ b/frontend/editor/src/portal/components/users/UsersDirectory.tsx
@@ -140,6 +140,9 @@ export function UsersDirectory({
})),
];
const orphans = counts.get(UNASSIGNED) ?? 0;
+ if (teams.length === 1 && orphans === 0) {
+ tabs.shift();
+ }
if (orphans > 0) {
tabs.push({
key: UNASSIGNED,
@@ -150,12 +153,16 @@ export function UsersDirectory({
return tabs;
}, [members, teams, tabOf, t]);
+ const activeTeamTab = teamTabs.some((tab) => tab.key === teamTab)
+ ? teamTab
+ : teamTabs[0].key;
+
const teamScoped = useMemo(
() =>
- teamTab === ALL_TEAMS
+ activeTeamTab === ALL_TEAMS
? members
- : members.filter((m) => tabOf(m) === teamTab),
- [members, teamTab, tabOf],
+ : members.filter((m) => tabOf(m) === activeTeamTab),
+ [members, activeTeamTab, tabOf],
);
// Search is the only filter beside the team strip: a roster is looked up by
@@ -185,6 +192,15 @@ export function UsersDirectory({
() => members.some((m) => m.status === "suspended" || m.locked),
[members],
);
+ const showLastActive = useMemo(
+ () =>
+ members.some(
+ (m) =>
+ m.lastActive !== t("users.activity.never", "Never") &&
+ /[^\s—–-]/.test(m.lastActive),
+ ),
+ [members, t],
+ );
const columns = useMemo<DataTableColumn<Member>[]>(() => {
const isOwner = (m: Member) =>
@@ -362,56 +378,77 @@ export function UsersDirectory({
return out;
},
}),
- column.muted({
- key: "lastActive",
- header: t("users.lastActive", "Last active"),
- get: (m) => m.lastActive,
- }),
);
+ if (showLastActive) {
+ cols.push(
+ column.muted({
+ key: "lastActive",
+ header: t("users.lastActive", "Last active"),
+ get: (m) => m.lastActive,
+ }),
+ );
+ }
- cols.push(
- column.select({
- key: "role",
- header: t("users.columns.role", "Role"),
- get: (m) => ({
- value: isOwner(m) ? "org_owner" : m.role,
- options: [
- ...(isOwner(m) || canTransferTo(m)
- ? [
- {
- value: "org_owner",
- label: t("users.role.orgOwner", "Org Owner"),
- },
- ]
- : []),
- ...(capabilities.adminRole
- ? roleOptions
- : [
- {
- value: "member",
- label: t("users.role.member", "Member"),
- },
- ]),
- ],
- ariaLabel: t("users.roleFor", "Role for {{name}}", {
- name: m.name,
+ if (!capabilities.changeRole && !capabilities.transferOwnership) {
+ const labels: Record<RoleId, string> = {
+ admin: t("users.role.admin", "Admin"),
+ team_owner: t("users.role.teamOwner", "Team Lead"),
+ member: t("users.role.member", "Member"),
+ guest: t("users.role.guest", "Guest"),
+ };
+ cols.push(
+ column.text({
+ key: "role",
+ header: t("users.columns.role", "Role"),
+ get: (m) =>
+ isOwner(m) ? t("users.role.orgOwner", "Org Owner") : labels[m.role],
+ }),
+ );
+ } else {
+ cols.push(
+ column.select({
+ key: "role",
+ header: t("users.columns.role", "Role"),
+ get: (m) => ({
+ value: isOwner(m) ? "org_owner" : m.role,
+ options: [
+ ...(isOwner(m) || canTransferTo(m)
+ ? [
+ {
+ value: "org_owner",
+ label: t("users.role.orgOwner", "Org Owner"),
+ },
+ ]
+ : []),
+ ...(capabilities.adminRole
+ ? roleOptions
+ : [
+ {
+ value: "member",
+ label: t("users.role.member", "Member"),
+ },
+ ]),
+ ],
+ ariaLabel: t("users.roleFor", "Role for {{name}}", {
+ name: m.name,
+ }),
+ readOnly:
+ m.isSelf ||
+ isOwner(m) ||
+ (!capabilities.changeRole && !canTransferTo(m)),
}),
- readOnly:
- m.isSelf ||
- isOwner(m) ||
- (!capabilities.changeRole && !canTransferTo(m)),
+ onChange: (m, value) => {
+ // Ownership uses its atomic transfer endpoint, never the ordinary role mutation.
+ if (value === "org_owner") {
+ if (canTransferTo(m)) onTransferOwnership?.(m);
+ return;
+ }
+ if (capabilities.changeRole)
+ onChangeRole(m, (value ?? m.role) as RoleId);
+ },
}),
- onChange: (m, value) => {
- // Ownership uses its atomic transfer endpoint, never the ordinary role mutation.
- if (value === "org_owner") {
- if (canTransferTo(m)) onTransferOwnership?.(m);
- return;
- }
- if (capabilities.changeRole)
- onChangeRole(m, (value ?? m.role) as RoleId);
- },
- }),
- );
+ );
+ }
// A reader gets no kebab at all rather than an empty menu.
cols.push(
@@ -433,6 +470,7 @@ export function UsersDirectory({
showApprover,
showEmail,
showStatus,
+ showLastActive,
teamNameById,
onChangeRole,
onGrantProcessor,
@@ -448,8 +486,8 @@ export function UsersDirectory({
// Null on "All" and "No team", which are not teams to act on.
const selectedTeam = useMemo<Team | null>(
- () => teams.find((tm) => String(tm.id) === teamTab) ?? null,
- [teams, teamTab],
+ () => teams.find((tm) => String(tm.id) === activeTeamTab) ?? null,
+ [teams, activeTeamTab],
);
const teamActions = useMemo<CellAction[]>(() => {
@@ -531,7 +569,7 @@ export function UsersDirectory({
<div className="portal-users__filters">
<Tabs
items={teamTabs}
- activeKey={teamTab}
+ activeKey={activeTeamTab}
onChange={setTeamTab}
ariaLabel={t("users.tabs.label", "Filter by team")}
className="portal-users__teams"
diff --git a/frontend/editor/src/portal/views/Users.saas.test.tsx b/frontend/editor/src/portal/views/Users.saas.test.tsx
index de491dedde..3e19d6713d 100644
--- a/frontend/editor/src/portal/views/Users.saas.test.tsx
+++ b/frontend/editor/src/portal/views/Users.saas.test.tsx
@@ -294,13 +294,16 @@ describe("SaaS ownership through the current Users page", () => {
await waitFor(
() =>
expect(
- screen.getByRole("textbox", { name: "Role for Blair" }),
- ).toHaveValue("Org Owner"),
+ within(screen.getByRole("row", { name: /Blair/ })).getByRole("cell", {
+ name: "Org Owner",
+ }),
+ ).toBeVisible(),
REFETCH_WAIT,
);
expect(owner()).toBe(2);
- expect(screen.getByRole("textbox", { name: "Role for Alex" })).toHaveValue(
- "Member",
+ expect(screen.getByRole("cell", { name: "Member" })).toBeVisible();
+ expect(screen.queryAllByRole("textbox", { name: /Role for/ })).toHaveLength(
+ 0,
);
expect(
screen.queryByRole("button", { name: "Invite people" }),
diff --git a/frontend/editor/src/proprietary/components/settings/useSettingsNav.test.tsx b/frontend/editor/src/proprietary/components/settings/useSettingsNav.test.tsx
index d84598a87a..9b9cb317c8 100644
--- a/frontend/editor/src/proprietary/components/settings/useSettingsNav.test.tsx
+++ b/frontend/editor/src/proprietary/components/settings/useSettingsNav.test.tsx
@@ -2,17 +2,21 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import { renderHook } from "@testing-library/react";
const state = vi.hoisted(() => ({
+ admin: true,
+ login: true,
owner: true,
loading: false,
portal: true,
roster: true,
}));
vi.mock("@app/contexts/AppConfigContext", () => ({
- useAppConfig: () => ({ config: { isAdmin: true } }),
+ useAppConfig: () => ({
+ config: { isAdmin: state.admin, enableLogin: state.login },
+ }),
}));
vi.mock("@app/auth/context", () => ({
useAuth: () => ({
- isAdmin: true,
+ isAdmin: state.admin,
user: { orgOwner: state.owner },
loading: state.loading,
}),
@@ -51,6 +55,8 @@ import { useSettingsNav } from "@app/components/settings/useSettingsNav";
describe("self-hosted owner settings", () => {
beforeEach(() => {
+ state.admin = true;
+ state.login = true;
state.owner = true;
state.loading = false;
state.portal = true;
@@ -123,7 +129,36 @@ describe("self-hosted owner settings", () => {
expect(
result.current.sections
.flatMap((section) => section.items)
- .some((item) => ["billing", "adminPlan", "plan"].includes(item.key)),
+ .some((item) =>
+ ["users", "billing", "adminPlan", "plan"].includes(item.key),
+ ),
).toBe(false);
});
+ it.each([false, true])(
+ "hides the roster for non-admins with processor access=%s",
+ (portal) => {
+ state.admin = false;
+ state.owner = false;
+ state.portal = portal;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ const keys = result.current.sections.flatMap((section) =>
+ section.items.map((item) => item.key),
+ );
+ expect(keys).not.toContain("users");
+ expect(result.current.aliases?.people).toBeUndefined();
+ expect(result.current.aliases?.teams).toBeUndefined();
+ expect(keys).not.toContain("billing");
+ expect(keys).not.toContain("storage");
+ },
+ );
+
+ it("does not advertise the roster when login is disabled", () => {
+ state.login = false;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ expect(
+ result.current.sections.flatMap((section) =>
+ section.items.map((item) => item.key),
+ ),
+ ).not.toContain("users");
+ });
});
diff --git a/frontend/editor/src/proprietary/components/settings/useSettingsNav.tsx b/frontend/editor/src/proprietary/components/settings/useSettingsNav.tsx
index 609df47b16..67f4c11579 100644
--- a/frontend/editor/src/proprietary/components/settings/useSettingsNav.tsx
+++ b/frontend/editor/src/proprietary/components/settings/useSettingsNav.tsx
@@ -32,10 +32,7 @@ export function useSettingsNav(onLeave: () => void): SettingsNav {
usePortalAccessState();
const { isAdmin, user, loading } = useAuth();
const isOwner = isAdmin && !loading && user?.orgOwner === true;
- // Answers to the same admin flag the rest of the nav is built from, not the
- // session's - the two disagree while /me is still in flight.
const { config } = useAppConfig();
- const navAdmin = config?.isAdmin ?? false;
const rosterAvailable = useRosterAvailable();
const portalSections = useMemo(
@@ -43,13 +40,25 @@ export function useSettingsNav(onLeave: () => void): SettingsNav {
buildPortalSettingsSections(t, {
// The roster is this build's only one, so it does not wait on processor
// access the way the processor's own surfaces do.
- includeRoster: rosterAvailable && (navAdmin || portalAccess),
+ includeRoster:
+ rosterAvailable &&
+ config?.enableLogin === true &&
+ isAdmin &&
+ !loading,
includeApiKeys: portalAccess,
includeEncryption: portalAccess && isAdmin,
includeBilling: portalAccess && isOwner,
includeAccountLink: portalAccess && isOwner,
}),
- [portalAccess, isAdmin, isOwner, navAdmin, rosterAvailable, t],
+ [
+ portalAccess,
+ isAdmin,
+ isOwner,
+ loading,
+ config?.enableLogin,
+ rosterAvailable,
+ t,
+ ],
);
const sections = useMemo(
@@ -63,6 +72,14 @@ export function useSettingsNav(onLeave: () => void): SettingsNav {
);
const portalAliases = { ...PORTAL_SECTION_ALIASES };
+ if (
+ !portalSections.some((group) =>
+ group.items.some((item) => item.key === "users"),
+ )
+ ) {
+ delete portalAliases.people;
+ delete portalAliases.teams;
+ }
if (
!portalSections.some((group) =>
group.items.some((item) => item.key === "billing"),
diff --git a/frontend/editor/src/proprietary/components/shared/config/configNavSections.tsx b/frontend/editor/src/proprietary/components/shared/config/configNavSections.tsx
index fc2a5e0f02..7079e05dde 100644
--- a/frontend/editor/src/proprietary/components/shared/config/configNavSections.tsx
+++ b/frontend/editor/src/proprietary/components/shared/config/configNavSections.tsx
@@ -3,10 +3,10 @@ import React from "react";
import { useTranslation } from "react-i18next";
import {
useConfigNavSections as useCoreConfigNavSections,
+ extendPreferences,
ConfigNavSection,
} from "@core/components/shared/config/configNavSections";
import { LoadingFallback } from "@app/components/shared/LoadingFallback";
-import PreferencesSection from "@core/components/shared/config/configSections/preferences/PreferencesSection";
// Lazy, and rendered inside one Suspense below: these five pages are the bulk of
// the settings tree, and pulling them all eagerly starved the i18n fetch on a
@@ -68,23 +68,14 @@ export const useConfigNavSections = (
showSettingsWhenNoLogin,
);
const about = coreSections.filter((s) => s.id === "about");
- const sections = coreSections.filter((s) => s.id !== "about");
+ // Core owns the page; the flavor supplies what core has no concept of.
+ const sections = extendPreferences(
+ coreSections.filter((s) => s.id !== "about"),
+ loginEnabled ? { accountSlot: <AccountCards /> } : {},
+ );
const preferences = sections.find((s) => s.id === "preferences");
if (preferences) {
- // Core owns the page; the flavor supplies what core has no concept of.
- preferences.items = preferences.items.map((item) =>
- item.key === "general"
- ? {
- ...item,
- component: (
- <PreferencesSection
- accountSlot={loginEnabled ? <AccountCards /> : undefined}
- />
- ),
- }
- : item,
- );
// Keys belong to you, not to the server, so they sit with your own
// settings rather than alone under a heading of their own.
if (loginEnabled) {
diff --git a/frontend/editor/src/proprietary/data/settingsSectionRegistry.test.ts b/frontend/editor/src/proprietary/data/settingsSectionRegistry.test.ts
new file mode 100644
index 0000000000..48d2df4222
--- /dev/null
+++ b/frontend/editor/src/proprietary/data/settingsSectionRegistry.test.ts
@@ -0,0 +1,65 @@
+import React from "react";
+import i18n from "i18next";
+import { describe, expect, it, vi } from "vitest";
+
+vi.mock("@app/contexts/ViewerContext", () => ({
+ ViewerContext: React.createContext(null),
+}));
+vi.mock("@app/services/fileStorage", () => ({ fileStorage: {} }));
+vi.mock("@app/data/processorEntitySearch", () => ({
+ useProcessorEntityGroups: vi.fn(),
+}));
+vi.mock("@app/data/settingsContentSearch", () => ({
+ findSettingsContentMatch: () => null,
+ buildMatchSnippet: vi.fn(),
+}));
+
+import { rankSettingsResults } from "@app/hooks/useSuperSearch";
+
+describe("self-hosted Users settings search", () => {
+ it.each([false, true])(
+ "hides Users with login disabled and admin status = %s, even with the admin preview enabled",
+ (isAdmin) => {
+ const results = rankSettingsResults(
+ "users",
+ i18n.t,
+ { isAdmin, loginEnabled: false, showSettingsWhenNoLogin: true },
+ vi.fn(),
+ );
+
+ expect(results.map((result) => result.key)).not.toContain(
+ "setting-section:users",
+ );
+ },
+ );
+
+ it("keeps Users available to logged-in admins and opens the Users section", () => {
+ const openSettings = vi.fn();
+ const results = rankSettingsResults(
+ "users",
+ i18n.t,
+ { isAdmin: true, loginEnabled: true },
+ openSettings,
+ );
+ const users = results.find(
+ (result) => result.key === "setting-section:users",
+ );
+
+ expect(users).toBeDefined();
+ void users?.onSelect();
+ expect(openSettings).toHaveBeenCalledWith("users");
+ });
+
+ it("hides Users from logged-in non-admins with Processor access", () => {
+ const results = rankSettingsResults(
+ "users",
+ i18n.t,
+ { isAdmin: false, loginEnabled: true, portalAccessible: true },
+ vi.fn(),
+ );
+
+ expect(results.map((result) => result.key)).not.toContain(
+ "setting-section:users",
+ );
+ });
+});
diff --git a/frontend/editor/src/proprietary/data/settingsSectionRegistry.ts b/frontend/editor/src/proprietary/data/settingsSectionRegistry.ts
index 3aa99978b3..5ef5bed371 100644
--- a/frontend/editor/src/proprietary/data/settingsSectionRegistry.ts
+++ b/frontend/editor/src/proprietary/data/settingsSectionRegistry.ts
@@ -10,10 +10,10 @@ export type { SettingsSectionEntry };
* Self-hosted (proprietary) settings sections. Extends the core list with the
* account tab, the developer API keys tab, and the admin area — mirroring the
* sections added by the proprietary nav builder (`configNavSections`). Keep the
- * two in sync: a section here that the modal can't render would deep-link to a
- * dead tab, and a modal section missing here isn't searchable.
+ * two in sync: a section here that the nav can't render would deep-link to a
+ * dead tab, and a nav section missing here isn't searchable.
*
- * Gating flags mirror the builder: `account`/`api-keys` need login; the admin
+ * Gating flags mirror the builder: `account`/`api-keys`/`users` need login; the admin
* sections are surfaced when the user is an admin OR login mode is off.
*/
export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
@@ -37,7 +37,7 @@ export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
groupLabelFallback: "Preferences",
},
// --- Workspace ---
- // One roster in every build, listed unconditionally. Carries the words the
+ // The shared roster needs login and admin access. Carries the words the
// retired People and Teams sections were found by.
{
key: "users",
@@ -57,6 +57,7 @@ export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
"create team",
"processor access",
],
+ requiresLogin: true,
adminArea: true,
groupLabelKey: "settings.workspace.title",
groupLabelFallback: "Workspace",
diff --git a/frontend/editor/src/saas/components/settings/useSettingsNav.test.tsx b/frontend/editor/src/saas/components/settings/useSettingsNav.test.tsx
index 2a74165b0d..c7b4b3452d 100644
--- a/frontend/editor/src/saas/components/settings/useSettingsNav.test.tsx
+++ b/frontend/editor/src/saas/components/settings/useSettingsNav.test.tsx
@@ -21,7 +21,12 @@ vi.mock("@app/components/shared/config/configSections/Overview", () => ({
default: () => null,
}));
vi.mock("@app/components/shared/config/saasConfigNavSections", () => ({
- createSaasConfigNavSections: () => [],
+ createSaasConfigNavSections: () => [
+ {
+ title: "Legal",
+ items: [{ key: "legal", label: "Legal", icon: "gavel", component: null }],
+ },
+ ],
}));
vi.mock("@app/components/settings/portalSettingsNav", () => ({
buildPortalSettingsSections: () => [
@@ -64,6 +69,36 @@ describe("Connected instances settings navigation", () => {
},
);
+ it.each([false, true])(
+ "sends retired Preferences rows to their new home with Processor access = %s",
+ (portalAccess) => {
+ state.portalAccess = portalAccess;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ expect(result.current.aliases?.hotkeys).toBe("general");
+ expect(result.current.aliases?.account).toBe("overview");
+ },
+ );
+
+ it.each([false, true])(
+ "routes retired license links to the Legal page with Processor access = %s",
+ (portalAccess) => {
+ state.portalAccess = portalAccess;
+ const { result } = renderHook(() => useSettingsNav(vi.fn()));
+ const availableKeys = result.current.sections.flatMap((section) =>
+ section.items.map((item) => item.key),
+ );
+
+ for (const retiredKey of [
+ "backendThirdPartyLicenses",
+ "frontendThirdPartyLicenses",
+ ]) {
+ const target = result.current.aliases?.[retiredKey];
+ expect(target).toBe("legal");
+ expect(availableKeys).toContain(target);
+ }
+ },
+ );
+
it.each([
{ owner: false, loading: false },
{ owner: true, loading: true },
diff --git a/frontend/editor/src/saas/components/settings/useSettingsNav.tsx b/frontend/editor/src/saas/components/settings/useSettingsNav.tsx
index 782293b02d..fbbc35834a 100644
--- a/frontend/editor/src/saas/components/settings/useSettingsNav.tsx
+++ b/frontend/editor/src/saas/components/settings/useSettingsNav.tsx
@@ -18,6 +18,8 @@ import {
import { mergeSettingsGroups } from "@app/components/settings/mergeSettingsGroups";
import { useSaaSTeam } from "@app/contexts/SaaSTeamContext";
import { LoadingFallback } from "@app/components/shared/LoadingFallback";
+import { BASE_SECTION_ALIASES } from "@app/data/settingsAliases";
+import type { NavKey } from "@app/components/shared/config/types";
const ConnectedInstancesSection = lazy(
() => import("@app/components/settings/ConnectedInstancesSection"),
@@ -25,6 +27,14 @@ const ConnectedInstancesSection = lazy(
export type { SettingsNav };
+// SaaS accounts live under Overview rather than as cards on Preferences.
+const SAAS_SECTION_ALIASES: Partial<Record<string, NavKey>> = {
+ ...BASE_SECTION_ALIASES,
+ backendThirdPartyLicenses: "legal",
+ frontendThirdPartyLicenses: "legal",
+ account: "overview",
+};
+
/**
* SaaS settings sections. The cloud nav is a plain factory rather than a hook,
* and its Overview tab owns the sign-out action, so this seam also supplies the
@@ -137,7 +147,9 @@ export function useSettingsNav(onLeave: () => void): SettingsNav {
return {
sections,
overlay,
- aliases: portalAccess ? PORTAL_SECTION_ALIASES : undefined,
+ aliases: portalAccess
+ ? { ...SAAS_SECTION_ALIASES, ...PORTAL_SECTION_ALIASES }
+ : SAAS_SECTION_ALIASES,
pending: !accessSettled || teamLoading,
};
}
diff --git a/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.test.tsx b/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.test.tsx
index 5c5f7a2e43..f646232e1d 100644
--- a/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.test.tsx
+++ b/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.test.tsx
@@ -1,7 +1,10 @@
import { describe, it, expect } from "vitest";
+import type { ReactElement } from "react";
import { type TFunction } from "i18next";
-import { allowConsole } from "@app/tests/failOnConsole";
import { createSaasConfigNavSections } from "@app/components/shared/config/saasConfigNavSections";
+import PreferencesSection, {
+ type PreferencesSectionProps,
+} from "@core/components/shared/config/configSections/preferences/PreferencesSection";
// Passthrough i18n stub: return the provided fallback (2nd arg) or the key.
const t = ((key: string, fallback?: string) =>
@@ -29,8 +32,6 @@ describe("saasConfigNavSections", () => {
];
it("never exposes the admin AI settings group or its pages", () => {
- // The shared core nav helper warns it is deprecated; incidental to this test.
- allowConsole.warn(/createConfigNavSections is deprecated/);
const sections = createSaasConfigNavSections(Overview, () => {}, { t });
const keys = itemKeys(sections);
@@ -41,7 +42,6 @@ describe("saasConfigNavSections", () => {
});
it("also hides the AI pages for anonymous users", () => {
- allowConsole.warn(/createConfigNavSections is deprecated/);
const sections = createSaasConfigNavSections(Overview, () => {}, {
t,
isAnonymous: true,
@@ -52,4 +52,37 @@ describe("saasConfigNavSections", () => {
expect(keys).not.toContain(aiKey);
}
});
+
+ it("renders Preferences as the one shared page, shortcuts included", () => {
+ const sections = createSaasConfigNavSections(Overview, () => {}, { t });
+
+ const preferences = sections.filter((s) => s.id === "preferences");
+ expect(preferences).toHaveLength(1);
+ expect(preferences[0].items.map((i) => i.key)).toEqual(["general"]);
+ expect(itemKeys(sections)).not.toContain("hotkeys");
+
+ const page = preferences[0].items[0]
+ .component as ReactElement<PreferencesSectionProps>;
+ expect(page.type).toBe(PreferencesSection);
+ expect(page.props.hideAdminBanner).toBe(true);
+ expect(page.props.hideUpdateSection).toBe(true);
+ });
+
+ it("keeps the SaaS account, developer, billing and help sections", () => {
+ const keys = itemKeys(
+ createSaasConfigNavSections(Overview, () => {}, { t }),
+ );
+ for (const key of [
+ "overview",
+ "security",
+ "users",
+ "api-keys",
+ "mcp",
+ "plan",
+ "help",
+ "legal",
+ ]) {
+ expect(keys).toContain(key);
+ }
+ });
});
diff --git a/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.tsx b/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.tsx
index 02b89d8eb2..439c5253d0 100644
--- a/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.tsx
+++ b/frontend/editor/src/saas/components/shared/config/saasConfigNavSections.tsx
@@ -1,13 +1,10 @@
import React from "react";
import { type TFunction } from "i18next";
import {
- createConfigNavSections as createCoreConfigNavSections,
+ createPreferencesNavSection,
type ConfigNavSection,
} from "@core/components/shared/config/configNavSections";
import type { ConfigNavItem } from "@app/components/shared/config/types";
-import HotkeysSection from "@app/components/shared/config/configSections/HotkeysSection";
-import GeneralSection from "@app/components/shared/config/configSections/GeneralSection";
-import PreferencesSection from "@core/components/shared/config/configSections/preferences/PreferencesSection";
import PasswordSecurity from "@app/components/shared/config/configSections/PasswordSecurity";
import ApiKeys from "@app/components/shared/config/configSections/ApiKeys";
import McpSection from "@app/components/shared/config/configSections/McpSection";
@@ -23,45 +20,10 @@ type OverviewComponent = React.ComponentType<{ onLogoutClick: () => void }>;
interface CreateSaasConfigNavSectionsOptions {
isAnonymous?: boolean;
t: TFunction<"translation", undefined>;
- /** Close the settings modal — the Help tours need it to start the tour. */
+ /** Leaves settings; the Help tours need the page out of the way to run. */
onRequestClose?: () => void;
}
-function ensurePreferencesSection(
- sections: ConfigNavSection[],
- t: TFunction<"translation", undefined>,
-): ConfigNavSection[] {
- const preferencesIndex = sections.findIndex(
- (section) => section.id === "preferences",
- );
-
- if (preferencesIndex === -1) {
- return [
- ...sections,
- {
- id: "preferences",
- title: t("settings.preferences.title", "Preferences"),
- items: [
- {
- key: "general",
- label: t("settings.general.title", "General"),
- icon: "settings",
- component: <GeneralSection />,
- },
- {
- key: "hotkeys",
- label: t("settings.hotkeys.title", "Keyboard Shortcuts"),
- icon: "keyboard",
- component: <HotkeysSection />,
- },
- ],
- },
- ];
- }
-
- return sections;
-}
-
function appendDeveloperSection(
sections: ConfigNavSection[],
t: TFunction<"translation", undefined>,
@@ -227,8 +189,6 @@ export function createSaasConfigNavSections(
onRequestClose = () => {},
}: CreateSaasConfigNavSectionsOptions,
): ConfigNavSection[] {
- const baseSections = createCoreConfigNavSections(t);
-
// Create Account section as the first section with Overview and Passwords & Security
const accountSection: ConfigNavSection = {
title: t("config.account.overview.title", "Account Settings"),
@@ -253,22 +213,15 @@ export function createSaasConfigNavSections(
accountSection.items.push(createCloudTeamNavItem(t));
}
- let sections = [accountSection, ...baseSections];
-
- // Suppress OSS-only sections (update checker, login config banner) not relevant in SaaS
- sections = sections.map((section) => ({
- ...section,
- items: section.items.map((item) =>
- item.key === "general"
- ? {
- ...item,
- component: <PreferencesSection hideUpdateSection hideAdminBanner />,
- }
- : item,
- ),
- }));
-
- sections = ensurePreferencesSection(sections, t);
+ // Login is always on and there is no local binary to update, so the setup
+ // banner and the update card stay off. Account lives in its own group above.
+ let sections = [
+ accountSection,
+ createPreferencesNavSection(t, {
+ hideAdminBanner: true,
+ hideUpdateSection: true,
+ }),
+ ];
sections = appendDeveloperSection(sections, t);
sections = appendMcpSection(sections, t);
diff --git a/frontend/editor/src/saas/data/settingsSectionRegistry.ts b/frontend/editor/src/saas/data/settingsSectionRegistry.ts
index 70103b1e01..03c679500a 100644
--- a/frontend/editor/src/saas/data/settingsSectionRegistry.ts
+++ b/frontend/editor/src/saas/data/settingsSectionRegistry.ts
@@ -3,11 +3,11 @@ import { type SettingsSectionEntry } from "@core/data/settingsSectionRegistry";
export type { SettingsSectionEntry };
/**
- * SaaS web settings sections. The SaaS modal is composed differently from
+ * SaaS web settings sections. The SaaS nav is composed differently from
* self-hosted (see `saasConfigNavSections`): an Account area (Overview,
* Passwords & Security, Team), Preferences, a Developer area (API Keys, MCP),
* cloud Billing (Plan) and Legal. It deliberately does NOT list the self-hosted
- * admin sections, so search never deep-links to a tab the SaaS modal can't show.
+ * admin sections, so search never deep-links to a tab the SaaS nav can't show.
*
* The local backend's login/admin flags don't reflect SaaS auth, so entries
* avoid `requiresLogin`/`adminArea`. Sections the SaaS nav only mounts for a
@@ -32,7 +32,7 @@ export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
groupLabelFallback: "Account Settings",
},
{
- key: "teams",
+ key: "users",
labelKey: "config.team",
labelFallback: "Team",
keywords: ["team", "members", "invite", "seats"],
@@ -44,15 +44,17 @@ export const SETTINGS_SECTION_REGISTRY: SettingsSectionEntry[] = [
key: "general",
labelKey: "settings.general.title",
labelFallback: "General",
- keywords: ["theme", "language", "appearance", "preferences", "startup"],
- groupLabelKey: "settings.preferences.title",
- groupLabelFallback: "Preferences",
- },
- {
- key: "hotkeys",
- labelKey: "settings.hotkeys.title",
- labelFallback: "Keyboard Shortcuts",
- keywords: ["hotkey", "shortcut", "keybinding", "keyboard"],
+ keywords: [
+ "theme",
+ "language",
+ "appearance",
+ "preferences",
+ "startup",
+ "hotkey",
+ "shortcut",
+ "keybinding",
+ "keyboard",
+ ],
groupLabelKey: "settings.preferences.title",
groupLabelFallback: "Preferences",
},