Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/36111-page-header-shell-actions.md
Original file line number Diff line number Diff line change
@@ -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 (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.
4 changes: 3 additions & 1 deletion examples/app-showcase/src/ui/pages/my-work.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.' } },
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion examples/app-showcase/src/ui/pages/project-workspace.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
147 changes: 16 additions & 131 deletions ui/packages/app-shell/src/layout/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -86,25 +81,21 @@ 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';
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';
Expand All @@ -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';

Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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<Array<{ name: string; label?: string; _packageId?: string }> | 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).
Expand Down Expand Up @@ -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
Expand All @@ -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', {
Expand Down Expand Up @@ -1217,72 +1159,15 @@ export function AppHeader({
objectstack#34608: it opens and closes the drawer in place. */}
{aiEnabled && <AssistantTopBarButton />}

{/* 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. */}
<DropdownMenu onOpenChange={(open) => { if (open) void loadHelpDocs(); }}>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
size="icon"
className="h-8 w-8 hidden md:flex shrink-0"
aria-label={t('sidebar.helpTooltip', { defaultValue: 'Help & Documentation' })}
>
<HelpCircle className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="min-w-56 rounded-lg" sideOffset={4}>
{currentAppDocs.length > 0 && currentAppPackageId ? (
<DropdownMenuItem
className="cursor-pointer"
onClick={() =>
leaveTo(
currentAppDocs.length === 1
? `/apps/${currentAppPackageId}/docs/${currentAppDocs[0].name}`
: `/apps/${currentAppPackageId}/docs`,
)
}
>
<BookOpen className="mr-2 h-4 w-4" />
{t('help.appDocs', { defaultValue: "This app's docs" })}
</DropdownMenuItem>
) : null}
<DropdownMenuItem className="cursor-pointer" onClick={() => leaveTo('/docs')}>
<Layers className="mr-2 h-4 w-4" />
{t('help.allDocs', { defaultValue: 'All documentation' })}
</DropdownMenuItem>
{isApp ? (
<DropdownMenuItem
className="cursor-pointer"
data-testid="action:keyboard-shortcuts:open"
onClick={openShortcuts}
>
<Keyboard className="mr-2 h-4 w-4" />
{t('help.keyboardShortcuts', { defaultValue: 'Keyboard shortcuts' })}
</DropdownMenuItem>
) : null}
<DropdownMenuSeparator />
<DropdownMenuItem asChild className="cursor-pointer">
<a href="https://docs.objectstack.ai" target="_blank" rel="noopener noreferrer">
<ExternalLink className="mr-2 h-4 w-4" />
{t('help.onlineDocs', { defaultValue: 'Online documentation' })}
</a>
</DropdownMenuItem>
{/* About — names the console's own build, on every variant
(objectui#12970). */}
<DropdownMenuItem
className="cursor-pointer"
data-testid="action:about:open"
onClick={() => setAboutOpen(true)}
>
<Info className="mr-2 h-4 w-4" />
{t('help.about', { defaultValue: 'About' })}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<AboutDialog open={aboutOpen} onOpenChange={setAboutOpen} build={getConsoleBuild()} />
{/* 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. */}
<HelpMenu
inApp={isApp}
appPackageId={currentAppPackageId}
triggerClassName="h-8 w-8 hidden md:flex shrink-0"
/>
</div>

{/* Group 3: Account (theme + lang moved into avatar dropdown) */}
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/app-shell/src/layout/ConsoleLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -313,6 +314,10 @@ export function ConsoleLayout({
}
>
<ConsoleLayoutInner>
{/* 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. */}
<ShellPageActionsScope>
{/* 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
Expand Down Expand Up @@ -348,6 +353,7 @@ export function ConsoleLayout({
>
{children}
</div>
</ShellPageActionsScope>
</ConsoleLayoutInner>

{/* objectstack#35882 — the phone's bottom bar, after the page in reading order. */}
Expand Down
Loading
Loading