From 3451752fb8790ba0f2a5f7a65099d6a6648dccd3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 15:31:14 +0000 Subject: [PATCH 1/5] feat(console): page header on reports and custom pages; the shell's top-right button group, off while the top bar stands Reports, the report index and custom pages draw the console page header lists and dashboards draw. A custom page's name and description move into it (PageTitleHostContext, a host switch in @object-ui/components); an authored page:header stays, its title an h2. The interface page swaps its own row for the header. A phone keeps the face it had, floating pencil included. The top-right group (comments slot, Edit app, AI, help) is one app-shell component placed by the shell: PageHeader after its actions, the record page's navigation row before the close button. Off by default while the top bar stands; localStorage os:shell:page-actions=on turns it on. Edit app reads the top bar pencil's gate and target (useAppStudioEntry); the help menu is one component both share. Card #36111, maintainer ruling 7064921354 (option A). Claude-Session: https://claude.ai/code/session_01L6bhgVcCRGjxwhDjrRVYsY Co-authored-by: Claude --- .changeset/36111-page-header-shell-actions.md | 13 + .../app-showcase/src/ui/pages/my-work.page.ts | 4 +- .../src/ui/pages/project-workspace.page.ts | 3 +- .../app-shell/src/layout/AppHeader.tsx | 147 ++--------- .../app-shell/src/layout/ConsoleLayout.tsx | 6 + ui/packages/app-shell/src/layout/HelpMenu.tsx | 167 ++++++++++++ .../app-shell/src/layout/PageHeader.tsx | 17 +- .../app-shell/src/layout/ShellPageActions.tsx | 179 +++++++++++++ ...pageRouteNoAuthoringHandles-12198.test.tsx | 6 +- .../__tests__/ShellPageActions-36111.test.tsx | 248 ++++++++++++++++++ .../src/views/AppReportIndexView.tsx | 7 +- .../app-shell/src/views/InterfaceListPage.tsx | 52 ++-- ui/packages/app-shell/src/views/PageView.tsx | 54 +++- .../RecordDetailView.topBar-27524.test.tsx | 46 ++++ .../app-shell/src/views/RecordDetailView.tsx | 19 +- .../app-shell/src/views/ReportView.tsx | 45 ++-- .../PageView.consoleHeader-36111.test.tsx | 172 ++++++++++++ ...StudioFollowsPackagePosture-12615.test.tsx | 10 + ....editInStudioNeedsAuthoring-10899.test.tsx | 10 + ...iew.editInStudioOpensStudio-12540.test.tsx | 10 + ui/packages/components/src/index.ts | 4 + .../src/renderers/layout/containers.tsx | 10 +- .../layout/page-title-host-context.ts | 35 +++ .../components/src/renderers/layout/page.tsx | 20 +- 24 files changed, 1094 insertions(+), 190 deletions(-) create mode 100644 .changeset/36111-page-header-shell-actions.md create mode 100644 ui/packages/app-shell/src/layout/HelpMenu.tsx create mode 100644 ui/packages/app-shell/src/layout/ShellPageActions.tsx create mode 100644 ui/packages/app-shell/src/layout/__tests__/ShellPageActions-36111.test.tsx create mode 100644 ui/packages/app-shell/src/views/__tests__/PageView.consoleHeader-36111.test.tsx create mode 100644 ui/packages/components/src/renderers/layout/page-title-host-context.ts diff --git a/.changeset/36111-page-header-shell-actions.md b/.changeset/36111-page-header-shell-actions.md new file mode 100644 index 00000000000..e0200406dba --- /dev/null +++ b/.changeset/36111-page-header-shell-actions.md @@ -0,0 +1,13 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/components': patch +--- + +feat(console): reports and custom pages open with the console page header; the shell's top-right button group is built and placed, off while the top bar stands + +Clause-②: yes (widening) +Metadata-protocol: none + +- **Reports, the report index and custom pages draw the console page header** that lists and dashboards draw: the page's name (and description) on the left, its actions on the right. A report keeps its 「Edit」 (the inspector beside the report) as the header's action. A custom page's name and description move into the header; the page renderer no longer draws them a second time, and a `page:header` the author wrote stays as written, its title one heading level down (`h2`) so the page keeps one `h1`. An interface page swaps its own title row for the header, buttons included. On a phone a custom page keeps the face it had, its floating 「Edit in studio」 pencil included; from the phone breakpoint up the pencil is gone and the top bar's 「Edit app」 opens the same surface. +- **The top-right button group** (`ShellPageActions`, internal to `@object-ui/app-shell`): the comments slot, 「Edit app」 (words beside a non-pencil icon, icon-only below `lg`, the same gate and target as the top bar's pencil; a read-only package gets the eye), the AI assistant and help. The console page header draws it after its actions, the record page in its navigation row before ✕, a custom page in its header. **It is off** while the top bar stands, so nothing changes on screen beyond the headers above; `localStorage['os:shell:page-actions'] = 'on'` turns it on for checking. The help menu is now one component the top bar and the group share. +- `@object-ui/components` exports `PageTitleHostContext`, a host switch (never metadata) that says the host draws the page's title and description: the page renderer then draws neither, and an authored titled `page:header` draws its title as an `h2`. Default `false`: every other host is unchanged. diff --git a/examples/app-showcase/src/ui/pages/my-work.page.ts b/examples/app-showcase/src/ui/pages/my-work.page.ts index bde7a5646f2..2a27660f3c2 100644 --- a/examples/app-showcase/src/ui/pages/my-work.page.ts +++ b/examples/app-showcase/src/ui/pages/my-work.page.ts @@ -22,7 +22,9 @@ export const MyWorkPage = definePage({ name: 'header', width: 'full', components: [ - { type: 'page:header', properties: { title: 'My Work', subtitle: 'Your queue, the team’s throughput, and what needs attention.' } }, + // No `title`: the console's page header names the page from its + // `label` (objectstack#36111), so a title here said 「My Work」 twice. + { type: 'page:header', properties: { subtitle: 'Your queue, the team’s throughput, and what needs attention.' } }, ], }, { diff --git a/examples/app-showcase/src/ui/pages/project-workspace.page.ts b/examples/app-showcase/src/ui/pages/project-workspace.page.ts index 4a8c49f0a28..7a23ef4ba67 100644 --- a/examples/app-showcase/src/ui/pages/project-workspace.page.ts +++ b/examples/app-showcase/src/ui/pages/project-workspace.page.ts @@ -25,7 +25,8 @@ export const ProjectWorkspacePage = definePage({ { type: 'page:header', properties: { - title: 'New Project + Tasks', + // No `title`: the console's page header names the page from its + // `label` (objectstack#36111), so a title here said it twice. subtitle: 'Master-detail entry — fill the project, add its tasks inline, and save them together.', // `icon` removed here (#6946): `page:header` never drew one — retired from the spec. diff --git a/ui/packages/app-shell/src/layout/AppHeader.tsx b/ui/packages/app-shell/src/layout/AppHeader.tsx index efdec501f46..ec17dc2804f 100644 --- a/ui/packages/app-shell/src/layout/AppHeader.tsx +++ b/ui/packages/app-shell/src/layout/AppHeader.tsx @@ -54,20 +54,15 @@ import { } from '@object-ui/components'; import { Search, - HelpCircle, LogOut, Plus, Layers, Bot, User, Building2, - BookOpen, - ExternalLink, - Keyboard, Pencil, Eye, MoreHorizontal, - Info, ChevronLeft, } from 'lucide-react'; import { usePhoneViewport } from '../hooks/usePhoneViewport.js'; @@ -86,7 +81,6 @@ import type { ActivityItem } from './ActivityFeed.js'; import { InboxPopover } from './InboxPopover.js'; import { AppSwitcher } from './AppSwitcher.js'; import type { ConnectionState } from '@object-ui/data-objectstack'; -import { useAdapter } from '../providers/AdapterProvider.js'; import { useObjectTranslation, useObjectLabel } from '@object-ui/i18n'; import { useServedAppLabel } from '../hooks/useServedAppLabel.js'; import type { BreadcrumbItem as BreadcrumbItemType } from '@object-ui/types'; @@ -94,17 +88,14 @@ import { useAuth, getUserInitials } from '@object-ui/auth'; import { useMetadata } from '../providers/MetadataProvider.js'; import { useBundledReads } from '../providers/bundledReads.js'; import { readItemPreferLocal, useReadItemsByName } from '../hooks/useObjectPresence.js'; -import { preferLocal, matchAppBySegment, appStudioRoutePath } from '../utils/index.js'; +import { preferLocal, matchAppBySegment } from '../utils/index.js'; import { appAddressSegment } from '../utils/appRoute.js'; import { connectAssistantPath } from '../console/connect/connectAssistantPath.js'; import { getIcon } from '../utils/getIcon.js'; import { useNavigationContext } from '../context/NavigationContext.js'; import { useCommandPalette, useCommandPaletteProviderMounted } from '../context/CommandPaletteProvider.js'; -import { useUrlOverlay } from '../hooks/useUrlOverlay.js'; import { metadataText, servedObjectPluralLabel } from '../hooks/useNavTargetLabel.js'; -import { KEYBOARD_SHORTCUTS_PARAM } from '../urlParams.js'; import { useAiSurfaceEnabled } from '../hooks/useAiSurface.js'; -import { useStudioEntryGate } from '../hooks/useStudioDesignGate.js'; import { useSharedActivityFeed, type ActivityFeedReading } from '../hooks/sharedUserFeeds.js'; import { useInboxBell } from '../hooks/useInboxBell.js'; import { useHomePath } from '../hooks/useHomePath.js'; @@ -117,8 +108,8 @@ import { getProductName, getLogoUrl } from '../runtime-config.js'; import { LocalizedSidebarTrigger } from './LocalizedSidebarTrigger.js'; import { PreviewBadge } from './PreviewBadge.js'; import { AssistantTopBarButton } from './AssistantTopBarButton.js'; -import { AboutDialog } from './AboutDialog.js'; -import { getConsoleBuild } from '../buildIdentity.js'; +import { HelpMenu } from './HelpMenu.js'; +import { useAppStudioEntry } from './ShellPageActions.js'; import { GO_HOME_SHORTCUT, useAdvertiseShortcut, type ShortcutChord } from '../chrome/advertisedShortcuts.js'; import { confirmUnsavedLeave } from '../chrome/unsavedEdits.js'; @@ -475,12 +466,6 @@ export function AppHeader({ // nothing. The `/studio` landing mounts one with the palette's `studio` scope // (objectui#11863), so its `studio` variant draws the trigger. const hasCommandPalette = useCommandPaletteProviderMounted(); - // Click-reachable entry for the keyboard-shortcuts dialog (was `?`-key only). - // Shares the `?shortcuts=1` URL param with KeyboardShortcutsDialog (C2/C3). - const { openOverlay: openShortcuts } = useUrlOverlay(KEYBOARD_SHORTCUTS_PARAM); - // The help menu's About dialog (objectui#12970): ephemeral, so component - // state, not a URL param — nobody shares a link to it. - const [aboutOpen, setAboutOpen] = useState(false); const { user, signOut, @@ -489,7 +474,6 @@ export function AppHeader({ activeOrganization, isOrganizationsLoading, } = useAuth(); - const dataSource = useAdapter(); // Runtime AI gating: hide the top-bar AI entry point when the server serves // no AI (Community Edition) so it can't dead-end on a chat with no agent. // Same signal as the FAB and the `/ai` route guard. @@ -514,43 +498,6 @@ export function AppHeader({ const readItemsByName = useReadItemsByName(metadata); const { currentAppName, recordTitle } = useNavigationContext(); - /** - * Help menu — lazily-loaded `doc` metadata (ADR-0046) so the "?" menu can - * surface a contextual "This app's docs" entry. Fetched once on first menu - * open (names/labels only — `content` is omitted from the list response); - * `null` = not yet loaded, `[]` = loaded-but-empty. - */ - const [helpDocs, setHelpDocs] = useState | null>(null); - const loadHelpDocs = useCallback(async () => { - if (helpDocs !== null) return; // fetch at most once per mount - try { - const client: any = dataSource?.getClient?.(); - if (!client?.meta?.getItems) { - setHelpDocs([]); - return; - } - const result: any = await client.meta.getItems('doc'); - // `meta.getItems` answers the `{ type, items: [...] }` envelope (or a - // bare array from the ADR-0037 preview path) — the two shapes - // `MetadataProvider`'s `extractItems` accepts. A `value` arm used to - // trail them; measured zero producers emit `value` at THIS seam - // (objectui#6917), so it is gone (AGENTS.md #0.1). - const items: any[] = Array.isArray(result) - ? result - : Array.isArray(result?.items) - ? result.items - : []; - setHelpDocs( - items - .map((it) => ({ name: it?.name, label: it?.label, _packageId: it?._packageId })) - .filter((d) => d.name), - ); - } catch { - // Soft-degrade: docs are an optional feature — a failed fetch just - // means the menu shows the static entries (All docs / Online docs). - setHelpDocs([]); - } - }, [helpDocs, dataSource]); /** * Recent activity for the bell's Activity tab (#4197). @@ -654,13 +601,8 @@ export function AppHeader({ // ADR-0048 (A) — appNameKey may be a package id (route segment); match by it. const currentApp = matchAppBySegment(metadataApps || [], appNameKey); - // Help menu — docs owned by the current app (matched by package id, the - // precise owner link; ADR-0048). Empty when not inside an app, the app - // ships no docs, or the lazy fetch hasn't run yet. + // The help menu's owner link for the app's docs (ADR-0048). const currentAppPackageId = (currentApp as any)?._packageId as string | undefined; - const currentAppDocs = currentAppPackageId - ? (helpDocs ?? []).filter((d) => d._packageId === currentAppPackageId) - : []; // App → Studio reverse bridge (ADR-0080): admins jump from the running app // to its owning package's design surface. Null when there is nothing to open @@ -687,9 +629,9 @@ export function AppHeader({ // switcher draw a browse entry (an eye, 「Open {app} in Studio」) where a // writable package's app gets the pencil. The posture is the gate's, read // once; the console's own apps and an unread list still draw neither. - const studioEntry = useStudioEntryGate( - isApp ? appStudioRoutePath(currentApp, true, { type: routeType, name: pathParts[3] }) : null, - ); + // The derivation is `useAppStudioEntry`'s, the one the page's button group + // reads too (objectstack#36111), so the two open the same place. + const studioEntry = useAppStudioEntry(isApp, activeAppName).entry; // ADR-0146 D5 — the read-only entry's words: 「Open {app} in Studio」, the // app switcher's row text, named for the app the bar is in. const viewInStudioText = t('topbar.openAppInStudio', { @@ -1217,72 +1159,15 @@ export function AppHeader({ objectstack#34608: it opens and closes the drawer in place. */} {aiEnabled && } - {/* Help & Documentation — an aggregated menu rather than a bare - external link: contextual "This app's docs" (only when the - current app ships docs), the in-product docs hub, and the online - docs. The left-sidebar already links the hub, so this entry point - earns its place by being context-aware. */} - { if (open) void loadHelpDocs(); }}> - - - - - {currentAppDocs.length > 0 && currentAppPackageId ? ( - - leaveTo( - currentAppDocs.length === 1 - ? `/apps/${currentAppPackageId}/docs/${currentAppDocs[0].name}` - : `/apps/${currentAppPackageId}/docs`, - ) - } - > - - {t('help.appDocs', { defaultValue: "This app's docs" })} - - ) : null} - leaveTo('/docs')}> - - {t('help.allDocs', { defaultValue: 'All documentation' })} - - {isApp ? ( - - - {t('help.keyboardShortcuts', { defaultValue: 'Keyboard shortcuts' })} - - ) : null} - - - - - {t('help.onlineDocs', { defaultValue: 'Online documentation' })} - - - {/* About — names the console's own build, on every variant - (objectui#12970). */} - setAboutOpen(true)} - > - - {t('help.about', { defaultValue: 'About' })} - - - - + {/* Help & Documentation — the shared 「?」 menu (objectstack#36111: + the page's button group draws the same component). The + left-sidebar already links the hub, so this entry point earns + its place by being context-aware. */} + {/* Group 3: Account (theme + lang moved into avatar dropdown) */} diff --git a/ui/packages/app-shell/src/layout/ConsoleLayout.tsx b/ui/packages/app-shell/src/layout/ConsoleLayout.tsx index b21e2bf15fd..ae3adcc0aaa 100644 --- a/ui/packages/app-shell/src/layout/ConsoleLayout.tsx +++ b/ui/packages/app-shell/src/layout/ConsoleLayout.tsx @@ -28,6 +28,7 @@ import { PhoneAppHomeSlotProvider } from './PhoneAppHome.js'; import { useLastApp } from '../context/LastAppProvider.js'; import { useMetadata } from '../providers/MetadataProvider.js'; import { appAddressSegment } from '../utils/appRoute.js'; +import { ShellPageActionsScope } from './ShellPageActions.js'; import { AppHeader } from './AppHeader.js'; import { useResponsiveSidebar } from '../hooks/useResponsiveSidebar.js'; import { usePhoneNavDrawerHistory } from './usePhoneNavDrawerHistory.js'; @@ -313,6 +314,10 @@ export function ConsoleLayout({ } > + {/* objectstack#36111 — the shell decides whether the pages under it + draw the top-right button group: off while this layout draws the + top bar, which carries the same buttons. */} + {/* ADR-0037: unmistakable watermark while rendering the draft overlay (?preview=draft) — with one-click exit and one-click Publish. */} {/* objectui#12463 — the banners sit in one non-shrinking box, so in @@ -348,6 +353,7 @@ export function ConsoleLayout({ > {children} + {/* objectstack#35882 — the phone's bottom bar, after the page in reading order. */} diff --git a/ui/packages/app-shell/src/layout/HelpMenu.tsx b/ui/packages/app-shell/src/layout/HelpMenu.tsx new file mode 100644 index 00000000000..26caa8d8b31 --- /dev/null +++ b/ui/packages/app-shell/src/layout/HelpMenu.tsx @@ -0,0 +1,167 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * HelpMenu — the console's 「?」 menu, drawn once and placed by two hosts + * (objectstack#36111): the top bar (`AppHeader`) and the page's top-right + * button group (`ShellPageActions`). One component, so the two cannot drift + * while both exist, and the top bar's removal deletes a reference, not a copy. + * + * An aggregated menu rather than a bare external link: + * 1. 「This app's docs」 — only inside an app whose package ships `doc` + * metadata (ADR-0046), read lazily on the first open (names and labels + * only; the list response omits `content`); + * 2. 「All documentation」 — the in-product docs hub; + * 3. 「Keyboard shortcuts」 — inside an app, the dialog the `?` key opens + * (C2/C3: the `?shortcuts=1` URL param); + * 4. 「Online documentation」 — the public docs site; + * 5. 「About」 — the console's own build (objectui#12970). + */ + +import { useCallback, useState } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { + Button, + DropdownMenu, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, +} from '@object-ui/components'; +import { BookOpen, ExternalLink, HelpCircle, Info, Keyboard, Layers } from 'lucide-react'; +import { useObjectTranslation } from '@object-ui/i18n'; +import { useAdapter } from '../providers/AdapterProvider.js'; +import { useUrlOverlay } from '../hooks/useUrlOverlay.js'; +import { KEYBOARD_SHORTCUTS_PARAM } from '../urlParams.js'; +import { confirmUnsavedLeave } from '../chrome/unsavedEdits.js'; +import { AboutDialog } from './AboutDialog.js'; +import { getConsoleBuild } from '../buildIdentity.js'; + +export interface HelpMenuProps { + /** Inside an app: draws 「Keyboard shortcuts」. */ + inApp: boolean; + /** The current app's package id, which owns the app's docs; absent outside an app. */ + appPackageId?: string; + /** The trigger's classes: each host sizes and hides it for its own bar. */ + triggerClassName?: string; + /** The trigger's `data-testid`, for a host that addresses it. */ + triggerTestId?: string; +} + +type HelpDoc = { name: string; label?: string; _packageId?: string }; + +export function HelpMenu({ inApp, appPackageId, triggerClassName, triggerTestId }: HelpMenuProps) { + const { t } = useObjectTranslation(); + const navigate = useNavigate(); + // objectui#13231 — the menu navigates from a button, which no page's link + // guard sees, so a departure asks first while a page holds unsaved edits. + const leaveTo = (to: string) => confirmUnsavedLeave(() => navigate(to)); + const { openOverlay: openShortcuts } = useUrlOverlay(KEYBOARD_SHORTCUTS_PARAM); + // Ephemeral, so component state, not a URL param — nobody shares a link to it. + const [aboutOpen, setAboutOpen] = useState(false); + const dataSource = useAdapter(); + + // `null` = not yet loaded, `[]` = loaded-but-empty. + const [helpDocs, setHelpDocs] = useState(null); + const loadHelpDocs = useCallback(async () => { + if (helpDocs !== null) return; // fetch at most once per mount + try { + const client: any = dataSource?.getClient?.(); + if (!client?.meta?.getItems) { + setHelpDocs([]); + return; + } + const result: any = await client.meta.getItems('doc'); + // `meta.getItems` answers the `{ type, items: [...] }` envelope (or a + // bare array from the ADR-0037 preview path) — the two shapes + // `MetadataProvider`'s `extractItems` accepts. A `value` arm used to + // trail them; measured zero producers emit `value` at THIS seam + // (objectui#6917), so it is gone (AGENTS.md #0.1). + const items: any[] = Array.isArray(result) + ? result + : Array.isArray(result?.items) + ? result.items + : []; + setHelpDocs( + items + .map((it) => ({ name: it?.name, label: it?.label, _packageId: it?._packageId })) + .filter((d) => d.name), + ); + } catch { + // Soft-degrade: docs are an optional feature — a failed fetch just + // means the menu shows the static entries (All docs / Online docs). + setHelpDocs([]); + } + }, [helpDocs, dataSource]); + + // Docs owned by the current app, matched by package id (the precise owner + // link; ADR-0048). Empty outside an app, for an app that ships no docs, or + // before the lazy read has run. + const appDocs = appPackageId ? (helpDocs ?? []).filter((d) => d._packageId === appPackageId) : []; + + return ( + <> + { if (open) void loadHelpDocs(); }}> + + + + + {appDocs.length > 0 && appPackageId ? ( + + leaveTo( + appDocs.length === 1 + ? `/apps/${appPackageId}/docs/${appDocs[0].name}` + : `/apps/${appPackageId}/docs`, + ) + } + > + + {t('help.appDocs', { defaultValue: "This app's docs" })} + + ) : null} + leaveTo('/docs')}> + + {t('help.allDocs', { defaultValue: 'All documentation' })} + + {inApp ? ( + + + {t('help.keyboardShortcuts', { defaultValue: 'Keyboard shortcuts' })} + + ) : null} + + + + + {t('help.onlineDocs', { defaultValue: 'Online documentation' })} + + + {/* About — names the console's own build, on every variant + (objectui#12970). */} + setAboutOpen(true)} + > + + {t('help.about', { defaultValue: 'About' })} + + + + + + ); +} diff --git a/ui/packages/app-shell/src/layout/PageHeader.tsx b/ui/packages/app-shell/src/layout/PageHeader.tsx index f2f0b9b6f6e..b29deddff1b 100644 --- a/ui/packages/app-shell/src/layout/PageHeader.tsx +++ b/ui/packages/app-shell/src/layout/PageHeader.tsx @@ -48,12 +48,18 @@ * draws `foldedActions` whatever the text needs, so a main area narrowed by a * docked panel, a small window or the record drawer gets a short header row: * [icon] Title [kind] [refresh] [primary] [⋯] + * + * The shell's group — where the shell turns it on (objectstack#36111), the + * top-right button group (`ShellPageActions`: comments, Edit app, AI, help) + * ends the action cluster in every posture, behind a hairline: + * [icon] Title [kind] | crumb › subtitle… [actions...] | [group] */ import * as React from 'react'; import { RefreshCw } from 'lucide-react'; import { Button, cn } from '@object-ui/components'; import { useInSetupApp } from '../console/setupApp.js'; +import { ShellPageActions, useShellPageActionsOn } from './ShellPageActions.js'; /** * Props of the app-shell `` React component. @@ -262,7 +268,12 @@ export function PageHeader({ ) : null; - const trailing = (refreshButton || drawnActions) && ( + // objectstack#36111 — the shell's top-right button group, after the page's + // own actions, where the shell turned it on (`ShellPageActions`); a hairline + // sets it apart from them. + const shellActions = useShellPageActionsOn(); + const pageActions = refreshButton || drawnActions; + const trailing = (pageActions || shellActions) && (
{refreshButton} {drawnActions} + {shellActions && pageActions && ( +
); diff --git a/ui/packages/app-shell/src/layout/ShellPageActions.tsx b/ui/packages/app-shell/src/layout/ShellPageActions.tsx new file mode 100644 index 00000000000..60de8d88c7e --- /dev/null +++ b/ui/packages/app-shell/src/layout/ShellPageActions.tsx @@ -0,0 +1,179 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * ShellPageActions — the page's top-right button group (objectstack#36111, + * phase 1 of the top-bar removal, objectstack#36107): from left to right the + * comments slot, 「Edit app」, the AI assistant and help, at the same place on + * every in-app page — a list, a record, a dashboard, a report, a custom page. + * + * The SHELL decides whether it is drawn, not the page: `ConsoleLayout` mounts + * `ShellPageActionsScope`, and each page's header draws `` + * where its top-right is — the console `PageHeader` after the page's own + * actions, the record page's navigation row before its ✕, a custom page's + * authored `page:header` through the host slot `PageHeaderTrailingContext`. + * + * While the top bar still draws the same three buttons the group is OFF, so + * nothing doubles: `SHELL_PAGE_ACTIONS_DEFAULT` is `false`, and the one way to + * turn it on outside a test is the browser switch below. The card that removes + * the top bar turns the default on and deletes the switch. + * + * Outside a scope (Home, the organization pages, Studio, the docs frame, a + * test that mounts a page bare) the group is never drawn, and on a phone + * neither: the phone has its own bar. + * + * The parts are the top bar's own: 「Edit app」 reads the same gate and opens + * the same target as the top bar's pencil (`useAppStudioEntry`), the AI button + * IS `AssistantTopBarButton`, and the help menu IS `HelpMenu`. + */ + +import * as React from 'react'; +import { Link, useLocation, useParams } from 'react-router-dom'; +import { Blocks, Eye } from 'lucide-react'; +import { Button } from '@object-ui/components'; +import { useObjectTranslation } from '@object-ui/i18n'; +import { useMetadata } from '../providers/MetadataProvider.js'; +import { useNavigationContext } from '../context/NavigationContext.js'; +import { matchAppBySegment, appStudioRoutePath } from '../utils/index.js'; +import { useStudioEntryGate, type StudioEntry } from '../hooks/useStudioDesignGate.js'; +import { useServedAppLabel } from '../hooks/useServedAppLabel.js'; +import { useAiSurfaceEnabled } from '../hooks/useAiSurface.js'; +import { usePhoneViewport } from '../hooks/usePhoneViewport.js'; +import { AssistantTopBarButton } from './AssistantTopBarButton.js'; +import { HelpMenu } from './HelpMenu.js'; + +/** Whether the group is drawn while the top bar still stands: off. */ +export const SHELL_PAGE_ACTIONS_DEFAULT = false; + +/** + * The browser switch that turns the group on before the top bar goes: + * `localStorage['os:shell:page-actions'] = 'on'`. For checking the group in a + * running console; every access is guarded, so a blocked storage reads off. + */ +export const SHELL_PAGE_ACTIONS_SWITCH_KEY = 'os:shell:page-actions'; + +/** The shell's answer: the default, unless the browser switch says `on`. */ +export function readShellPageActionsSwitch(): boolean { + try { + if (typeof window === 'undefined') return SHELL_PAGE_ACTIONS_DEFAULT; + return window.localStorage?.getItem(SHELL_PAGE_ACTIONS_SWITCH_KEY) === 'on' || SHELL_PAGE_ACTIONS_DEFAULT; + } catch { + return SHELL_PAGE_ACTIONS_DEFAULT; + } +} + +const ShellPageActionsContext = React.createContext(false); + +/** The shell's decision for the pages under it. `on` absent: the switch's answer. */ +export function ShellPageActionsScope({ on, children }: { on?: boolean; children: React.ReactNode }) { + const [switched] = React.useState(readShellPageActionsSwitch); + return {children}; +} + +/** Whether the group is drawn here: inside a scope that turned it on, and not on a phone. */ +export function useShellPageActionsOn(): boolean { + const on = React.useContext(ShellPageActionsContext); + const phone = usePhoneViewport(); + return on && !phone; +} + +/** + * The app → Studio entry for the current route (ADR-0080): the app the route + * is in, and the gate's answer for the Studio path the route opens — the + * object, view or record route opens the package's Data tab, a dashboard, + * page or report route its design surface (`appStudioRoutePath`). `null` when + * this principal or this package gets no entry (`useStudioEntryGate`). + * + * The top bar's 「Edit app」 pencil and the group's 「Edit app」 both read it, + * so the two cannot open different places. + */ +export function useAppStudioEntry(enabled: boolean, activeAppName?: string): { + currentApp: unknown; + entry: StudioEntry | null; +} { + const location = useLocation(); + const params = useParams(); + const metadata = useMetadata(); + const { currentAppName } = useNavigationContext(); + const pathParts = location.pathname.split('/').filter(Boolean); + const appNameKey = activeAppName || currentAppName || params.appName || pathParts[1]; + // ADR-0048 (A) — the key may be a package id (route segment); match by it. + const currentApp = matchAppBySegment(metadata.apps || [], appNameKey); + const entry = useStudioEntryGate( + enabled ? appStudioRoutePath(currentApp, true, { type: pathParts[2], name: pathParts[3] }) : null, + ); + return { currentApp, entry }; +} + +/** + * 「Edit app」 in the group: its words beside an icon that is not the pencil + * (the record's 「Edit」 carries the pencil), the words dropped below `lg` with + * the tooltip keeping them. A read-only package's app gets the top bar's eye + * and 「Open {app} in Studio」 (ADR-0146 D5) at the same place. + */ +function EditAppButton({ entry, appText }: { entry: StudioEntry; appText: string }) { + const { t } = useObjectTranslation(); + if (entry.posture === 'view') { + const viewText = t('topbar.openAppInStudio', { defaultValue: 'Open {{app}} in Studio', app: appText }); + return ( + + ); + } + const label = t('topbar.editApp', { defaultValue: 'Edit app' }); + return ( + + ); +} + +export interface ShellPageActionsProps { + /** + * The comments entry, first in the group: handed by the list and record + * pages only, nothing until the comments work puts its icon here. + */ + comments?: React.ReactNode; +} + +/** The group, where the shell turned it on; nothing anywhere else. */ +export function ShellPageActions({ comments }: ShellPageActionsProps) { + const on = useShellPageActionsOn(); + if (!on) return null; + return ; +} + +function ShellPageActionsGroup({ comments }: ShellPageActionsProps) { + const { entry, currentApp } = useAppStudioEntry(true); + const { appLabel } = useServedAppLabel(); + const { enabled: aiEnabled } = useAiSurfaceEnabled(); + const appPackageId = (currentApp as { _packageId?: string } | undefined)?._packageId; + return ( +
+ {comments} + {entry && } + {aiEnabled && } + +
+ ); +} diff --git a/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx index e810c614ee5..ec36102478e 100644 --- a/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx @@ -254,7 +254,10 @@ async function studioEntriesOnPageRoute(perms: MePermissionsResponse): Promise @@ -271,6 +274,7 @@ async function studioEntriesOnPageRoute(perms: MePermissionsResponse): Promise ({ + ...(await importOriginal>()), + useWorkspaceAdminStatus: () => ({ isAdmin: true, isResolved: true }), +})); + +vi.mock('@object-ui/i18n', async (importOriginal) => ({ + ...(await importOriginal>()), + useObjectTranslation: () => ({ + t: (k: string, o?: Record) => + String(o?.defaultValue ?? k).replace('{{app}}', String(o?.app ?? '')), + language: 'en', + }), +})); + +const APP = { name: 'cloud_control', label: 'Cloud', _packageId: 'com.objectstack.cloud' }; +vi.mock('../../providers/MetadataProvider', () => ({ + useMetadata: () => ({ apps: [APP], objects: [], pages: [] }), +})); + +import { + ShellPageActions, + ShellPageActionsScope, + SHELL_PAGE_ACTIONS_DEFAULT, + SHELL_PAGE_ACTIONS_SWITCH_KEY, + readShellPageActionsSwitch, +} from '../ShellPageActions'; +import { PageHeader } from '../PageHeader'; +import { appStudioRoutePath } from '../../utils/appRoute'; + +function permissions(systemPermissions: string[]): MePermissionsAuthenticatedResponse { + return { + authenticated: true, + userId: 'u1', + tenantId: 'org_1', + positions: [], + hasAnyQueue: false, + objectsUsingQueues: [], + permissionSets: [], + systemPermissions, + objects: {}, + fields: {}, + }; +} +const AUTHOR = permissions(['manage_metadata', 'studio.access', 'setup.access']); +const MEMBER = permissions([]); + +let writable = true; + +async function mount(node: React.ReactNode, { who = AUTHOR, route = '/apps/cloud_control/page/welcome' } = {}) { + const view = render( + + {node} + , + ); + // The package list's verdict settled, so an absent button is a reading. + await act(() => new Promise((resolve) => setTimeout(resolve, 0))); + await act(() => new Promise((resolve) => setTimeout(resolve, 0))); + return view; +} + +const setWidth = (value: number) => Object.defineProperty(window, 'innerWidth', { configurable: true, value }); + +beforeEach(() => { + writable = true; + setWidth(1280); + window.localStorage.clear(); + vi.stubGlobal( + 'fetch', + vi.fn(async (url: unknown) => ({ + ok: true, + status: 200, + json: async () => + String(url).endsWith('/api/v1/packages') + ? { data: { packages: [{ manifest: { id: 'com.objectstack.cloud', name: 'Cloud' }, writable }] } } + : { data: [] }, + })), + ); +}); + +afterEach(() => { + cleanup(); + setWidth(1024); + window.localStorage.clear(); + vi.unstubAllGlobals(); +}); + +describe('the shell decides whether the group is drawn (objectstack#36111)', () => { + it('off by default while the top bar stands; the browser switch turns it on; a blocked storage reads off', () => { + expect(SHELL_PAGE_ACTIONS_DEFAULT).toBe(false); + expect(readShellPageActionsSwitch()).toBe(false); + window.localStorage.setItem(SHELL_PAGE_ACTIONS_SWITCH_KEY, 'on'); + expect(readShellPageActionsSwitch()).toBe(true); + window.localStorage.setItem(SHELL_PAGE_ACTIONS_SWITCH_KEY, 'yes'); + expect(readShellPageActionsSwitch()).toBe(false); + const spy = vi.spyOn(Storage.prototype, 'getItem').mockImplementation(() => { + throw new Error('blocked'); + }); + expect(readShellPageActionsSwitch()).toBe(false); + spy.mockRestore(); + }); + + it('drawn only inside a scope that turned it on, and not on a phone', async () => { + await mount(); + expect(screen.queryByTestId('shell-page-actions')).not.toBeInTheDocument(); + cleanup(); + + await mount(); + expect(screen.queryByTestId('shell-page-actions')).not.toBeInTheDocument(); + cleanup(); + + window.localStorage.setItem(SHELL_PAGE_ACTIONS_SWITCH_KEY, 'on'); + await mount(); + expect(screen.getByTestId('shell-page-actions')).toBeInTheDocument(); + cleanup(); + + setWidth(375); + await mount(); + expect(screen.queryByTestId('shell-page-actions')).not.toBeInTheDocument(); + }); + + it('in order: the comments slot, Edit app, then help (AI only where the server serves it)', async () => { + await mount( + + } /> + , + ); + const group = screen.getByTestId('shell-page-actions'); + const ids = Array.from(group.children).map((c) => c.getAttribute('data-testid')); + expect(ids).toEqual(['comments-slot', 'shell-page-actions-edit-app', 'shell-page-actions-help']); + }); +}); + +describe('the console page header places the group (objectstack#36111)', () => { + it('after the page\'s own actions, behind a hairline', async () => { + await mount( + + New} /> + , + ); + const cluster = screen.getByTestId('page-header-actions'); + const ids = Array.from(cluster.children).map((c) => c.getAttribute('data-testid')); + expect(ids).toEqual(['own-action', 'page-header-shell-divider', 'shell-page-actions']); + }); + + it('a header with no actions of its own draws the group alone, no hairline', async () => { + await mount( + + + , + ); + const cluster = screen.getByTestId('page-header-actions'); + expect(Array.from(cluster.children).map((c) => c.getAttribute('data-testid'))).toEqual(['shell-page-actions']); + }); + + it('turned off, the header is what it was: no group, no hairline, and no action cluster when it has no actions', async () => { + await mount( + + New} /> + , + ); + expect(screen.queryByTestId('shell-page-actions')).not.toBeInTheDocument(); + expect(screen.queryByTestId('page-header-shell-divider')).not.toBeInTheDocument(); + cleanup(); + await mount( + + + , + ); + expect(screen.queryByTestId('page-header-actions')).not.toBeInTheDocument(); + }); +}); + +describe('「Edit app」 in the group opens what the top bar pencil opens (objectstack#36111)', () => { + const group = ( + + + + ); + + it('on a page route: the page\'s surface in Studio, the pencil\'s own derivation', async () => { + await mount(group); + const link = screen.getByTestId('shell-page-actions-edit-app'); + expect(link.getAttribute('href')).toBe('/studio/com.objectstack.cloud/interfaces?surface=page:welcome'); + expect(link.getAttribute('href')).toBe(appStudioRoutePath(APP, true, { type: 'page', name: 'welcome' })); + }); + + it('on an object route: the package Studio opens for the app, as the pencil does', async () => { + await mount(group, { route: '/apps/cloud_control/crm_lead' }); + expect(screen.getByTestId('shell-page-actions-edit-app').getAttribute('href')).toBe( + appStudioRoutePath(APP, true, { type: 'crm_lead', name: undefined }), + ); + }); + + it('its words beside an icon that is not the pencil, the words dropped below `lg` with the tooltip keeping them', async () => { + await mount(group); + const link = screen.getByTestId('shell-page-actions-edit-app'); + expect(link).toHaveAccessibleName('Edit app'); + expect(link.getAttribute('title')).toBe('Edit app'); + expect(link.querySelector('svg.lucide-blocks')).not.toBeNull(); + expect(link.querySelector('svg.lucide-pencil')).toBeNull(); + const words = within(link).getByText('Edit app'); + expect(words.className).toContain('hidden'); + expect(words.className).toContain('lg:inline'); + }); + + it('a read-only package: the top bar\'s eye and 「Open APP in Studio」, never the edit', async () => { + writable = false; + await mount(group); + expect(screen.queryByTestId('shell-page-actions-edit-app')).not.toBeInTheDocument(); + expect(screen.getByTestId('shell-page-actions-view-app')).toHaveAccessibleName('Open Cloud in Studio'); + }); + + it('a caller without `manage_metadata` gets no Studio entry; help stays', async () => { + await mount(group, { who: MEMBER }); + expect(screen.queryByTestId('shell-page-actions-edit-app')).not.toBeInTheDocument(); + expect(screen.queryByTestId('shell-page-actions-view-app')).not.toBeInTheDocument(); + expect(screen.getByTestId('shell-page-actions-help')).toBeInTheDocument(); + }); +}); diff --git a/ui/packages/app-shell/src/views/AppReportIndexView.tsx b/ui/packages/app-shell/src/views/AppReportIndexView.tsx index be20c1ffa6a..b7d3d91771e 100644 --- a/ui/packages/app-shell/src/views/AppReportIndexView.tsx +++ b/ui/packages/app-shell/src/views/AppReportIndexView.tsx @@ -38,6 +38,7 @@ import { BarChart3, ChevronDown, ChevronRight, Loader2, Search } from 'lucide-re import { Empty, EmptyTitle, EmptyDescription, Input, cn } from '@object-ui/components'; import { useDisplayLocale, useObjectTranslation } from '@object-ui/i18n'; import { useServedAppLabel } from '../hooks/useServedAppLabel.js'; +import { PageHeader } from '../layout/PageHeader.js'; import { useMetadata } from '../providers/MetadataProvider.js'; import { useLauncherApps } from '../hooks/useLauncherApps.js'; import { appAddressSegment } from '../utils/appRoute.js'; @@ -169,9 +170,9 @@ export function AppReportIndexView() { return (
-
-

{title}

-
+ {/* objectstack#36111 — the console page header, as every list and + dashboard draws it; the shell's top-right group sits at its right. */} + } /> {entries.length === 0 ? (
diff --git a/ui/packages/app-shell/src/views/InterfaceListPage.tsx b/ui/packages/app-shell/src/views/InterfaceListPage.tsx index f6b987b4ce0..dd07a81ac75 100644 --- a/ui/packages/app-shell/src/views/InterfaceListPage.tsx +++ b/ui/packages/app-shell/src/views/InterfaceListPage.tsx @@ -30,7 +30,7 @@ import { useSearchParams, useNavigate, useParams } from 'react-router-dom'; import { ListView } from '@object-ui/plugin-list'; import { useAdapter, SchemaRenderer, useNavigationOverlay } from '@object-ui/react'; import { Empty, EmptyTitle, EmptyDescription, NavigationOverlay } from '@object-ui/components'; -import { Database } from 'lucide-react'; +import { Database, FileText } from 'lucide-react'; import { useObjectTranslation } from '@object-ui/i18n'; import { isSystemManagedField } from '@object-ui/types'; import { leadWithNameField } from '@object-ui/core'; @@ -38,6 +38,7 @@ import { usePermissions } from '@object-ui/permissions'; import type { ActionBarSchema, ListViewSchema } from '@object-ui/types'; import { useMetadata } from '../providers/MetadataProvider.js'; import { metadataText } from '../hooks/useNavTargetLabel.js'; +import { PageHeader } from '../layout/PageHeader.js'; import { usePreviewListDataSource } from '../preview/unpublishedObjectReads.js'; import { useTenancyPosture } from '../hooks/useTenancyPosture.js'; import { useNavigationContext } from '../context/NavigationContext.js'; @@ -57,6 +58,14 @@ interface InterfaceListPageProps { * top-right (PageView's pencil), reserve right padding on the header so the * toolbar buttons don't sit under it. */ reserveEditAffordance?: boolean; + /** + * objectstack#36111 — draw the console page header (`PageHeader`) for the + * page's title, description and buttons, as the app's lists and dashboards + * do; its right end holds the shell's button group. The console's page + * route sets it from the phone breakpoint up; Studio's preview and the + * phone keep the page's own title row. + */ + consoleHeader?: boolean; } /** @@ -274,7 +283,7 @@ export function defaultMapFromObject(objectDef: any): { locationField: string } return { locationField: field }; } -export function InterfaceListPage({ page, className, onConfigChange, reserveEditAffordance }: InterfaceListPageProps) { +export function InterfaceListPage({ page, className, onConfigChange, reserveEditAffordance, consoleHeader }: InterfaceListPageProps) { const { t, language } = useObjectTranslation(); // objectui#12980 — the source object, read by name, not the whole registry: // reading `objects` would load every object to find one. Inside an app that @@ -676,21 +685,34 @@ export function InterfaceListPage({ page, className, onConfigChange, reserveEdit return (
-
-
-

- {pageLabel ?? page.name} -

- {pageDescription && ( -

{pageDescription}

+ {consoleHeader ? ( + } + actions={buttonActions.length > 0 ? ( +
+ +
+ ) : undefined} + /> + ) : ( +
+
+

+ {pageLabel ?? page.name} +

+ {pageDescription && ( +

{pageDescription}

+ )} +
+ {buttonActions.length > 0 && ( +
+ +
)}
- {buttonActions.length > 0 && ( -
- -
- )} -
+ )}
(); const [searchParams] = useSearchParams(); const { showDebug } = useMetadataInspector(); @@ -384,6 +395,11 @@ export function PageView() { const studioPath = useStudioDesignGate( page ? appStudioRoutePath(activeApp, true, { type: 'page', name: pageName }) : null, ); + // objectstack#36111 — on a phone the page keeps the face it had (the + // phone's own bar names it, and the pencil below opens Studio); from the + // phone breakpoint up it draws the console page header, whose right end + // holds the shell's button group, and its 「Edit app」 replaces the pencil. + const phone = usePhoneViewport(); if (!page) { // `page` metadata is lazy-loaded: on the very first access `pages` is an @@ -437,7 +453,22 @@ export function PageView() { // Resolve the app slug from the path (`/apps/:app/page/:name`) so the record // navigator's links survive whatever Router basename the host mounts under. const appName = location.pathname.match(/\/apps\/([^/]+)/)?.[1]; - const canEditInStudio = studioPath !== null; + // The floating pencil is the phone's: from the phone breakpoint up, the + // top bar's 「Edit app」 opens the same surface, and so does the button + // group's once the shell turns it on. + const canEditInStudio = phone && studioPath !== null; + const interfacePage = !!(page as any).interfaceConfig?.source; + // The page's name and description, as the page renderer reads them + // (`label`, the spec's key, before objectui's `title`). + const pageLabel = + metadataText((page as any).label, language) ?? metadataText((page as any).title, language) ?? (page as any).name ?? pageName; + const pageDescription = metadataText((page as any).description, language); + // The console header — on every page from the phone breakpoint up, whatever + // the author composed (an interface page draws it itself, below). The page + // renderer's own title and description move into it (`PageTitleHostContext`), + // as a dashboard's do into its header; an authored `page:header` stays as + // written, its title one heading level down. + const consoleHeader = !phone && !interfacePage; const openInStudio = () => { if (studioPath === null) return; navigate(studioPath); @@ -494,7 +525,17 @@ export function PageView() { (see `declarePageDataChanged`). */}
-
+ {/* objectstack#36111 — the header sits above the page's scroller, + as the dashboard's does, so it stays put while the page scrolls. */} +
+ {consoleHeader && ( + } + /> + )} +
{canEditInStudio && (
+
({ import { RecordDetailView } from './RecordDetailView'; import { RecordStackDrawer, useRecordDrawerStack } from './recordDrawerStack'; +import { ShellPageActionsScope } from '../layout/ShellPageActions'; const APP = 'demo'; const LEAD = 'crm_lead'; @@ -387,3 +388,48 @@ describe('the record row leads with the object\'s colour tile (objectstack#35985 expect(tiles[0].getAttribute('data-object-icon-tile')).toBe('orange'); }); }); + +describe('the shell\'s top-right button group on the record page (objectstack#36111)', () => { + function mountUnderShell(on: boolean | undefined) { + const dataSource = makeDataSource(); + render( + + + + + {}} />} + /> + + + + , + ); + } + + it('turned on: the group sits in the navigation row, before ✕, which stays last', async () => { + mountUnderShell(true); + await screen.findByRole('group', { name: 'Panels' }, { timeout: 5000 }); + const nav = pageBar()!.querySelector('[data-record-top-bar-nav]') as HTMLElement; + const frame = nav.querySelector('[data-record-top-bar-frame]') as HTMLElement; + const group = within(frame).getByTestId('shell-page-actions'); + expect(frame.lastElementChild?.getAttribute('data-testid')).toBe('record-page-close'); + expect(group.nextElementSibling?.getAttribute('data-testid')).toBe('record-page-close'); + // Help is always in it; the record row carries none of it. + expect(within(group).getByTestId('shell-page-actions-help')).toBeTruthy(); + const record = pageBar()!.querySelector('[data-record-top-bar-record]') as HTMLElement; + expect(within(record).queryByTestId('shell-page-actions')).toBeNull(); + }); + + it('while the top bar stands (the default, and with no shell above): no group, ✕ alone', async () => { + for (const on of [undefined, false] as const) { + mountUnderShell(on); + await screen.findByRole('group', { name: 'Panels' }, { timeout: 5000 }); + const frame = pageBar()!.querySelector('[data-record-top-bar-frame]') as HTMLElement; + expect(within(frame).queryByTestId('shell-page-actions')).toBeNull(); + expect(frame.children).toHaveLength(1); + cleanup(); + } + }); +}); diff --git a/ui/packages/app-shell/src/views/RecordDetailView.tsx b/ui/packages/app-shell/src/views/RecordDetailView.tsx index 4c724436ec6..bc0a074a0ec 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.tsx @@ -65,6 +65,7 @@ import { actionContextOrg } from '../utils/actionContextOrg.js'; import { editFormLockedByState } from '../utils/editFormLockedByState.js'; import { matchAppBySegment, resolveHostAppSegment } from '../utils/appRoute.js'; import { hostInConsolePath } from '../utils/hostInConsolePath.js'; +import { ShellPageActions, useShellPageActionsOn } from '../layout/ShellPageActions.js'; import { recycleBinRefusalLabelsOf, recycleBinRestoreOf } from '../utils/recycleBinRestore.js'; import { launchConsoleFlow } from '../utils/flowLaunch.js'; import type { TranslateFn } from '@object-ui/i18n'; @@ -967,6 +968,11 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri [pageReturn.stepper, pageReturn.toList, originFromState?.label], ); useRecordStepKeys(!embedded && !!pageStepper, pageStepper, { arrows: false }); + // objectstack#36111 — whether the shell draws its top-right button group on + // this page (off while the top bar stands); the page face draws it in its + // navigation row, before ✕. A pane or drawer never does: the page under it + // has the group already. + const shellActions = useShellPageActionsOn() && !embedded; // `language` is also the language a flow launch reads a refused write's // permission line in. const { t, language } = useObjectTranslation(); @@ -5379,10 +5385,15 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // desktop face: back to the list the page came from as it was left // (objectstack#35854), else the object's default list. const closePage = pageReturn.toList ?? (objectListPath ? () => navigate(objectListPath) : undefined); - const pageFrame = closePage ? ( - - - + const pageFrame = closePage || shellActions ? ( + <> + {shellActions && } + {closePage && ( + + + + )} + ) : undefined; // objectstack#27058, Target 8 — the path row of a page one level down // (「线索 Mira Costa › 任务」): the `?from=` trail, each ancestor a link, the diff --git a/ui/packages/app-shell/src/views/ReportView.tsx b/ui/packages/app-shell/src/views/ReportView.tsx index cf2e8e3af3a..cea581b7a76 100644 --- a/ui/packages/app-shell/src/views/ReportView.tsx +++ b/ui/packages/app-shell/src/views/ReportView.tsx @@ -8,6 +8,7 @@ import { Empty, EmptyTitle, EmptyDescription } from '@object-ui/components'; // (lives in app-shell to avoid a circular dep on plugin-report). import { ReportConfigPanel } from './ReportConfigPanel.js'; import { Pencil, BarChart3, Loader2 } from 'lucide-react'; +import { PageHeader } from '../layout/PageHeader.js'; import { useObjectTranslation } from '@object-ui/i18n'; import { MetadataPanel, useMetadataInspector } from './MetadataInspector.js'; import { useMetadata } from '../providers/MetadataProvider.js'; @@ -488,28 +489,28 @@ export function ReportView({ dataSource }: { dataSource?: DataSource }) { return (
-
-
-

{heading}

- {description && ( -

{description}

- )} -
-
- {isAdmin && ( - - )} -
-
+ {/* objectstack#36111 — the console page header every list and + dashboard draws: the report's name, its description behind the + hairline, and the report's own 「Edit」 (the inspector beside the + report, not Studio) as its action. The shell's top-right group + follows the action where the shell turns it on. */} + } + actions={isAdmin ? ( + + ) : undefined} + />
diff --git a/ui/packages/app-shell/src/views/__tests__/PageView.consoleHeader-36111.test.tsx b/ui/packages/app-shell/src/views/__tests__/PageView.consoleHeader-36111.test.tsx new file mode 100644 index 00000000000..0d0b0e38465 --- /dev/null +++ b/ui/packages/app-shell/src/views/__tests__/PageView.consoleHeader-36111.test.tsx @@ -0,0 +1,172 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * A custom page draws the console page header (objectstack#36111): from the + * phone breakpoint up, every page under `/apps/APP/page/NAME` opens with the + * header lists, dashboards and reports draw, the page's name and description + * on its left and the shell's top-right button group on its right. + * + * - The page renderer's own title and description move into that header + * (`PageTitleHostContext`), as a dashboard's do into its header: the page + * names itself once, in one `h1`. + * - What the author composed is drawn as written. An authored `page:header` + * with a title keeps it, one heading level down (`h2`), so the document + * keeps one `h1` (objectui#3434). + * - The floating 「Edit in studio」 pencil is the phone's alone; a phone keeps + * the face it had: no console header, the renderer's own title, the pencil. + * + * Real subjects: `PageView` and the real page renderer from + * `@object-ui/components` (`page`, `page:header`, `element:text`), under a + * router at the page's route. The shell's group is pinned in + * `layout/__tests__/ShellPageActions-36111`; here only where it goes. + */ + +import '@testing-library/jest-dom/vitest'; +import * as React from 'react'; +import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest'; +import { render, screen, cleanup, act, within } from '@testing-library/react'; +import { MemoryRouter, Routes, Route } from 'react-router-dom'; +import { PageSchema } from '@objectstack/spec/ui'; + +vi.mock('@object-ui/auth', async (importOriginal) => ({ + ...(await importOriginal>()), + useAuth: () => ({ user: { id: 'u1', name: 'Ada', role: 'user', image: null }, activeOrganization: null }), + useWorkspaceAdminStatus: () => ({ isAdmin: false, isResolved: true }), + createAuthenticatedFetch: () => vi.fn(), +})); + +vi.mock('@object-ui/i18n', async (importOriginal) => ({ + ...(await importOriginal>()), + useObjectTranslation: () => ({ t: (k: string, o?: { defaultValue?: string; name?: string }) => o?.defaultValue ?? o?.name ?? k, language: 'en' }), +})); + +/** The stored page document the next mount resolves. */ +let storedPage: Record = {}; + +vi.mock('../../providers/MetadataProvider', () => ({ + useMetadata: () => ({ pages: [storedPage], objects: [], apps: [], getTypeStatus: () => 'ready' }), +})); + +vi.mock('../MetadataInspector', () => ({ + MetadataPanel: () => null, + useMetadataInspector: () => ({ showDebug: false }), +})); + +// Module scope, never a `beforeAll`: the `page`, `page:header` and +// `element:text` renderers. +import '@object-ui/components'; +import { AdapterCtx, FilterScopeProvider, SchemaRendererProvider } from '@object-ui/react'; +import { PageView } from '../PageView'; +import { ShellPageActionsScope } from '../../layout/ShellPageActions'; + +const text = (id: string, content: string) => ({ type: 'element:text', id, properties: { content } }); + +/** A page with no header of its own: the renderer drew its name as an `h1`. */ +const PLAIN = { + name: 'welcome', + label: 'Welcome', + description: 'Where the team starts the day.', + type: 'app', + regions: [{ name: 'main', components: [text('body', 'Body copy')] }], +}; + +/** A page whose author wrote a titled `page:header` that differs from the page's name. */ +const AUTHORED = { + name: 'contact', + label: 'Contact Form', + type: 'app', + regions: [ + { name: 'header', components: [{ type: 'page:header', properties: { title: 'Get in touch', subtitle: 'We answer within a day.' } }] }, + { name: 'main', components: [text('body', 'Body copy')] }, + ], +}; + +function mount(page: Record, { shell }: { shell?: boolean } = {}) { + storedPage = page; + const ds = { find: vi.fn(async () => ({ data: [] })), findOne: vi.fn(async () => null) }; + const route = ( + + + } /> + + + ); + render( + + + + {shell === undefined ? route : {route}} + + + , + ); +} + +const settle = (ms = 50) => act(() => new Promise((resolve) => setTimeout(resolve, ms))); +const setWidth = (value: number) => Object.defineProperty(window, 'innerWidth', { configurable: true, value }); + +beforeEach(() => { + setWidth(1280); + vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, status: 200, json: async () => ({ data: [] }) }))); +}); + +afterEach(() => { + cleanup(); + setWidth(1024); + vi.unstubAllGlobals(); +}); + +describe('objectstack#36111 — a custom page opens with the console page header', () => { + it('the fixtures are pages the spec accepts', () => { + for (const page of [PLAIN, AUTHORED]) { + const parsed = PageSchema.safeParse(page); + expect(parsed.success, JSON.stringify(parsed.error?.issues)).toBe(true); + } + }); + + it('a page with no header of its own: its name and description move into the console header, once', async () => { + mount(PLAIN); + await screen.findByText('Body copy'); + const header = screen.getByTestId('page-header'); + expect(within(header).getByRole('heading', { level: 1 }).textContent).toBe('Welcome'); + expect(within(header).getByText('Where the team starts the day.')).toBeInTheDocument(); + // The renderer draws neither a second time. + expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1); + expect(screen.getAllByText('Where the team starts the day.')).toHaveLength(1); + // The header sits above the page's scroller, not inside it. + expect(header.parentElement?.querySelector(':scope > .overflow-auto')).not.toBeNull(); + }); + + it('a page that authors a titled `page:header`: the console header names the page, the author\'s title stays as an `h2`', async () => { + mount(AUTHORED); + await screen.findByText('Body copy'); + const header = screen.getByTestId('page-header'); + expect(within(header).getByRole('heading', { level: 1 }).textContent).toBe('Contact Form'); + expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1); + expect(screen.getByRole('heading', { level: 2, name: 'Get in touch' })).toBeInTheDocument(); + expect(screen.getByText('We answer within a day.')).toBeInTheDocument(); + }); + + it('the shell\'s button group sits at the header\'s right once the shell turns it on, and nowhere while it is off', async () => { + mount(PLAIN, { shell: true }); + await screen.findByText('Body copy'); + const header = screen.getByTestId('page-header'); + expect(within(header).getByTestId('shell-page-actions')).toBeInTheDocument(); + expect(screen.getAllByTestId('shell-page-actions')).toHaveLength(1); + cleanup(); + + mount(PLAIN, { shell: false }); + await screen.findByText('Body copy'); + expect(screen.queryByTestId('shell-page-actions')).not.toBeInTheDocument(); + }); + + it('a phone keeps the face it had: no console header, the renderer\'s own title', async () => { + setWidth(375); + mount(PLAIN, { shell: true }); + await screen.findByText('Body copy'); + await settle(); + expect(screen.queryByTestId('page-header')).not.toBeInTheDocument(); + expect(screen.queryByTestId('shell-page-actions')).not.toBeInTheDocument(); + expect(screen.getByRole('heading', { level: 1 }).textContent).toBe('Welcome'); + }); +}); diff --git a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx index 55ecb00dc24..bf70b620e2f 100644 --- a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx @@ -16,6 +16,13 @@ * * Harness: the one `PageView.editInStudioOpensStudio-12540` uses. Every case is * a caller who passes the authoring gate (`PageView.editInStudioNeedsAuthoring-10899`). + * + * objectstack#36111 — the floating pencil is the phone's face since the page + * header and the shell's button group arrived: from the phone breakpoint up + * the top bar's 「Edit app」 (and the group's, once the shell turns it on) + * opens the same surface through the same gate + * (`ShellPageActions.pageRoute-36111`). So this file reads the pencil at a + * phone's width. */ import '@testing-library/jest-dom/vitest'; @@ -134,11 +141,14 @@ function expectNoPencil() { } beforeEach(() => { + // The pencil's face: a phone (objectstack#36111). + Object.defineProperty(window, 'innerWidth', { configurable: true, value: 375 }); navigateSpy.mockClear(); serve(async () => ({ ok: true, status: 200, body: PACKAGES })); }); afterEach(() => { + Object.defineProperty(window, 'innerWidth', { configurable: true, value: 1024 }); cleanup(); vi.unstubAllGlobals(); }); diff --git a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx index 36e6c2c7c2a..792387cff5a 100644 --- a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx @@ -19,6 +19,13 @@ * Real subjects: `PageView` under the real `MePermissionsProvider`, seeded with * the `/me/permissions` payloads each persona receives (`initialPermissions`, * so no request is made). The role is the stubbed axis. + * + * objectstack#36111 — the floating pencil is the phone's face since the page + * header and the shell's button group arrived: from the phone breakpoint up + * the top bar's 「Edit app」 (and the group's, once the shell turns it on) + * opens the same surface through the same gate + * (`ShellPageActions.pageRoute-36111`). So this file reads the pencil at a + * phone's width. */ import '@testing-library/jest-dom/vitest'; @@ -114,6 +121,8 @@ async function mount(perms: MePermissionsResponse) { } beforeEach(() => { + // The pencil's face: a phone (objectstack#36111). + Object.defineProperty(window, 'innerWidth', { configurable: true, value: 375 }); viewer.isAdmin = true; // objectui#12615 — the app's package is served writable, so the pencil's // package half passes and this file's own questions are the ones asked. @@ -131,6 +140,7 @@ beforeEach(() => { }); afterEach(() => { + Object.defineProperty(window, 'innerWidth', { configurable: true, value: 1024 }); cleanup(); vi.unstubAllGlobals(); }); diff --git a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx index 84f8d36bcbb..0963ddc3760 100644 --- a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx @@ -23,6 +23,13 @@ * posture in `PageView.editInStudioFollowsPackagePosture-12615`; every case * here is a caller who passes the first, on a package the list serves * writable. + * + * objectstack#36111 — the floating pencil is the phone's face since the page + * header and the shell's button group arrived: from the phone breakpoint up + * the top bar's 「Edit app」 (and the group's, once the shell turns it on) + * opens the same surface through the same gate + * (`ShellPageActions.pageRoute-36111`). So this file reads the pencil at a + * phone's width. */ import '@testing-library/jest-dom/vitest'; @@ -108,6 +115,8 @@ async function mountUnder(app: Record | undefined) { } beforeEach(() => { + // The pencil's face: a phone (objectstack#36111). + Object.defineProperty(window, 'innerWidth', { configurable: true, value: 375 }); navigateSpy.mockClear(); // objectui#12615 — the app's package is served writable, so the pencil's // package half passes and this file's own questions are the ones asked. @@ -125,6 +134,7 @@ beforeEach(() => { }); afterEach(() => { + Object.defineProperty(window, 'innerWidth', { configurable: true, value: 1024 }); cleanup(); vi.unstubAllGlobals(); }); diff --git a/ui/packages/components/src/index.ts b/ui/packages/components/src/index.ts index eb080851399..0e38c40992c 100644 --- a/ui/packages/components/src/index.ts +++ b/ui/packages/components/src/index.ts @@ -116,6 +116,10 @@ export { PageHeaderActions } from './renderers/layout/containers'; // The host slot at the end of that row (objectstack#27241): the console's // record view puts the reader's panel switches there. export { PageHeaderTrailingContext } from './renderers/layout/page-header-trailing-context'; +// The host owns the page's title (objectstack#36111): the console's page route +// draws the page's name and description in its page header, so the page +// renderer draws neither, and an authored titled `page:header` draws an `h2`. +export { PageTitleHostContext } from './renderers/layout/page-title-host-context'; // The phone's host slot (objectstack#27058): the console's record page hands // the header its bottom action bar, where the same row is drawn in its bar // face, and the subtitle it draws when the header declares none. diff --git a/ui/packages/components/src/renderers/layout/containers.tsx b/ui/packages/components/src/renderers/layout/containers.tsx index 42cae50bc03..0f6a2f60f78 100644 --- a/ui/packages/components/src/renderers/layout/containers.tsx +++ b/ui/packages/components/src/renderers/layout/containers.tsx @@ -61,6 +61,7 @@ import { import { RecordTitleChip } from '../../custom/RecordTitleChip'; import { resolveFieldReadFace } from '../../lib/field-face'; import { PageDescriptionContext } from './page-description-context'; +import { PageTitleDemotedContext } from './page-title-host-context'; import { PageHeaderTrailingContext } from './page-header-trailing-context'; import { PageHeaderPhoneContext } from './page-header-phone-context'; import { RecordHeaderBarContext, RecordHeaderStateContext, type RecordHeaderState } from './record-header-bar-context'; @@ -3157,6 +3158,9 @@ const PageHeaderRenderer: React.FC = ({ schema, className, ...props }) => { // title (objectui#12624): drawn under the title and subtitle, the order the // console page header uses, instead of above the title by the page. const pageDescription = React.useContext(PageDescriptionContext); + // objectstack#36111 — the host's page header holds the page's `h1`, so this + // header's title is drawn one level down, looking the same. + const titleDemoted = React.useContext(PageTitleDemotedContext); // The host's trailing chrome for the action row (objectstack#27241). const headerTrailing = React.useContext(PageHeaderTrailingContext); // A phone host's face (objectstack#27058): the actions go to its bottom bar, @@ -3652,9 +3656,11 @@ const PageHeaderRenderer: React.FC = ({ schema, className, ...props }) => { >
- {explicitTitle && ( + {explicitTitle && (titleDemoted ? ( +

{explicitTitle}

+ ) : (

{explicitTitle}

- )} + ))} {subtitle &&

{subtitle}

} {explicitTitle && pageDescription && (

{pageDescription}

diff --git a/ui/packages/components/src/renderers/layout/page-title-host-context.ts b/ui/packages/components/src/renderers/layout/page-title-host-context.ts new file mode 100644 index 00000000000..7f42bb1d19b --- /dev/null +++ b/ui/packages/components/src/renderers/layout/page-title-host-context.ts @@ -0,0 +1,35 @@ +/** + * ObjectUI + * Copyright (c) 2024-present ObjectStack Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; + +/** + * The host draws the page's title and description above the page + * (objectstack#36111): the console's page route puts the page in its page + * header (name left, the shell's button group right), as a dashboard's name + * sits in the header and not in the dashboard. + * + * It is a host switch, never metadata: no page key says it. While a host sets + * it, the page renderer draws neither its implicit title nor the page + * description, and an authored `page:header` with a title draws that title as + * an `h2` (the host's header holds the one `h1`, objectui#3434). What the + * author wrote is drawn as written otherwise. `false` (the default) is the + * page as it was. + * + * The page renderer reads it once and turns it off for everything inside the + * page, so a page nested in this one (a record drawer opened from it) draws + * its own title. + */ +export const PageTitleHostContext = React.createContext(false); + +/** + * Inside a page whose host owns its title: whether an authored `page:header` + * draws its title one level down. Provided by the page renderer from + * {@link PageTitleHostContext}, read by `page:header`; not exported. + */ +export const PageTitleDemotedContext = React.createContext(false); diff --git a/ui/packages/components/src/renderers/layout/page.tsx b/ui/packages/components/src/renderers/layout/page.tsx index 3f4e96929b3..b4764eae821 100644 --- a/ui/packages/components/src/renderers/layout/page.tsx +++ b/ui/packages/components/src/renderers/layout/page.tsx @@ -33,6 +33,7 @@ import { PRINT_PAGE_ATTRIBUTE, PRINT_RUNNING_ATTRIBUTE, buildPagePrintStylesheet import { cn } from '../../lib/utils'; import { PageBlockGrid } from './page-block-grid'; import { PageDescriptionContext } from './page-description-context'; +import { PageTitleDemotedContext, PageTitleHostContext } from './page-title-host-context'; import { PageRegionPostureProvider, PageWidthProvider, usePageWidthStore } from './page-region-posture'; import type { RendererHostProps } from '../../lib/renderer-host-props'; @@ -780,6 +781,10 @@ export const PageRenderer: React.FC<{ const { language } = useObjectTranslation(); const pageTitle = pickLocalized(schema.title ?? (schema as any).label, language); const pageDescription = pickLocalized(schema.description, language); + // objectstack#36111 — the host draws the title and the description above + // the page (the console's page header): this page draws neither, and an + // authored titled `page:header` steps its title down to an `h2`. + const hostOwnsTitle = React.useContext(PageTitleHostContext); // What may become an attribute on the wrapper
, and nothing else. // @@ -937,10 +942,11 @@ export const PageRenderer: React.FC<{ () => pageType === 'record' || pageHeaderOwnsTitle(schema), [schema, pageType], ); - const showPageTitle = !!pageTitle && !headerOwnsTitle; + const showPageTitle = !!pageTitle && !headerOwnsTitle && !hostOwnsTitle; // The description is the page's own prose, not a duplicate of the header's - // `subtitle`, so delegating the heading does not delete it. - const showPageDescription = !!pageDescription && pageType !== 'record'; + // `subtitle`, so delegating the heading does not delete it. A host that owns + // the title draws it in its own header. + const showPageDescription = !!pageDescription && pageType !== 'record' && !hostOwnsTitle; // When the header owns the title, it draws the description too, under the // title (objectui#12624). Drawn here it sat above the regions, so above the // title the header draws inside them. @@ -987,7 +993,13 @@ export const PageRenderer: React.FC<{ {/* Page body — type-specific layout */} - {layoutElement} + {/* The host's switch stops at this page: a page nested in it draws + its own title. Its authored header reads the demotion instead. */} + + + {layoutElement} + +
From 7dac7df9a11c21bf22c54fff74e62f41b73f7e9b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 15:50:35 +0000 Subject: [PATCH 2/5] chore(console): the group's module doc, the pin references and the page name order follow the review The shell group's module doc no longer names the custom page's host slot, the three pencil pins point at the group's real pin file, and the custom page header reads the page name in the page renderer's order (title before label). Claude-Session: https://claude.ai/code/session_01L6bhgVcCRGjxwhDjrRVYsY Co-authored-by: Claude --- ui/packages/app-shell/src/layout/ShellPageActions.tsx | 4 ++-- ui/packages/app-shell/src/views/PageView.tsx | 7 ++++--- ...geView.editInStudioFollowsPackagePosture-12615.test.tsx | 2 +- .../PageView.editInStudioNeedsAuthoring-10899.test.tsx | 2 +- .../PageView.editInStudioOpensStudio-12540.test.tsx | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ui/packages/app-shell/src/layout/ShellPageActions.tsx b/ui/packages/app-shell/src/layout/ShellPageActions.tsx index 60de8d88c7e..046aab25b2f 100644 --- a/ui/packages/app-shell/src/layout/ShellPageActions.tsx +++ b/ui/packages/app-shell/src/layout/ShellPageActions.tsx @@ -9,8 +9,8 @@ * The SHELL decides whether it is drawn, not the page: `ConsoleLayout` mounts * `ShellPageActionsScope`, and each page's header draws `` * where its top-right is — the console `PageHeader` after the page's own - * actions, the record page's navigation row before its ✕, a custom page's - * authored `page:header` through the host slot `PageHeaderTrailingContext`. + * actions (reports and every custom page draw that header too), the record + * page's navigation row before its ✕. * * While the top bar still draws the same three buttons the group is OFF, so * nothing doubles: `SHELL_PAGE_ACTIONS_DEFAULT` is `false`, and the one way to diff --git a/ui/packages/app-shell/src/views/PageView.tsx b/ui/packages/app-shell/src/views/PageView.tsx index 4614e964d64..34a0d563d6b 100644 --- a/ui/packages/app-shell/src/views/PageView.tsx +++ b/ui/packages/app-shell/src/views/PageView.tsx @@ -458,10 +458,11 @@ export function PageView() { // group's once the shell turns it on. const canEditInStudio = phone && studioPath !== null; const interfacePage = !!(page as any).interfaceConfig?.source; - // The page's name and description, as the page renderer reads them - // (`label`, the spec's key, before objectui's `title`). + // The page's name and description, in the page renderer's own order + // (`title` before `label`, `page.tsx`), so the header names the page with + // the words the renderer drew there before. const pageLabel = - metadataText((page as any).label, language) ?? metadataText((page as any).title, language) ?? (page as any).name ?? pageName; + metadataText((page as any).title, language) ?? metadataText((page as any).label, language) ?? (page as any).name ?? pageName; const pageDescription = metadataText((page as any).description, language); // The console header — on every page from the phone breakpoint up, whatever // the author composed (an interface page draws it itself, below). The page diff --git a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx index bf70b620e2f..84a53d51055 100644 --- a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioFollowsPackagePosture-12615.test.tsx @@ -21,7 +21,7 @@ * header and the shell's button group arrived: from the phone breakpoint up * the top bar's 「Edit app」 (and the group's, once the shell turns it on) * opens the same surface through the same gate - * (`ShellPageActions.pageRoute-36111`). So this file reads the pencil at a + * (`ShellPageActions-36111`). So this file reads the pencil at a * phone's width. */ diff --git a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx index 792387cff5a..0c19a55f9d5 100644 --- a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioNeedsAuthoring-10899.test.tsx @@ -24,7 +24,7 @@ * header and the shell's button group arrived: from the phone breakpoint up * the top bar's 「Edit app」 (and the group's, once the shell turns it on) * opens the same surface through the same gate - * (`ShellPageActions.pageRoute-36111`). So this file reads the pencil at a + * (`ShellPageActions-36111`). So this file reads the pencil at a * phone's width. */ diff --git a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx index 0963ddc3760..365ae9ff032 100644 --- a/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/PageView.editInStudioOpensStudio-12540.test.tsx @@ -28,7 +28,7 @@ * header and the shell's button group arrived: from the phone breakpoint up * the top bar's 「Edit app」 (and the group's, once the shell turns it on) * opens the same surface through the same gate - * (`ShellPageActions.pageRoute-36111`). So this file reads the pencil at a + * (`ShellPageActions-36111`). So this file reads the pencil at a * phone's width. */ From 4d7b483b48c981fd51b18f1a64933f04245806a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 16:04:00 +0000 Subject: [PATCH 3/5] fix(console): the list page's view bar ends with the shell's group too Since the list redo the list page's top row is its view bar, not the console PageHeader, so the group never reached the list. The bar's right end now draws it after the page's acts behind a hairline, as PageHeader does, and draws nothing new while the group is off. Claude-Session: https://claude.ai/code/session_01L6bhgVcCRGjxwhDjrRVYsY Co-authored-by: Claude --- ...ObjectView.shellPageActions-36111.test.tsx | 172 ++++++++++++++++++ .../src/views/objectViewPageHeader.tsx | 14 ++ 2 files changed, 186 insertions(+) create mode 100644 ui/packages/app-shell/src/views/ObjectView.shellPageActions-36111.test.tsx diff --git a/ui/packages/app-shell/src/views/ObjectView.shellPageActions-36111.test.tsx b/ui/packages/app-shell/src/views/ObjectView.shellPageActions-36111.test.tsx new file mode 100644 index 00000000000..91333c0baa2 --- /dev/null +++ b/ui/packages/app-shell/src/views/ObjectView.shellPageActions-36111.test.tsx @@ -0,0 +1,172 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36111 — the list page's top row ends with the shell's top-right + * button group. Since objectstack#35878 that row is the list's view bar (the + * object's name, the view switcher, the search, the page's acts and ⋮), not + * the console `PageHeader`, so the bar's right end draws the group itself: + * after ⋮, behind a hairline. Turned off (the default while the top bar + * stands) the bar is what it was. The group's own parts are pinned in + * `layout/__tests__/ShellPageActions-36111`; here only where it goes. + * + * The real chain, as `ObjectView.objectListTitle-27950`: the real `ObjectView`, + * the real plugin `ObjectView` and the real `ListView`. + */ + +import * as React from 'react'; +import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest'; +import { render, cleanup, screen, waitFor, within } from '@testing-library/react'; +import { MemoryRouter, Routes, Route, useLocation } from 'react-router-dom'; +import { createI18n, I18nProvider } from '@object-ui/i18n'; +import { SidebarProvider, useSidebar } from '@object-ui/components'; + +vi.mock('@object-ui/permissions', async (importOriginal) => { + const actual = await importOriginal(); + // Stable identities — `ListView` names `perms` in its fetch dependencies. + const perms = { + check: () => ({ allowed: true }), + checkField: () => true, + getFieldPermissions: () => [], + getRowFilter: () => undefined, + getObjectApiOperations: () => undefined, + roles: [], + isLoaded: false, + hasCapabilities: () => true, + can: () => true, + cannot: () => false, + }; + const fieldPerms = { canRead: () => true, canWrite: () => true, permissions: [] }; + return { ...actual, usePermissions: () => perms, useFieldPermissions: () => fieldPerms }; +}); + +vi.mock('@object-ui/auth', async (importOriginal) => ({ + ...(await importOriginal>()), + useAuth: () => ({ user: { id: 'u1', name: 'Sales Manager' }, activeOrganization: { id: 'org1', name: 'Acme' } }), + useWorkspaceAdminStatus: () => ({ isAdmin: false, isResolved: true }), +})); + +vi.mock('@object-ui/collaboration', async (importOriginal) => ({ + ...(await importOriginal>()), + useRealtimeSubscription: () => ({ lastMessage: null }), + useConflictResolution: () => ({ hasConflicts: false, resolveAllConflicts: () => {} }), +})); + +vi.mock('./MetadataInspector', () => ({ + MetadataPanel: () => null, + useMetadataInspector: () => ({ showDebug: false, toggle: () => {} }), +})); +vi.mock('./RecordDetailView', () => ({ RecordDetailView: () => null })); + +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; +import { ObjectView } from './ObjectView'; +import { ExpressionProvider } from '../providers/ExpressionProvider'; +import { ShellPageActionsScope } from '../layout/ShellPageActions'; + +// The page's own reads (the security `explain` probe among them) are relative +// fetches, which happy-dom would send to a real socket. One double, installed +// at module scope and never torn down, so no read the mounted tree issues +// after a test body returns can reach the network. +vi.stubGlobal('fetch', vi.fn(async () => + new Response(JSON.stringify({ data: [] }), { status: 200, headers: { 'content-type': 'application/json' } }))); + +const LEAD = { + name: 'crm_lead', + label: 'Lead', + pluralLabel: 'Leads', + fields: { + id: { type: 'text', label: 'Id' }, + name: { type: 'text', label: 'Name' }, + }, + listViews: { + all: { name: 'all', label: 'All Leads', type: 'grid', columns: ['name'] }, + mine: { name: 'mine', label: 'My Leads', type: 'grid', columns: ['name'] }, + }, +}; + +/** An object whose one view the author left unnamed: the view is called by the plural. */ +const NOTE = { + name: 'crm_note', + label: 'Note', + pluralLabel: 'Notes', + fields: { id: { type: 'text', label: 'Id' }, name: { type: 'text', label: 'Name' } }, + listViews: { all: { type: 'grid', columns: ['name'] } }, +}; + +const OBJECTS = [LEAD, NOTE]; +const ROWS = [{ id: 'lead_1', name: 'Ada' }]; + +/** Where the router is, read back after a click. */ +function LocationProbe() { + const location = useLocation(); + return {location.pathname}; +} + +/** The sidebar state the page renders under, read back. */ +function SidebarStateProbe() { + return {useSidebar().state}; +} + +function mount(entry: string, { sidebarOpen = true, shell }: { sidebarOpen?: boolean; shell?: boolean } = {}) { + const i18n = createI18n({ defaultLanguage: 'en', detectBrowserLanguage: false }); + const dataSource = { + find: vi.fn(async () => ({ data: ROWS, total: ROWS.length })), + findOne: vi.fn(async () => null), + getObjectSchema: vi.fn(async (name: string) => OBJECTS.find((o) => o.name === name) ?? null), + create: vi.fn(async () => ({})), + update: vi.fn(async () => ({})), + delete: vi.fn(async () => ({})), + } as never; + const page = {}} />; + return render( + + + + + + + + + + + + + + + + , + ); +} + +/** The list's toolbar has drawn: its Filter control is on screen. */ +const listToolbar = () => + waitFor(() => expect(screen.getByTestId('condition-add-filter')).toBeInTheDocument(), { timeout: 5000 }); + +beforeEach(() => { + localStorage.clear(); +}); + +afterEach(() => { + cleanup(); +}); + +describe('objectstack#36111 — the list view bar ends with the shell\'s group', () => { + it('turned on: after the page\'s acts, behind a hairline, at the bar\'s right end', async () => { + mount('/apps/crm/crm_lead/view/mine', { shell: true }); + await listToolbar(); + const end = await screen.findByTestId('list-view-bar-end'); + const ids = Array.from(end.children).map((c) => c.getAttribute('data-testid')); + expect(ids).toEqual(['list-view-bar-tools', 'list-view-bar-shell-divider', 'shell-page-actions']); + expect(screen.getAllByTestId('shell-page-actions')).toHaveLength(1); + expect(within(screen.getByTestId('shell-page-actions')).getByTestId('shell-page-actions-help')).toBeInTheDocument(); + }); + + it('turned off: the bar is what it was, no group and no hairline', async () => { + mount('/apps/crm/crm_lead/view/mine', { shell: false }); + await listToolbar(); + const end = await screen.findByTestId('list-view-bar-end'); + expect(Array.from(end.children).map((c) => c.getAttribute('data-testid'))).toEqual(['list-view-bar-tools']); + expect(screen.queryByTestId('shell-page-actions')).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx index b07b0d7f89c..29fc6869927 100644 --- a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx +++ b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx @@ -28,6 +28,7 @@ import type { useObjectLabel, useObjectTranslation } from '@object-ui/i18n'; import { FavoriteMenuItem } from '../layout/SidebarItemMenu.js'; import type { useObjectListFavorite } from '../layout/SidebarItemMenu.js'; import { PageHeader } from '../layout/PageHeader.js'; +import { ShellPageActions, useShellPageActionsOn } from '../layout/ShellPageActions.js'; import { ManagedByBadge } from '../components/ManagedByBadge.js'; import { EnvironmentListToolbar } from '../environment/EnvironmentListToolbar.js'; import { ListHeaderActionBar } from './objectViewHeaderLaunchGate.js'; @@ -176,6 +177,7 @@ export function ObjectViewPageHeader(props: ObjectViewPageBarProps) { setPageColumn(el?.parentElement ?? null); }, []); useListPageScope(pageColumn); + const shellActions = useShellPageActionsOn(); return (
(`[${OBJECT_VIEW_PAGE_COLUMN_ATTR}]`) ?? null); }, []); useListPageScope(pageColumn); + const shellActions = useShellPageActionsOn(); return (
+ {shellActions && ( + <> +
); } From bbf1849d6cbe8100b35a82959876f1373b293adf Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 16:04:19 +0000 Subject: [PATCH 4/5] chore(console): the changeset names the list page's place for the group Claude-Session: https://claude.ai/code/session_01L6bhgVcCRGjxwhDjrRVYsY Co-authored-by: Claude --- .changeset/36111-page-header-shell-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/36111-page-header-shell-actions.md b/.changeset/36111-page-header-shell-actions.md index e0200406dba..f14cb1d8435 100644 --- a/.changeset/36111-page-header-shell-actions.md +++ b/.changeset/36111-page-header-shell-actions.md @@ -9,5 +9,5 @@ Clause-②: yes (widening) Metadata-protocol: none - **Reports, the report index and custom pages draw the console page header** that lists and dashboards draw: the page's name (and description) on the left, its actions on the right. A report keeps its 「Edit」 (the inspector beside the report) as the header's action. A custom page's name and description move into the header; the page renderer no longer draws them a second time, and a `page:header` the author wrote stays as written, its title one heading level down (`h2`) so the page keeps one `h1`. An interface page swaps its own title row for the header, buttons included. On a phone a custom page keeps the face it had, its floating 「Edit in studio」 pencil included; from the phone breakpoint up the pencil is gone and the top bar's 「Edit app」 opens the same surface. -- **The top-right button group** (`ShellPageActions`, internal to `@object-ui/app-shell`): the comments slot, 「Edit app」 (words beside a non-pencil icon, icon-only below `lg`, the same gate and target as the top bar's pencil; a read-only package gets the eye), the AI assistant and help. The console page header draws it after its actions, the record page in its navigation row before ✕, a custom page in its header. **It is off** while the top bar stands, so nothing changes on screen beyond the headers above; `localStorage['os:shell:page-actions'] = 'on'` turns it on for checking. The help menu is now one component the top bar and the group share. +- **The top-right button group** (`ShellPageActions`, internal to `@object-ui/app-shell`): the comments slot, 「Edit app」 (words beside a non-pencil icon, icon-only below `lg`, the same gate and target as the top bar's pencil; a read-only package gets the eye), the AI assistant and help. The console page header draws it after its actions (so reports, dashboards and custom pages), the list page at the end of its view bar after ⋮, the record page in its navigation row before ✕. **It is off** while the top bar stands, so nothing changes on screen beyond the headers above; `localStorage['os:shell:page-actions'] = 'on'` turns it on for checking. The help menu is now one component the top bar and the group share. - `@object-ui/components` exports `PageTitleHostContext`, a host switch (never metadata) that says the host draws the page's title and description: the page renderer then draws neither, and an authored titled `page:header` draws its title as an `h2`. Default `false`: every other host is unchanged. From ca3b1beaa2658462a466d8ec28752a7febd1e90a Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 16:26:37 +0000 Subject: [PATCH 5/5] fix(console): the headers take the shell's group through a slot, never import it PageHeader, the list's view bar and the record page imported the group module, which reads the app's metadata, so every page bundled on its own and every test mounting one bare pulled MetadataProvider in at import: the mobile-app QR bundle lost its exports and the record page tests met the metadata client before their auth mock existed. The scope now hands a stable render function down through shellPageActionsSlot.ts, which imports only React and the phone breakpoint; the group module is imported by the shell alone. Claude-Session: https://claude.ai/code/session_01L6bhgVcCRGjxwhDjrRVYsY Co-authored-by: Claude --- .../app-shell/src/layout/PageHeader.tsx | 10 ++-- .../app-shell/src/layout/ShellPageActions.tsx | 46 +++++++++++-------- .../src/layout/shellPageActionsSlot.ts | 43 +++++++++++++++++ .../app-shell/src/views/RecordDetailView.tsx | 7 +-- .../src/views/objectViewPageHeader.tsx | 9 ++-- 5 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 ui/packages/app-shell/src/layout/shellPageActionsSlot.ts diff --git a/ui/packages/app-shell/src/layout/PageHeader.tsx b/ui/packages/app-shell/src/layout/PageHeader.tsx index b29deddff1b..39800c5ccae 100644 --- a/ui/packages/app-shell/src/layout/PageHeader.tsx +++ b/ui/packages/app-shell/src/layout/PageHeader.tsx @@ -59,7 +59,7 @@ import * as React from 'react'; import { RefreshCw } from 'lucide-react'; import { Button, cn } from '@object-ui/components'; import { useInSetupApp } from '../console/setupApp.js'; -import { ShellPageActions, useShellPageActionsOn } from './ShellPageActions.js'; +import { useShellPageActionsSlot } from './shellPageActionsSlot.js'; /** * Props of the app-shell `` React component. @@ -271,9 +271,9 @@ export function PageHeader({ // objectstack#36111 — the shell's top-right button group, after the page's // own actions, where the shell turned it on (`ShellPageActions`); a hairline // sets it apart from them. - const shellActions = useShellPageActionsOn(); + const renderShellGroup = useShellPageActionsSlot(); const pageActions = refreshButton || drawnActions; - const trailing = (pageActions || shellActions) && ( + const trailing = (pageActions || renderShellGroup) && (
{refreshButton} {drawnActions} - {shellActions && pageActions && ( + {renderShellGroup && pageActions && (
); diff --git a/ui/packages/app-shell/src/layout/ShellPageActions.tsx b/ui/packages/app-shell/src/layout/ShellPageActions.tsx index 046aab25b2f..97d2d50e404 100644 --- a/ui/packages/app-shell/src/layout/ShellPageActions.tsx +++ b/ui/packages/app-shell/src/layout/ShellPageActions.tsx @@ -7,7 +7,9 @@ * every in-app page — a list, a record, a dashboard, a report, a custom page. * * The SHELL decides whether it is drawn, not the page: `ConsoleLayout` mounts - * `ShellPageActionsScope`, and each page's header draws `` + * `ShellPageActionsScope`, which hands the group to the headers through the + * slot in `shellPageActionsSlot.ts` (a header imports the slot, never this + * module and its metadata, Studio and AI reads), and each header draws it * where its top-right is — the console `PageHeader` after the page's own * actions (reports and every custom page draw that header too), the record * page's navigation row before its ✕. @@ -37,7 +39,11 @@ import { matchAppBySegment, appStudioRoutePath } from '../utils/index.js'; import { useStudioEntryGate, type StudioEntry } from '../hooks/useStudioDesignGate.js'; import { useServedAppLabel } from '../hooks/useServedAppLabel.js'; import { useAiSurfaceEnabled } from '../hooks/useAiSurface.js'; -import { usePhoneViewport } from '../hooks/usePhoneViewport.js'; +import { + ShellPageActionsSlotContext, + useShellPageActionsSlot, + type ShellPageActionsSlotProps, +} from './shellPageActionsSlot.js'; import { AssistantTopBarButton } from './AssistantTopBarButton.js'; import { HelpMenu } from './HelpMenu.js'; @@ -61,19 +67,23 @@ export function readShellPageActionsSwitch(): boolean { } } -const ShellPageActionsContext = React.createContext(false); - -/** The shell's decision for the pages under it. `on` absent: the switch's answer. */ +/** + * The shell's decision for the pages under it. `on` absent: the switch's + * answer. On, it hands the group to the headers through the slot + * (`shellPageActionsSlot.ts`), so a header never imports the group itself. + */ export function ShellPageActionsScope({ on, children }: { on?: boolean; children: React.ReactNode }) { const [switched] = React.useState(readShellPageActionsSwitch); - return {children}; + return ( + + {children} + + ); } /** Whether the group is drawn here: inside a scope that turned it on, and not on a phone. */ export function useShellPageActionsOn(): boolean { - const on = React.useContext(ShellPageActionsContext); - const phone = usePhoneViewport(); - return on && !phone; + return useShellPageActionsSlot() !== null; } /** @@ -148,19 +158,17 @@ function EditAppButton({ entry, appText }: { entry: StudioEntry; appText: string ); } -export interface ShellPageActionsProps { - /** - * The comments entry, first in the group: handed by the list and record - * pages only, nothing until the comments work puts its icon here. - */ - comments?: React.ReactNode; -} +export type ShellPageActionsProps = ShellPageActionsSlotProps; /** The group, where the shell turned it on; nothing anywhere else. */ export function ShellPageActions({ comments }: ShellPageActionsProps) { - const on = useShellPageActionsOn(); - if (!on) return null; - return ; + const renderGroup = useShellPageActionsSlot(); + return renderGroup ? renderGroup({ comments }) : null; +} + +/** The slot's value while the group is on: one stable function, never remade. */ +function renderShellPageActionsGroup(props: ShellPageActionsSlotProps): React.ReactNode { + return ; } function ShellPageActionsGroup({ comments }: ShellPageActionsProps) { diff --git a/ui/packages/app-shell/src/layout/shellPageActionsSlot.ts b/ui/packages/app-shell/src/layout/shellPageActionsSlot.ts new file mode 100644 index 00000000000..e426eddf98a --- /dev/null +++ b/ui/packages/app-shell/src/layout/shellPageActionsSlot.ts @@ -0,0 +1,43 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The shell's top-right button group as the page headers see it + * (objectstack#36111): a slot, not an import of the group. + * + * The headers that place the group (the console `PageHeader`, the list's view + * bar, the record page's navigation row) are imported by pages that run + * outside the console shell too: a page bundled on its own, a test that + * mounts one bare. The group itself reads the app's metadata, the Studio + * gate, the AI surface and the help menu's docs, so importing it from a + * header would drag all of that into every one of those pages. The shell + * hands the group in through this context instead (`ShellPageActionsScope`, + * in `ShellPageActions.tsx`); a header reads it here, which imports nothing + * but React and the phone breakpoint. + * + * `null` (outside a scope, the scope turned off, or a phone): the header + * draws nothing for the group. + */ + +import * as React from 'react'; +import { usePhoneViewport } from '../hooks/usePhoneViewport.js'; + +export interface ShellPageActionsSlotProps { + /** + * The comments entry, first in the group: handed by the list and record + * pages only, nothing until the comments work puts its icon here. + */ + comments?: React.ReactNode; +} + +/** Draws the group with the header's comments entry. */ +export type ShellPageActionsRender = (props: ShellPageActionsSlotProps) => React.ReactNode; + +/** The group the shell turned on for the pages under it; `null` when off. */ +export const ShellPageActionsSlotContext = React.createContext(null); + +/** The group to draw here: the shell's, unless it is off or this is a phone. */ +export function useShellPageActionsSlot(): ShellPageActionsRender | null { + const renderGroup = React.useContext(ShellPageActionsSlotContext); + const phone = usePhoneViewport(); + return renderGroup && !phone ? renderGroup : null; +} diff --git a/ui/packages/app-shell/src/views/RecordDetailView.tsx b/ui/packages/app-shell/src/views/RecordDetailView.tsx index 73f59cbda69..b9d5b763439 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.tsx @@ -65,7 +65,7 @@ import { actionContextOrg } from '../utils/actionContextOrg.js'; import { editFormLockedByState } from '../utils/editFormLockedByState.js'; import { matchAppBySegment, resolveHostAppSegment } from '../utils/appRoute.js'; import { hostInConsolePath } from '../utils/hostInConsolePath.js'; -import { ShellPageActions, useShellPageActionsOn } from '../layout/ShellPageActions.js'; +import { useShellPageActionsSlot } from '../layout/shellPageActionsSlot.js'; import { recycleBinRefusalLabelsOf, recycleBinRestoreOf } from '../utils/recycleBinRestore.js'; import { launchConsoleFlow } from '../utils/flowLaunch.js'; import type { TranslateFn } from '@object-ui/i18n'; @@ -974,7 +974,8 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // this page (off while the top bar stands); the page face draws it in its // navigation row, before ✕. A pane or drawer never does: the page under it // has the group already. - const shellActions = useShellPageActionsOn() && !embedded; + const renderShellGroup = useShellPageActionsSlot(); + const shellActions = renderShellGroup !== null && !embedded; // `language` is also the language a flow launch reads a refused write's // permission line in. const { t, language } = useObjectTranslation(); @@ -5401,7 +5402,7 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri const closePage = pageReturn.toList ?? (objectListPath ? () => navigate(objectListPath) : undefined); const pageFrame = closePage || shellActions ? ( <> - {shellActions && } + {shellActions && renderShellGroup?.({})} {closePage && ( diff --git a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx index 29fc6869927..ca744b341fc 100644 --- a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx +++ b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx @@ -28,7 +28,7 @@ import type { useObjectLabel, useObjectTranslation } from '@object-ui/i18n'; import { FavoriteMenuItem } from '../layout/SidebarItemMenu.js'; import type { useObjectListFavorite } from '../layout/SidebarItemMenu.js'; import { PageHeader } from '../layout/PageHeader.js'; -import { ShellPageActions, useShellPageActionsOn } from '../layout/ShellPageActions.js'; +import { useShellPageActionsSlot } from '../layout/shellPageActionsSlot.js'; import { ManagedByBadge } from '../components/ManagedByBadge.js'; import { EnvironmentListToolbar } from '../environment/EnvironmentListToolbar.js'; import { ListHeaderActionBar } from './objectViewHeaderLaunchGate.js'; @@ -177,7 +177,6 @@ export function ObjectViewPageHeader(props: ObjectViewPageBarProps) { setPageColumn(el?.parentElement ?? null); }, []); useListPageScope(pageColumn); - const shellActions = useShellPageActionsOn(); return (
(`[${OBJECT_VIEW_PAGE_COLUMN_ATTR}]`) ?? null); }, []); useListPageScope(pageColumn); - const shellActions = useShellPageActionsOn(); + const renderShellGroup = useShellPageActionsSlot(); return (
- {shellActions && ( + {renderShellGroup && ( <>