From 0c18bdc8256c2508341683c69874bbfbbec9daa8 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Wed, 18 Nov 2026 23:31:07 +0100 Subject: [PATCH] feat: adapt workspace settings to narrow layouts (#12492) * feat: adapt workspace settings to narrow layouts Co-Authored-By: Claude Opus 5.5 * fix: keep a section mounted across the narrow breakpoint and use the full picker in a session preview Co-Authored-By: Claude Opus 5.5 * feat: list workspace settings sections in the session tab picker Co-Authored-By: Claude Opus 5.5 * fix: highlight aliased settings tabs and keep settings searchable in the picker Co-Authored-By: Claude Opus 5.5 * fix: open the session picker on Pages when workspace settings is not the user's Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .../lib/components/BreadcrumbNavPicker.svelte | 32 +- .../lib/components/DevWorkspaceSetting.svelte | 2 +- .../src/lib/components/DrillPicker.svelte | 20 +- .../components/ErrorOrRecoveryHandler.svelte | 30 +- .../src/lib/components/NavBreadcrumb.svelte | 28 +- .../common/sidebar/SidebarNavigation.svelte | 22 +- frontend/src/lib/components/drillPicker.ts | 6 + .../components/pageHeaderRegistry.svelte.ts | 17 + .../sessions/PreviewRouterPicker.svelte | 127 ++++-- .../settings/WorkspaceUserSettings.svelte | 10 +- .../DataTableSettings.svelte | 9 +- .../workspaceSettingsSections.ts | 225 +++++++++++ .../(root)/(logged)/sessions/+page.svelte | 10 +- .../(logged)/workspace_settings/+page.svelte | 369 +++++++----------- 14 files changed, 604 insertions(+), 303 deletions(-) create mode 100644 frontend/src/lib/components/workspaceSettings/workspaceSettingsSections.ts diff --git a/frontend/src/lib/components/BreadcrumbNavPicker.svelte b/frontend/src/lib/components/BreadcrumbNavPicker.svelte index 48479efd92..9ace6f1457 100644 --- a/frontend/src/lib/components/BreadcrumbNavPicker.svelte +++ b/frontend/src/lib/components/BreadcrumbNavPicker.svelte @@ -5,7 +5,8 @@ uses — the workspace pages, then the folders with their flows, scripts and app row navigates the app there. It lands among the current page's siblings: an item opens in its folder with the item -highlighted, a workspace page inside Pages with that page highlighted. +highlighted, a workspace page inside Pages with that page highlighted, and a pane of a page with +several (a workspace settings section) among that page's panes. -->
- + {#snippet children({ item })} @@ -314,21 +314,25 @@
{#if draft.selected === 'custom'}
-
- +
+ +
+ +
{#if !draft.custom.path}
{/if} diff --git a/frontend/src/lib/components/drillPicker.ts b/frontend/src/lib/components/drillPicker.ts index 71e13742e0..7ef6922599 100644 --- a/frontend/src/lib/components/drillPicker.ts +++ b/frontend/src/lib/components/drillPicker.ts @@ -30,6 +30,9 @@ export type DrillLeaf = { current?: boolean /** When true, leaf is rendered but disabled (greyed + no-op click). */ disabled?: boolean + /** A name in words rather than an identifier (a path, a file, a command), so it is set in + * the UI font instead of monospace. */ + plainLabel?: boolean } /** Branch node — interior entry the user drills into. */ @@ -51,6 +54,9 @@ export type DrillBranch = { * at `Workspace > Flows > f/demo > foo` groups under "Flows" (not * "f/demo"). */ searchGroup?: boolean + /** A name in words rather than an identifier (a path, a file, a command), so it is set in + * the UI font instead of monospace. */ + plainLabel?: boolean } export type DrillNode = DrillBranch | DrillLeaf diff --git a/frontend/src/lib/components/pageHeaderRegistry.svelte.ts b/frontend/src/lib/components/pageHeaderRegistry.svelte.ts index aab0ab63b2..9dca1b5240 100644 --- a/frontend/src/lib/components/pageHeaderRegistry.svelte.ts +++ b/frontend/src/lib/components/pageHeaderRegistry.svelte.ts @@ -2,6 +2,17 @@ import type { Snippet } from 'svelte' import type { WorkspaceItemKind } from './workspacePicker' import type { OpenInSessionSource } from './sessions/OpenInSessionButton.svelte' +/** One pane of a page with several, such as a workspace settings section. */ +export type PageHeaderSubpage = { + label: string + /** Absolute, keeping the query the page needs (an embed's `nomenubar`). */ + href: string + /** Header the pane is listed under. */ + group?: string + current?: boolean + disabled?: boolean +} + /** An item the page is working on: the breadcrumb walks its path and ends with its summary. */ export type PageHeaderItem = { /** Absent for an item the picker does not file under a kind — an agent's detail page. The @@ -28,6 +39,12 @@ export type PageHeaderSection = { /** The page the section belongs to, when the section is one pane of it — a settings page's * active tab. Drawn as a lead segment before `label`. */ parent?: string + /** Makes `parent` a link, for a page whose panes have an index of their own to return to. */ + parentHref?: string + /** The panes of the page `parent` names. The chevron's picker lists them under that page in + * Pages and opens on them; in an embed, where the picker must not lead out of the host's + * workspace, it lists them alone. */ + subpages?: PageHeaderSubpage[] /** Rendered in place of `label` when the name is itself a control, such as an editable title. */ content?: Snippet /** Scopes the segment's picker, when the section maps to a kind of item. */ diff --git a/frontend/src/lib/components/sessions/PreviewRouterPicker.svelte b/frontend/src/lib/components/sessions/PreviewRouterPicker.svelte index 4c5ea2efb2..0c551b74f4 100644 --- a/frontend/src/lib/components/sessions/PreviewRouterPicker.svelte +++ b/frontend/src/lib/components/sessions/PreviewRouterPicker.svelte @@ -51,6 +51,9 @@ section or the flat layout. } from './previewRouter' import { useSessionPermissions } from './sessionPermissions.svelte' import type { AIWorkMode } from '$lib/components/copilot/chat/workMode' + import type { PageHeaderSubpage } from '$lib/components/pageHeaderRegistry.svelte' + import { WORKSPACE_SETTINGS_PATH } from './previewPaths' + import { workspaceSettingsSubpages } from '$lib/components/workspaceSettings/workspaceSettingsSections' type Kind = WorkspaceItemKind type DrillPickerHandle = { @@ -82,6 +85,9 @@ section or the flat layout. /** Where picking a target navigates, for a host whose pick is a navigation; rows then * open in a new tab on middle and ⌘/Ctrl-click. */ targetHref?: (target: PreviewTarget) => string | undefined + /** The panes of the page at `path`, which Pages then lists as a branch of them. Defaults + * to the workspace settings sections, which a host outside that page cannot read from it. */ + subpages?: { path: string; pages: PageHeaderSubpage[] } } let { @@ -95,8 +101,12 @@ section or the flat layout. workspaceId, artifacts, chat, - targetHref + targetHref, + subpages: subpagesProp }: Props = $props() + const subpages = $derived( + subpagesProp ?? { path: WORKSPACE_SETTINGS_PATH, pages: workspaceSettingsSubpages() } + ) const kinds: Kind[] = ['flow', 'script', 'app'] const effectiveWorkspace = $derived(workspaceId ?? $workspaceStore) @@ -248,10 +258,39 @@ section or the flat layout. key: pageKey(p.path), label: p.label, icon: p.icon, + plainLabel: true, data: { type: 'page', href: p.path, label: p.label } } } + const subpageLeaves = $derived[]>( + (subpages?.pages ?? []).map((sp) => ({ + type: 'leaf', + key: pageKey(sp.href), + label: sp.label, + section: sp.group, + current: sp.current || pageKey(sp.href) === initialHighlight, + disabled: sp.disabled, + plainLabel: true, + data: { type: 'page', href: sp.href, label: sp.label } + })) + ) + + function pageNode(p: (typeof PREVIEW_PAGES)[number]): DrillNode { + const leaf = pageLeaf(p) + if (p.path !== subpages?.path || subpageLeaves.length === 0) return leaf + return { + type: 'branch', + key: leaf.key, + label: leaf.label, + icon: leaf.icon, + plainLabel: true, + // Search reads leaves only, so each pane carries its page's name for the page to be + // found by it. + children: subpageLeaves.map((l) => ({ ...l, searchableText: `${l.label} ${p.label}` })) + } + } + // Home is deliberately not navigable from the session preview — it stays in // PREVIEW_PAGES only so a tab already sitting on '/' keeps its label. const pagesBranch = $derived>({ @@ -260,8 +299,9 @@ section or the flat layout. label: 'Pages', icon: Compass, searchGroup: true, + plainLabel: true, children: PREVIEW_PAGES.filter((p) => p.path !== '/' && permissions.pageAllowed(p)).map( - pageLeaf + pageNode ) }) @@ -275,11 +315,13 @@ section or the flat layout. label: 'Artifacts', icon: FileText, searchGroup: true, + plainLabel: true, children: artifacts.map((a) => ({ type: 'leaf' as const, key: artifactKey(a.id), label: a.name, icon: FileText, + plainLabel: true, data: { type: 'artifact', id: a.id, name: a.name } })) } @@ -300,6 +342,7 @@ section or the flat layout. label: 'Data pipelines', icon: NetworkIcon, searchGroup: true, + plainLabel: true, children: pipelinesResource.current.map(({ folder }) => { const path = `/pipeline/${encodeURIComponent(folder)}` return { @@ -336,6 +379,7 @@ section or the flat layout. label: 'AI agents', icon: Bot, searchGroup: true, + plainLabel: true, children: shownAgents.map((a) => ({ type: 'leaf' as const, key: `agent:${a.path}`, @@ -377,12 +421,31 @@ section or the flat layout. // highlight's shape alone: the artifacts branch may not have materialized yet // (artifacts hydrate from IndexedDB after tabs restore), and the drill entries // fill in reactively once it does. + // Not gated on the branch being listed yet: the page permissions that list it can still be + // loading when the picker opens, and the scope is read only then. Once they show the page is + // not this user's (a fork owner on its Members section), the picker reopens on Pages rather + // than inside a branch that is not listed, which would show nothing. + const subpageBranchKey = untrack(() => + subpages && subpageLeaves.some((l) => l.key === initialHighlight) + ? pageKey(subpages.path) + : undefined + ) const computedInitialScope = untrack(() => - initialHighlight && isArtifactKey(initialHighlight) - ? ['artifacts'] - : initialHighlight && isPageKey(initialHighlight) - ? ['pages'] - : legacyScopeToPath(initialScope, kinds, 'flat') + subpageBranchKey + ? ['pages', subpageBranchKey] + : initialHighlight && isArtifactKey(initialHighlight) + ? ['artifacts'] + : initialHighlight && isPageKey(initialHighlight) + ? ['pages'] + : legacyScopeToPath(initialScope, kinds, 'flat') + ) + + const subpagePage = $derived(PREVIEW_PAGES.find((p) => p.path === subpages.path)) + const subpagesDenied = $derived( + !!subpageBranchKey && + permissions.settled && + !!subpagePage && + !permissions.pageAllowed(subpagePage) ) // The flat root has no branch to carry a per-kind loading flag — surface @@ -406,27 +469,29 @@ section or the flat layout. {/if} {/snippet} - pick(leaf.data)} - initialScope={computedInitialScope} - {initialHighlight} - {externalFilter} - {autoFocus} - {flush} - {leafIcon} - {branchIcon} - leafSecondary={(leaf, scope) => - leaf.data.type === 'item' - ? relativizeWorkspacePath(workspaceItemDisplayPath(leaf.data.item), scope) - : undefined} - onScopeChange={(scope) => { - if (scope.length > 0) loader.ensureForScopeSegment(scope[0]) - }} - onFilterChange={loader.onFilterChange} - leafAction={editAction} - leafBadge={stateBadge} - leafHref={targetHref ? (leaf) => targetHref(leaf.data) : undefined} - {rootLoading} -/> +{#key subpagesDenied} + pick(leaf.data)} + initialScope={subpagesDenied ? ['pages'] : computedInitialScope} + {initialHighlight} + {externalFilter} + {autoFocus} + {flush} + {leafIcon} + {branchIcon} + leafSecondary={(leaf, scope) => + leaf.data.type === 'item' + ? relativizeWorkspacePath(workspaceItemDisplayPath(leaf.data.item), scope) + : undefined} + onScopeChange={(scope) => { + if (scope.length > 0) loader.ensureForScopeSegment(scope[0]) + }} + onFilterChange={loader.onFilterChange} + leafAction={editAction} + leafBadge={stateBadge} + leafHref={targetHref ? (leaf) => targetHref(leaf.data) : undefined} + {rootLoading} + /> +{/key} diff --git a/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte b/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte index 8752b788e1..328224128c 100644 --- a/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte +++ b/frontend/src/lib/components/settings/WorkspaceUserSettings.svelte @@ -618,9 +618,11 @@
{#snippet action()} -
- - +
+
+ + +
{#if !isAdminsWorkspaceWithoutEE} {/snippet} {#snippet content()} -
+
Who joins without an invite
diff --git a/frontend/src/lib/components/workspaceSettings/DataTableSettings.svelte b/frontend/src/lib/components/workspaceSettings/DataTableSettings.svelte index c98543b66a..e9318fdf0c 100644 --- a/frontend/src/lib/components/workspaceSettings/DataTableSettings.svelte +++ b/frontend/src/lib/components/workspaceSettings/DataTableSettings.svelte @@ -180,8 +180,7 @@ ) function kindItems(current: string | undefined) { const showInstance = instanceAvailable || current === 'instance' - const showExternal = - externalAvailable || current === 'external_instance' + const showExternal = externalAvailable || current === 'external_instance' const labels = managedInstanceLabels( instanceAvailable || anyInstanceRow, externalAvailable || anyExternalRow @@ -442,7 +441,7 @@
{:else} -
+
{#if dataTable.database.resource_type === 'instance'}
-
+
{#if dataTable.database.resource_type === 'external_instance'} = { + teams: 'slack', + success_handler: 'error_handler', + // The Deployment UI tab was folded into Dev workspace; its links keep working. + deploy_to: 'dev_workspace' +} + +/** The section a `tab` query value opens. */ +export function workspaceSettingsSectionId(tab: string): string { + return SECTION_ALIASES[tab] ?? tab +} + +/** The sections as picker subpages, each a link to `/workspace_settings?tab=`. */ +export function workspaceSettingsSubpages(currentTab?: string): PageHeaderSubpage[] { + return WORKSPACE_SETTINGS_SECTION_GROUPS.flatMap((group) => + group.items + .filter((i) => i.showIf !== false) + .map((i) => ({ + label: i.label, + href: `${WORKSPACE_SETTINGS_PATH}?tab=${i.id}`, + group: group.title, + current: i.id === currentTab + })) + ) +} diff --git a/frontend/src/routes/(root)/(logged)/sessions/+page.svelte b/frontend/src/routes/(root)/(logged)/sessions/+page.svelte index 00056642a1..645760f524 100644 --- a/frontend/src/routes/(root)/(logged)/sessions/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/sessions/+page.svelte @@ -31,6 +31,8 @@ import { cubicOut } from 'svelte/easing' import { useReducedMotion } from '$lib/svelte5Utils.svelte' import Popover from '$lib/components/meltComponents/Popover.svelte' + import { WORKSPACE_SETTINGS_PATH } from '$lib/components/sessions/previewPaths' + import { workspaceSettingsSectionId } from '$lib/components/workspaceSettings/workspaceSettingsSections' import PreviewRouterPicker, { type Scope } from '$lib/components/sessions/PreviewRouterPicker.svelte' @@ -814,11 +816,17 @@ parsedRoute ? leafKeyFor(parsedRoute.kind, parsedRoute.itemPath) : currentPage - ? pageKey(currentPage.path) + ? pageKey(currentPage.path + sectionQuery(displayPath)) : activeArtifact ? artifactKey(activeArtifact.id) : undefined ) + // A workspace settings section is a subpage of its own in the picker, keyed with its `tab`. + function sectionQuery(path: string): string { + if (currentPage?.path !== WORKSPACE_SETTINGS_PATH) return '' + const tab = new URL(path, window.location.origin).searchParams.get('tab') + return tab ? `?tab=${workspaceSettingsSectionId(tab)}` : '' + } let activeTabPickerOpen = $state(false) /** Measured width of the floating action controls, reserved as the tab strip's right * padding so tabs stop before them instead of scrolling underneath. */ diff --git a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte index 777802ca2e..2c03b86f48 100644 --- a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte @@ -29,7 +29,10 @@ import ForkMemberSettings from '$lib/components/settings/ForkMemberSettings.svelte' import SettingsPageHeader from '$lib/components/settings/SettingsPageHeader.svelte' import MemberWorkspaceSettings from '$lib/components/settings/MemberWorkspaceSettings.svelte' - import { WORKSPACE_SHOW_SLACK_CMD, WORKSPACE_SHOW_WEBHOOK_CLI_SYNC } from '$lib/consts' + import { + WORKSPACE_SETTINGS_SECTION_GROUPS, + workspaceSettingsSectionId + } from '$lib/components/workspaceSettings/workspaceSettingsSections' import { OauthService, SlackAgentsService, @@ -58,9 +61,13 @@ import { sendUserToast } from '$lib/toast' import { clone, emptyString, encodeState, hasUnsavedChanges } from '$lib/utils' import { downloadViaClient, shouldDownloadViaClient } from '$lib/utils/downloadFile' - import { ExternalLink, Slack, Target } from 'lucide-svelte' + import { ArrowLeft, ExternalLink, Slack, Target } from 'lucide-svelte' import DropdownV2 from '$lib/components/DropdownV2.svelte' - import { pageHeader } from '$lib/components/pageHeaderRegistry.svelte' + import { + pageHeader, + type PageHeaderSection, + type PageHeaderSubpage + } from '$lib/components/pageHeaderRegistry.svelte' import SidebarNavigation from '$lib/components/common/sidebar/SidebarNavigation.svelte' import PremiumInfo from '$lib/components/settings/PremiumInfo.svelte' @@ -594,19 +601,12 @@ | 'dependencies' | 'rulesets' | 'shared_ui' - // Both 'slack' and 'teams' URLs map to 'slack' tab - if (selectedTab === 'teams') { - return 'slack' - } - // Both 'success_handler' and 'error_handler' URLs map to 'error_handler' tab - if (selectedTab === 'success_handler') { - return 'error_handler' - } - // The Deployment UI tab was folded into Dev workspace; keep its links working. - if (selectedTab === 'deploy_to') { - return 'dev_workspace' - } - return selectedTab || 'users' + return selectedTab + ? (workspaceSettingsSectionId(selectedTab) as Exclude< + typeof selectedTab, + 'teams' | 'success_handler' | 'deploy_to' + >) + : 'users' }) let slack_tabs: 'slack_commands' | 'teams_commands' = $derived( @@ -1547,192 +1547,11 @@ } } - // Navigation groups for sidebar - const adminNavigationGroups = $derived([ - { - items: [ - { - id: 'general', - label: 'General', - aiId: 'workspace-settings-general', - aiDescription: 'General workspace settings' - }, - { - id: 'users', - label: 'Users', - aiId: 'workspace-settings-users', - aiDescription: 'Users workspace settings' - }, - { - id: 'ai', - label: 'Windmill AI', - aiId: 'workspace-settings-ai', - aiDescription: 'Windmill AI workspace settings' - }, - { - id: 'premium', - label: 'Premium plans', - aiId: 'workspace-settings-premium', - aiDescription: 'Premium plans workspace settings', - showIf: isCloudHosted() - } - ] - }, - { - title: 'Git & deployment', - items: [ - { - id: 'git_sync', - label: 'Git sync', - aiId: 'workspace-settings-git-sync', - aiDescription: 'Git sync workspace settings', - isEE: true - }, - { - id: 'dev_workspace', - label: 'Dev workspace', - aiId: 'workspace-settings-dev-workspace', - aiDescription: - 'Pair this workspace with a dev workspace (same code, different environment), and choose which items its deploy UI may promote' - }, - { - id: 'rulesets', - label: 'Rulesets', - aiId: 'workspace-settings-rulesets', - aiDescription: 'Protection Rulesets workspace settings', - isEE: true - } - ] - }, - { - title: 'Integrations', - items: [ - { - id: 'slack', - label: 'Slack / Teams', - aiId: 'workspace-settings-slack', - aiDescription: 'Slack / Teams workspace settings', - showIf: WORKSPACE_SHOW_SLACK_CMD - }, - { - id: 'webhook', - label: 'Webhook', - aiId: 'workspace-settings-webhook', - aiDescription: 'Webhook workspace settings', - showIf: WORKSPACE_SHOW_WEBHOOK_CLI_SYNC && !isCloudHosted() - }, - { - id: 'native_triggers', - label: 'Integration triggers', - aiId: 'workspace-settings-integrations', - aiDescription: 'Workspace integrations for integration triggers' - } - ] - }, - { - title: 'Hooks', - items: [ - { - id: 'error_handler', - label: 'Error / success handler', - aiId: 'workspace-settings-error-handler', - aiDescription: 'Error and success handler workspace settings', - isEE: true - }, - { - id: 'variable_expiration', - label: 'Variable expiration', - aiId: 'workspace-settings-variable-expiration', - aiDescription: - 'Runnable executed when a variable value is about to expire, so the value can be rotated' - }, - { - id: 'critical_alerts', - label: 'Critical alerts', - aiId: 'workspace-settings-critical-alerts', - aiDescription: 'Critical alerts workspace settings', - isEE: true - } - ] - }, - { - title: 'Data & storage', - items: [ - { - id: 'windmill_data_tables', - label: 'Data tables', - aiId: 'workspace-settings-windmill-data-tables', - aiDescription: 'Data tables workspace settings' - }, - { - id: 'windmill_lfs', - label: 'Object storage (S3)', - aiId: 'workspace-settings-windmill-lfs', - aiDescription: 'Object Storage (S3) workspace settings' - }, - { - id: 'volume_storage', - label: 'Volumes', - aiId: 'workspace-settings-volume-storage', - aiDescription: 'Volume storage workspace settings' - }, - { - id: 'ducklake', - label: 'Ducklake', - aiId: 'workspace-settings-ducklake', - aiDescription: 'Ducklake workspace settings' - }, - { - id: 'dbt', - label: 'dbt', - aiId: 'workspace-settings-dbt', - aiDescription: 'dbt warehouses workspace settings' - } - ] - }, - { - title: 'Advanced', - items: [ - { - id: 'default_app', - label: 'Apps', - aiId: 'workspace-settings-apps', - aiDescription: 'Apps workspace settings', - isEE: true - }, - { - id: 'shared_ui', - label: 'Shared UI folder', - aiId: 'workspace-settings-shared-ui', - aiDescription: 'Shared frontend folder usable by raw apps' - }, - { - id: 'dependencies', - label: 'Dependencies', - aiId: 'workspace-settings-dependencies', - aiDescription: 'Workspace dependencies settings' - }, - { - id: 'encryption', - label: 'Encryption', - aiId: 'workspace-settings-encryption', - aiDescription: 'Encryption workspace settings' - }, - { - id: 'trashbin', - label: 'Trashbin', - aiId: 'workspace-settings-trashbin', - aiDescription: 'Trashbin for recently deleted items' - } - ] - } - ]) - // A fork's creator manages its members through the same screen, but nothing else about the // workspace is theirs to change, so they get the Members entry alone. const navigationGroups = $derived( canAdmin - ? adminNavigationGroups + ? WORKSPACE_SETTINGS_SECTION_GROUPS : [ { items: [ @@ -1764,6 +1583,70 @@ params.set('tab', id) return `?${params.toString()}` } + function sectionListHref(): string { + const params = new URLSearchParams($page.url.searchParams) + params.delete('tab') + const query = params.toString() + return query ? `?${query}` : WORKSPACE_SETTINGS_PATH + } + + // Below 768px (Tailwind `md`) the sidebar would leave a phone or a session preview a sliver for + // the settings, so the list and the section become two pages. Measured on the page's own box + // rather than the viewport: the app's sidebar takes its share of a viewport first. + let layoutWidth = $state(window.innerWidth) + type SectionEntry = { id: string; label: string; showIf?: boolean; disabled?: boolean } + const sectionGroups = $derived( + navigationGroups.map((g) => ({ + title: g.title as string | undefined, + items: (g.items as SectionEntry[]).filter((i) => i.showIf !== false) + })) + ) + const visibleSections = $derived(sectionGroups.flatMap((g) => g.items)) + const pagedLayout = $derived(layoutWidth < 768 && !showYaml && visibleSections.length > 1) + // The URL says which page is on screen, so the browser's back button returns to the list and + // a link to a section opens on it. Wide, a missing `tab` still means the default section. + const sectionOpen = $derived($page.url.searchParams.has('tab')) + // The list and the section slide between each other the way `PagedContent` pages do: the + // page arriving travels a quarter of the box and fades in, the page leaving vanishes at once + // so it never ghosts over the one arriving. `side` is where a hidden page waits. + function slidingPage(shown: boolean, side: -1 | 1): string { + const offset = shown ? '' : side < 0 ? '-translate-x-1/4' : 'translate-x-1/4' + return `absolute inset-0 motion-reduce:!transition-none ${offset} ${shown ? '' : 'opacity-0 pointer-events-none'}` + } + function slideTransition(shown: boolean): string { + return `transform 130ms ease-out, opacity ${shown ? '90ms' : '0s'} ease-out` + } + // None for a single section (a fork owner's Members): Workspace settings is admin-only, so the + // picker has no branch to list it under. + const subpages: PageHeaderSubpage[] | undefined = $derived( + visibleSections.length < 2 + ? undefined + : sectionGroups.flatMap((group) => + group.items.map((i) => ({ + label: i.label, + href: WORKSPACE_SETTINGS_PATH + tabHref(i.id), + group: group.title, + current: i.id === tab, + disabled: i.disabled + })) + ) + ) + const headerSection: PageHeaderSection | undefined = $derived( + showYaml + ? { parent: 'Workspace settings', label: 'YAML' } + : pagedLayout + ? sectionOpen && tabLabel + ? { + parent: 'Workspace settings', + parentHref: sectionListHref(), + label: tabLabel, + subpages + } + : undefined + : tabLabel + ? { parent: 'Workspace settings', label: tabLabel, subpages } + : undefined + ) @@ -1774,37 +1657,77 @@ two controls that sat beside the title are the page's actions. The panes below scroll inside themselves, so the bar keeps its edge at rest rather than only under a scroll. --> -
- - - {#if !showYaml} -
- goto(tabHref(id))} - itemHref={tabHref} - /> +
+ +
+ {#if !showYaml} + +
+ + goto(tabHref(id))} + itemHref={tabHref} + drillIn={pagedLayout} + /> +
+ {/if} +
+ {@render sectionPane()}
- {/if} +
+
- -
-
-
+ {#snippet sectionPane()} +
+ {#if pagedLayout} +
+ +
+ {/if} +
+
{#if !loadedSettings} {:else if showYaml} @@ -2216,7 +2139,7 @@ documentation for more information.

{/if} -
+
-
+ {/snippet} {:else}