From 20fbb53addeb2990ebe4e50aa4a1ac15edac30c8 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 13:00:18 +0000 Subject: [PATCH 1/7] wip(studio): top-left rows, package switcher, rail, title-row fallback --- .../views/studio-design/StudioBackToApp.tsx | 50 +++ .../studio-design/StudioDesignSurface.tsx | 34 +- .../src/views/studio-design/StudioMenu.tsx | 22 +- .../studio-design/StudioPackageSwitcher.tsx | 335 ++++++++++++++++++ .../studio-design/StudioTitleRowFallback.tsx | 41 +++ .../src/views/studio-design/StudioTopLeft.tsx | 110 ++++++ ui/packages/i18n/src/namespaces/studio/en.ts | 8 + ui/packages/i18n/src/namespaces/studio/zh.ts | 8 + 8 files changed, 600 insertions(+), 8 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/StudioPackageSwitcher.tsx create mode 100644 ui/packages/app-shell/src/views/studio-design/StudioTitleRowFallback.tsx create mode 100644 ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx diff --git a/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx b/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx index 1996fe5648a..dab224c4e1a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx @@ -81,6 +81,56 @@ export function studioBackTarget({ return { path: `/apps/${segment}`, appLabel: labelOf(first) }; } +/** + * The way back as one control (objectstack#37456; ADR-0084, amended + * 2026-11-26, `#amendment-2026-11-26-frame`): the first control of the top + * left's package row, and of the collapsed rail. It leads where + * {@link studioBackTarget} says, the same place {@link StudioBackToApp} goes; + * the name beside it is the package switcher's, so the button carries the + * name only in its accessible name and tooltip. + */ +export function StudioBackButton({ + packageId, + apps, + locale, + beforeNavigate, + navigate, + className, +}: { + packageId: string | null; + apps: readonly StudioAppTarget[]; + locale: string; + beforeNavigate: () => boolean; + navigate: (path: string) => void; + className?: string; +}): React.ReactElement { + const [remembered] = React.useState(readAppReturnPage); + const homePath = useHomePath(); + const target = studioBackTarget({ remembered, packageId, apps, locale, landingPath: homePath }); + const title = target.appLabel + ? tFormat('engine.studio.backToAppTitle', locale, { app: target.appLabel }) + : t('engine.studio.backToAppTitleNoApp', locale); + return ( + + ); +} + export function StudioBackToApp({ packageId, packageLabel, diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx index 99c7f9a62eb..b72a7e2c633 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -125,7 +125,7 @@ import { studioOrgScopePath, } from './studioScope.js'; import { STUDIO_METADATA_AREA, isStudioAllPackagesScope, settledAreaAddress } from './metadataArea.js'; -import { StudioMenu, StudioMenuDataProvider, StudioMenuProvider, StudioMenuTrigger } from './StudioMenu.js'; +import { StudioMenu, StudioMenuDataProvider, StudioMenuProvider } from './StudioMenu.js'; import { StudioMetadataArea } from './StudioMetadataArea.js'; import { StudioOwdOverviewPage } from './StudioOwdOverviewPage.js'; import { useMetadataRefreshNonce } from './useMetadataRefreshNonce.js'; @@ -167,7 +167,9 @@ import { type DraftPublishOptions, } from '../../preview/DraftChangesPanel.js'; import { toast } from 'sonner'; -import { STUDIO_OWD_SECTION, studioItemPath, studioMetadataTypePath, studioPillarPath } from './studioAddress.js'; +import { STUDIO_OWD_SECTION, studioItemPath, studioMetadataTypePath, studioPackagePath, studioPillarPath } from './studioAddress.js'; +import { StudioTopLeft } from './StudioTopLeft.js'; +import { StudioTitleRowFallback } from './StudioTitleRowFallback.js'; /** The batch door's `backfillApplied` receipt, by reference to what the client returns (objectui#12929). */ type PublishBackfillReceipt = NonNullable< @@ -1368,7 +1370,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re and Publish stay at the right end; objectstack#37455 — Cancel and Save moved to the page's item header. */}
- {showMenu && } + {/* objectstack#37456 — the menu's show / hide control moved to Studio's row (`StudioTopLeft`). */} {/* objectstack#36501 — 「‹ Back to app」, the app's name and the Studio mark: Studio's one way out. objectstack#36899 (decision 5) — it names the CURRENT package's app; with none, @@ -1529,7 +1531,29 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re {/* objectstack#36899 — the left menu and the page beside it. The menu docks in this row, below the header (a drawer under 768 px). */}
- {showMenu && } + {showMenu && ( + + } + /> + )}
+ {/* objectstack#37456 — the page controls of a page with no title row. */} +
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx index e16b7cc4e34..ed6856710f3 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx @@ -130,6 +130,9 @@ import { type StudioMenuTier, } from './studioMenuModel.js'; +/** What the collapsed rail does not draw: the search and the fold's toggle. */ +const RAIL_HIDDEN = 'group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden'; + /** The fold's cookie lives as long as the menu's own collapse cookie (the sidebar primitive's 7 days). */ const ADVANCED_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; @@ -296,6 +299,11 @@ export interface StudioMenuProps { * `?` included); `false` keeps the author where they are. */ onReenterPillar?: (search: string) => boolean; + /** + * objectstack#37456 — what the column draws above its search: the top + * left's two rows (`StudioTopLeft`), or the rail's head while collapsed. + */ + head?: React.ReactNode; } /** @@ -320,6 +328,7 @@ function StudioMenuBody({ segment, locale, onReenterPillar, + head, data, }: StudioMenuProps & { data: StudioMenuData }): React.ReactElement { const scope = studioMenuScope(segment); @@ -367,7 +376,8 @@ function StudioMenuBody({ const Icon = studioMenuEntryIcon(entry, group); return ( - + {/* objectstack#37456 — on the collapsed rail an entry is its icon, named by its tooltip. */} + - + + {head} @@ -441,6 +454,7 @@ function StudioMenuBody({ id={searchId} type="search" data-testid="studio-menu-search" + className={RAIL_HIDDEN} placeholder={t('engine.studio.menu.search', locale)} value={query} onChange={(e) => setQuery(e.target.value)} @@ -459,7 +473,7 @@ function StudioMenuBody({ {folded && (tiers.advanced.length > 0 || allTypes) && ( <>