From ca7974fed56e949824ea802bb29cbfdb4502d426 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 09:14:14 +0000 Subject: [PATCH 1/8] feat(ui): the object's colour tile replaces the line icon in list and data headers, search, recents, pointers, hover cards, related lists and the studio Claude-Session: https://claude.ai/code/session_01L6bhgWCsFBKwcq7ocDfUhR Co-authored-by: Claude --- .../app-shell/src/chrome/CommandPalette.tsx | 32 ++++++++++---- .../app-shell/src/console/home/HomePage.tsx | 8 ++-- .../app-shell/src/console/home/HomeRail.tsx | 29 +++++++++---- .../app-shell/src/layout/PageHeader.tsx | 20 ++++++--- .../app-shell/src/views/ObjectDataPage.tsx | 5 ++- .../app-shell/src/views/SearchResultsPage.tsx | 16 ++++--- .../src/views/global-search-renderer.tsx | 6 +-- .../src/views/objectViewPageHeader.tsx | 19 ++++----- .../views/studio-design/InterfacesNavRail.tsx | 20 +++++++-- .../studio-design/StudioDesignSurface.tsx | 42 +++++++++++++++---- .../views/studio-design/StudioItemHeader.tsx | 14 ++++++- .../src/views/studio-design/navSurface.ts | 2 + ui/packages/fields/src/RecordHoverCard.tsx | 15 ++++--- ui/packages/plugin-detail/src/RelatedList.tsx | 13 +++--- .../plugin-grid/src/RecordPointerCell.tsx | 11 +++-- .../react/src/hooks/useRecordSearch.ts | 4 ++ 16 files changed, 176 insertions(+), 80 deletions(-) diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.tsx index 35bcc9e44c1..e566abe5533 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.tsx @@ -35,6 +35,7 @@ import { CommandItem, CommandList, CommandSeparator, + ObjectIconTile, } from '@object-ui/components'; import { LayoutDashboard, @@ -70,6 +71,7 @@ import { resolveHref, resolveNavItemLabel } from '@object-ui/layout'; import type { NavigationItem } from '@object-ui/types'; import { findByName, useNavTargetLabel, type NavTargetLabelOptions } from '../hooks/useNavTargetLabel.js'; import { readObjectsByName } from '../hooks/useObjectPresence.js'; +import { useNavTargetColor } from '../hooks/useNavTargetIcon.js'; import { useAuth } from '@object-ui/auth'; import { matchesPaletteQuery } from './paletteMatch.js'; @@ -411,15 +413,19 @@ function CommandPaletteBody(props: CommandPaletteProps & { gates: NavMemberGates */ const metadata = useMetadata(); const recentTargetLabel = useNavTargetLabel(RECENT_ROW_LABELS); - const recentContext = (item: RecentItem): { type?: string; icon?: string } => { + const recentContext = (item: RecentItem): { objectName?: string; type?: string; icon?: string; color?: string } => { const objectName = recentItemObject(item); if (!objectName) return {}; - const def = findByName(readObjectsByName(metadata, [objectName]), objectName) as { icon?: unknown } | undefined; + const def = findByName(readObjectsByName(metadata, [objectName]), objectName) as { icon?: unknown; color?: unknown } | undefined; return { + objectName, type: recentTargetLabel({ kind: 'object', objectName }) ?? objectName, icon: typeof def?.icon === 'string' && def.icon !== '' ? def.icon : undefined, + color: typeof def?.color === 'string' ? def.color : undefined, }; }; + // objectstack#35985 — an object entry draws the object's tile, in its colour. + const navTargetColor = useNavTargetColor(); // Index object defs by name so group headings can resolve the object's // localized label (labels may be `{ key, defaultValue }` i18n objects, which @@ -440,7 +446,7 @@ function CommandPaletteBody(props: CommandPaletteProps & { gates: NavMemberGates const order: string[] = []; const byObject = new Map< string, - { objectLabel: string; icon?: string; hits: typeof recordHits } + { objectLabel: string; icon?: string; color?: string; hits: typeof recordHits } >(); for (const hit of recordHits) { let group = byObject.get(hit.objectName); @@ -449,7 +455,12 @@ function CommandPaletteBody(props: CommandPaletteProps & { gates: NavMemberGates // label (already objectName when the def had no string label). const objDef = objectsByName.get(hit.objectName); const label = resolveKeyedI18nLabel(objDef?.label, t) || hit.objectLabel; - group = { objectLabel: label, icon: hit.icon, hits: [] }; + group = { + objectLabel: label, + icon: hit.icon, + color: typeof objDef?.color === 'string' ? objDef.color : hit.color, + hits: [], + }; byObject.set(hit.objectName, group); order.push(hit.objectName); } @@ -503,7 +514,7 @@ function CommandPaletteBody(props: CommandPaletteProps & { gates: NavMemberGates heading={t('console.commandPalette.recentRecords', { defaultValue: 'Recently viewed' })} > {recentRecords.map((item) => { - const { type, icon } = recentContext(item); + const { objectName, type, icon, color } = recentContext(item); const Icon = icon ? getIcon(icon) : FileText; return ( leaveTo(item.href)} > - + {objectName ? ( + + ) : ( + + )} {recentLabel(item)} {type && ( leaveTo(`${recordHitBaseUrl(hit.objectName)}/${hit.objectName}/record/${hit.recordId}`)} > - + {hit.display} {hit.subtitle && ( @@ -574,13 +589,14 @@ function CommandPaletteBody(props: CommandPaletteProps & { gates: NavMemberGates {objectItems .map(item => { const Icon = getIcon(item.icon); + const color = item.objectName ? navTargetColor({ kind: 'object', objectName: item.objectName }) : undefined; return ( leaveTo(resolveHref(item, baseUrl, templateContext).href)} > - + {navLabel(item)} ); diff --git a/ui/packages/app-shell/src/console/home/HomePage.tsx b/ui/packages/app-shell/src/console/home/HomePage.tsx index 5ca20464e50..b038e858d3e 100644 --- a/ui/packages/app-shell/src/console/home/HomePage.tsx +++ b/ui/packages/app-shell/src/console/home/HomePage.tsx @@ -615,12 +615,13 @@ export function HomePage({ checklist }: HomePageProps = {}) { icon: undefined, }; } - const objectIcon = + const objectDef = item.type === 'record' && objectName - ? (readObjectsByName(metadata, [objectName]) as Array<{ name?: unknown; icon?: unknown } | null | undefined>).find( + ? (readObjectsByName(metadata, [objectName]) as Array<{ name?: unknown; icon?: unknown; color?: unknown } | null | undefined>).find( (o) => o?.name === objectName, - )?.icon + ) : undefined; + const objectIcon = objectDef?.icon; return { context: item.type === 'record' && objectName @@ -628,6 +629,7 @@ export function HomePage({ checklist }: HomePageProps = {}) { : recentItemTypeLabel(t, item.type), app: app ? appLabel(app) : undefined, icon: typeof objectIcon === 'string' && objectIcon !== '' ? objectIcon : undefined, + color: typeof objectDef?.color === 'string' ? objectDef.color : undefined, }; }; diff --git a/ui/packages/app-shell/src/console/home/HomeRail.tsx b/ui/packages/app-shell/src/console/home/HomeRail.tsx index cce64f5dd3a..8b927d6054f 100644 --- a/ui/packages/app-shell/src/console/home/HomeRail.tsx +++ b/ui/packages/app-shell/src/console/home/HomeRail.tsx @@ -18,7 +18,7 @@ import { FileText, Database, LayoutDashboard, File, List, CircleAlert, Rocket, Lock, } from 'lucide-react'; import { useDisplayLocale } from '@object-ui/i18n'; -import { Button, cn } from '@object-ui/components'; +import { Button, cn, ObjectIconTile } from '@object-ui/components'; import type { ActivityFeedReading } from '../../hooks/sharedUserFeeds.js'; import type { HomeInboxStatus, HomeNotification, PendingApprovalRequest } from '../../hooks/useHomeInbox.js'; import type { RecentItem } from '../../hooks/useRecentItems.js'; @@ -484,6 +484,11 @@ export interface RecentItemContext { app?: string; /** A record's object icon (a Lucide name), or `undefined` to draw the kind's icon. */ icon?: string; + /** + * A record's object palette colour (`ObjectSchema.color`): with `icon`, the + * row draws the object's tile in that colour (objectstack#35985). + */ + color?: string; } /** @@ -524,7 +529,7 @@ export function HomeContinue({ ) : (
    {items.map((it) => { - const { context, app, icon } = describe(it); + const { context, app, icon, color } = describe(it); const Icon = icon ? getIcon(icon) : RECENT_ICON[it.type] || FileText; const trail = [context, app, timeAgo(it.visitedAt, displayLocale)].filter(Boolean).join(' · '); return ( @@ -536,13 +541,19 @@ export function HomeContinue({ data-recent-type={it.type} className="flex h-10 w-full items-center gap-2.5 px-3 text-left text-[13px] transition-colors hover:bg-muted/60 max-sm:h-11" > - - - + {icon ? ( + + + + ) : ( + + + + )} {labelOf(it)} {trail} diff --git a/ui/packages/app-shell/src/layout/PageHeader.tsx b/ui/packages/app-shell/src/layout/PageHeader.tsx index d43f13e4aac..f2f0b9b6f6e 100644 --- a/ui/packages/app-shell/src/layout/PageHeader.tsx +++ b/ui/packages/app-shell/src/layout/PageHeader.tsx @@ -117,6 +117,13 @@ export interface ConsolePageHeaderProps { * the chip will scale child `` elements to fit. */ icon?: React.ReactNode; + /** + * A leading icon that draws its own square — an object's `ObjectIconTile` + * (objectstack#35985), so the page names its object in the colour the menu + * draws it in. Drawn as given, in every posture, in place of `icon`: no + * accent chip around it and no forced glyph size inside it. + */ + iconTile?: React.ReactNode; /** * The page's kind chip, drawn right after the title (objectui#12606) — the * `ManagedByBadge` of a `sys_*` list, a metadata type's writability badge. @@ -208,6 +215,7 @@ export function PageHeader({ title, subtitle, icon, + iconTile, badge, breadcrumb, refresh, @@ -297,14 +305,14 @@ export function PageHeader({ {list ? (
    - {/* One line at 13px: the object's icon in one colour (the object - model carries no colour, objectstack#35547), its name, its kind. */} + {/* One line at 13px: the object's icon (its tile, objectstack#35985), + its name, its kind. */}
    - {icon && ( + {iconTile ?? (icon && ( {icon} - )} + ))}

    {title}

    @@ -315,7 +323,7 @@ export function PageHeader({ ) : setup ? (
    - {icon && {icon}} + {iconTile ?? (icon && {icon})}

    @@ -347,7 +355,7 @@ export function PageHeader({ (objectui#12553). It sits here, not on the padded row above: under `border-box` a min-height there would count that row's padding. */}
    - {icon && {icon}} + {iconTile ?? (icon && {icon})} {/* The 60 % cap keeps room for the description beside the title; the compact form draws none, so its title takes the whole row (objectstack#35446). */} diff --git a/ui/packages/app-shell/src/views/ObjectDataPage.tsx b/ui/packages/app-shell/src/views/ObjectDataPage.tsx index 42926e08589..995553948ab 100644 --- a/ui/packages/app-shell/src/views/ObjectDataPage.tsx +++ b/ui/packages/app-shell/src/views/ObjectDataPage.tsx @@ -41,6 +41,7 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, + ObjectIconTile, } from '@object-ui/components'; import { Database, Lock, MoreHorizontal, Plus, RotateCcw, Save, X } from 'lucide-react'; import { toast } from 'sonner'; @@ -68,7 +69,6 @@ import { } from './InterfaceListPage.js'; import { RecordDetailView } from './RecordDetailView.js'; import { PageHeader } from '../layout/PageHeader.js'; -import { getIcon } from '../utils/getIcon.js'; import { useMetadataClient } from './metadata-admin/useMetadata.js'; import { createRuntimeMetadata, viewEnvelope } from './runtime-metadata-persistence.js'; import { useRuntimeCreateApp } from './objectViewViewCrud.js'; @@ -729,7 +729,8 @@ export function ObjectDataPage({ dataSource, objects }: any) { subtitle={t('console.objectData.description', { defaultValue: 'URL-defined data slice — not bound to any saved view.', })} - icon={React.createElement(getIcon((objectDef as any)?.icon), { className: 'h-4 w-4' })} + // The object's tile, in the colour the menu draws it in (objectstack#35985). + iconTile={} actions={ <> {newButton} diff --git a/ui/packages/app-shell/src/views/SearchResultsPage.tsx b/ui/packages/app-shell/src/views/SearchResultsPage.tsx index 2449ecdd765..a633ff9ac63 100644 --- a/ui/packages/app-shell/src/views/SearchResultsPage.tsx +++ b/ui/packages/app-shell/src/views/SearchResultsPage.tsx @@ -14,6 +14,7 @@ import { Card, CardContent, Badge, + ObjectIconTile, } from '@object-ui/components'; import { Search, @@ -183,14 +184,19 @@ export function SearchResultsPage() { const order: string[] = []; const byObject = new Map< string, - { label: string; icon?: string; hits: typeof recordHits } + { label: string; icon?: string; color?: string; hits: typeof recordHits } >(); for (const hit of recordHits) { let group = byObject.get(hit.objectName); if (!group) { const objDef = objectsByName.get(hit.objectName); const label = resolveKeyedI18nLabel(objDef?.label, t) || hit.objectLabel; - group = { label, icon: objDef?.icon ?? hit.icon, hits: [] }; + group = { + label, + icon: objDef?.icon ?? hit.icon, + color: typeof objDef?.color === 'string' ? objDef.color : hit.color, + hits: [], + }; byObject.set(hit.objectName, group); order.push(hit.objectName); } @@ -273,7 +279,7 @@ export function SearchResultsPage() { return (

    - + {group.label} {group.hits.length} @@ -290,9 +296,7 @@ export function SearchResultsPage() { > -
    - -
    +

    {hit.display}

    {hit.subtitle && ( diff --git a/ui/packages/app-shell/src/views/global-search-renderer.tsx b/ui/packages/app-shell/src/views/global-search-renderer.tsx index e33fdf6a926..164ffc45d40 100644 --- a/ui/packages/app-shell/src/views/global-search-renderer.tsx +++ b/ui/packages/app-shell/src/views/global-search-renderer.tsx @@ -56,7 +56,7 @@ import { Link, useParams } from 'react-router-dom'; import { ComponentRegistry } from '@object-ui/core'; import { useRecordSearch, useMetadata, useAdapter } from '@object-ui/react'; import { usePermissions } from '@object-ui/permissions'; -import { Input, Card, CardContent, Badge } from '@object-ui/components'; +import { Input, Card, CardContent, Badge, ObjectIconTile } from '@object-ui/components'; import { Search } from 'lucide-react'; import { useObjectTranslation } from '@object-ui/i18n'; import { getIcon } from '../utils/getIcon.js'; @@ -169,9 +169,7 @@ export const GlobalSearchRenderer: React.FC = ({ > -
    - -
    +

    {hit.display}

    {hit.subtitle && ( diff --git a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx index f7ced1166ca..b947a28e7be 100644 --- a/ui/packages/app-shell/src/views/objectViewPageHeader.tsx +++ b/ui/packages/app-shell/src/views/objectViewPageHeader.tsx @@ -1,7 +1,7 @@ /** * The page bar of the Console `ObjectView` (`./ObjectView.tsx`), 44px tall - * (objectstack#35548, `PageHeader`'s list posture): the object's icon in one - * colour and its plural name with the managed-by badge on the left; on the + * (objectstack#35548, `PageHeader`'s list posture): the object's icon tile + * (objectstack#35985) and its plural name with the managed-by badge on the left; on the * right the schema-driven toolbar, the ⋮ menu and the create button, or their * folded face. The view switcher is not here: it leads the list's view bar. * The ⋮ menu holds what is not used every time: the object's description, @@ -10,7 +10,7 @@ * value is passed in as a prop. */ -import { createContext, createElement, useCallback, useContext, useLayoutEffect, useState } from 'react'; +import { createContext, useCallback, useContext, useLayoutEffect, useState } from 'react'; import type { Dispatch, ReactNode, SetStateAction } from 'react'; import { Button, @@ -21,12 +21,12 @@ import { DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, + ObjectIconTile, } from '@object-ui/components'; import { Upload, MoreVertical } from 'lucide-react'; import type { useObjectLabel, useObjectTranslation } from '@object-ui/i18n'; import { FavoriteMenuItem } from '../layout/SidebarItemMenu.js'; import type { useObjectListFavorite } from '../layout/SidebarItemMenu.js'; -import { getIcon } from '../utils/getIcon.js'; import { PageHeader } from '../layout/PageHeader.js'; import { ManagedByBadge } from '../components/ManagedByBadge.js'; import { EnvironmentListToolbar } from '../environment/EnvironmentListToolbar.js'; @@ -207,10 +207,9 @@ export function ObjectViewPageHeader(props: ObjectViewPageBarProps) { // The kind chip, in the header's own slot after the title // (objectui#12606). badge={} - // `createElement`, not a JSX tag: the looked-up icon is a value, - // which react-hooks/static-components refuses in tag position - // (the convention ObjectDataPage set). - icon={createElement(getIcon((objectDef as any)?.icon), { className: 'h-4 w-4' })} + // The object's tile, in the colour the menu draws it in + // (objectstack#35985). + iconTile={} actions={} foldedActions={foldedHeaderActions} compactBelow={LIST_HEADER_COMPACT_WIDTH} @@ -255,9 +254,7 @@ export function ObjectViewBarObjectName({ }: Pick) { return ( - + {/* The page's heading: the page bar that held the `h1` is not drawn. */}

    {objectPluralLabel(objectDef)} diff --git a/ui/packages/app-shell/src/views/studio-design/InterfacesNavRail.tsx b/ui/packages/app-shell/src/views/studio-design/InterfacesNavRail.tsx index 79d3d455fb7..8b41f36fe9f 100644 --- a/ui/packages/app-shell/src/views/studio-design/InterfacesNavRail.tsx +++ b/ui/packages/app-shell/src/views/studio-design/InterfacesNavRail.tsx @@ -9,7 +9,7 @@ import * as React from 'react'; import { StudioRailGroup, StudioRailRow } from './StudioRail.js'; -import { Badge, Popover, PopoverContent, PopoverTrigger, Separator, cn } from '@object-ui/components'; +import { Badge, ObjectIconTile, Popover, PopoverContent, PopoverTrigger, Separator, cn } from '@object-ui/components'; import { FileText, Database, @@ -127,6 +127,7 @@ function NavTreeGroup({ active, onPick, objectIcons, + objectColors, depth, }: { node: NavNode; @@ -134,6 +135,7 @@ function NavTreeGroup({ active: Surface | null; onPick: (s: Surface) => void; objectIcons?: Record; + objectColors?: Record; depth: number; }): React.ReactElement { const locale = useMetadataLocale(); @@ -167,7 +169,7 @@ function NavTreeGroup({ ) : ( <> {children.length > 0 && ( - + )} {/* objectstack#29786 — what other packages add to this group, after the group's own entries, as the served navigation appends them. */} @@ -276,6 +278,7 @@ export function NavTree({ active, onPick, objectIcons, + objectColors, depth = 0, }: { nodes: NavNode[]; @@ -283,6 +286,8 @@ export function NavTree({ onPick: (s: Surface) => void; /** object name → its metadata icon, so object nav items show their own glyph. */ objectIcons?: Record; + /** object name → its palette colour: an object nav item draws its object's tile (objectstack#35985). */ + objectColors?: Record; /** Nesting depth: a row under a group header is indented one step. */ depth?: number; }): React.ReactElement { @@ -323,6 +328,7 @@ export function NavTree({ active={active} onPick={onPick} objectIcons={objectIcons} + objectColors={objectColors} depth={depth} /> ); @@ -369,7 +375,15 @@ export function NavTree({ : rowText || undefined } className="disabled:opacity-40" - icon={} + // objectstack#35985 — an object entry draws its object's tile: the + // glyph as above, the colour always the object's (as the menu). + icon={ + surface?.type === 'object' ? ( + + ) : ( + + ) + } trailing={ <> {/* objectui#11791 — the spec's `badge` / `badgeVariant`, drawn diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx index 26b003fe1eb..b8e19b0805a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -195,6 +195,7 @@ import { TooltipContent, TooltipProvider, TooltipTrigger, + ObjectIconTile, } from '@object-ui/components'; import { ObjectView as PluginObjectView } from '@object-ui/plugin-view'; import { ListView } from '@object-ui/plugin-list'; @@ -2589,13 +2590,18 @@ export function InterfacesPillar({ const openContributor = useOpenContributor(); // Objects in THIS package (published ∪ draft) — the nav item inspector's // object picker, so nav can be wired to sibling objects before publishing. - const [pkgObjects, setPkgObjects] = React.useState>( + const [pkgObjects, setPkgObjects] = React.useState>( [], ); const objectIconMap = React.useMemo( () => Object.fromEntries(pkgObjects.map((o) => [o.name, o.icon])), [pkgObjects], ); + // objectstack#35985 — an object's palette colour, for its tile. + const objectColorMap = React.useMemo( + () => Object.fromEntries(pkgObjects.map((o) => [o.name, o.color])), + [pkgObjects], + ); // objectui#12508 — the package's draft-only objects (a pending draft, no // published row), stamped with the publish they were read under: the // list-view buffer skips `/layers` for a view of one of them. @@ -2628,13 +2634,18 @@ export function InterfacesPillar({ railPairId ? client.listDrafts({ packageId: railPairId, type: 'object' }).catch(noRows) : noRows(), ]); if (cancelled) return; - const byName = new Map(); + const byName = new Map(); const baseRows = [...(pub || []), ...(drafts || [])]; for (const raw of [...baseRows, ...(pairPub || []), ...(pairDrafts || [])]) { const o = raw as Record; const name = String(o.name ?? ''); if (!name || byName.has(name)) continue; - const row = { name, label: String(o.label ?? o.name ?? name), icon: o.icon ? String(o.icon) : undefined }; + const row = { + name, + label: String(o.label ?? o.name ?? name), + icon: o.icon ? String(o.icon) : undefined, + color: typeof o.color === 'string' ? o.color : undefined, + }; // Held by the pair only: the entry bound to it gates on it (`requiresObject`). byName.set(name, baseRows.includes(raw) ? row : { ...row, pair: true }); } @@ -4443,6 +4454,7 @@ export function InterfacesPillar({ } icon={ifHeaderIcon} + objectTile={current?.type === 'object' ? { color: objectColorMap[current.name] } : undefined} title={ current ? ( <> @@ -5401,7 +5413,7 @@ export function InterfacesPillar({

    ) : ( <> - + {/* objectstack#29786 — contributed entries the app's top level holds: those naming no group, and those naming a group the app does not declare (the served navigation appends both). */} @@ -6099,7 +6111,13 @@ export function DataPillar({ client.listDrafts({ packageId: railPairId, type: 'object' }).catch(() => []), ]); const rows: Surface[] = (pairList || []) - .map((o) => ({ type: 'object', name: String(o.name ?? ''), label: String(o.label ?? o.name ?? ''), icon: o.icon ? String(o.icon) : undefined })) + .map((o) => ({ + type: 'object', + name: String(o.name ?? ''), + label: String(o.label ?? o.name ?? ''), + icon: o.icon ? String(o.icon) : undefined, + color: typeof o.color === 'string' ? o.color : undefined, + })) .filter((o) => o.name); const seen = new Set(rows.map((o) => o.name)); for (const d of pairDrafts as Array<{ name?: string | null; label?: I18nLabel | null }>) { @@ -6118,7 +6136,13 @@ export function DataPillar({ ]); if (cancelled) return; const baseItems: Surface[] = (list || []) - .map((o) => ({ type: 'object', name: String(o.name ?? ''), label: String(o.label ?? o.name ?? ''), icon: o.icon ? String(o.icon) : undefined })) + .map((o) => ({ + type: 'object', + name: String(o.name ?? ''), + label: String(o.label ?? o.name ?? ''), + icon: o.icon ? String(o.icon) : undefined, + color: typeof o.color === 'string' ? o.color : undefined, + })) .filter((o) => o.name); const known = new Set(baseItems.map((o) => o.name)); for (const d of draftHeaders) { @@ -7331,6 +7355,9 @@ export function DataPillar({ const HeaderIcon = getIcon( objLoaded && typeof objDraft.icon === 'string' ? (objDraft.icon as string) : current?.icon, ); + // objectstack#35985 — and its palette colour, so the header draws the tile + // the console's menu draws for it; the draft's, as it is being edited. + const headerColor = objLoaded && typeof objDraft.color === 'string' ? (objDraft.color as string) : current?.color; // objectui#12459 — the object's tab row lives in the item header (the // skeleton's scaffold). objectui#12450 — seven flat tabs at a content column @@ -7478,7 +7505,7 @@ export function DataPillar({ // sent first, or the author is asked (`openObject`). if (openObject(o) && isMobile) setRailOpen(false); }} - icon={} + icon={} trailing={} > {o.label} @@ -7520,6 +7547,7 @@ export function DataPillar({ } icon={current ? HeaderIcon : undefined} + objectTile={current ? { color: headerColor } : undefined} title={current ? current.label : t('engine.studio.data.objects', locale)} // objectstack#34794 — the object's machine name is the title's // tooltip, not a chip beside it: the header reads as the label diff --git a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx index 73d8c92de83..32d98603285 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx @@ -73,6 +73,7 @@ import { TooltipContent, TooltipProvider, TooltipTrigger, + ObjectIconTile, } from '@object-ui/components'; import { STUDIO_API_CHIP, @@ -590,6 +591,12 @@ function useTitleRowFold( export interface StudioItemHeaderProps { /** The icon component for the tile; omitted when the pillar has nothing open. */ icon?: React.ElementType; + /** + * Set when the item is an object (objectstack#35985): the icon is drawn as + * the object's tile, a white glyph on the object's palette colour, as the + * console's menu draws it. Absent: the primary-tinted tile. + */ + objectTile?: { color?: string }; /** The item's label. */ title: React.ReactNode; /** Attributes for the title element (a test id, a tooltip with the machine name). */ @@ -629,6 +636,7 @@ export interface StudioItemHeaderProps { export function StudioItemHeader({ icon: Icon, + objectTile, title, titleProps, apiName, @@ -670,11 +678,13 @@ export function StudioItemHeader({
    {leading} - {Icon && ( + {Icon && objectTile ? ( + + ) : Icon ? ( - )} + ) : null}

    {title}

    diff --git a/ui/packages/app-shell/src/views/studio-design/navSurface.ts b/ui/packages/app-shell/src/views/studio-design/navSurface.ts index 437dd708e95..e4053b7ea40 100644 --- a/ui/packages/app-shell/src/views/studio-design/navSurface.ts +++ b/ui/packages/app-shell/src/views/studio-design/navSurface.ts @@ -40,6 +40,8 @@ export interface Surface { label: string; /** Lucide icon name from the object's metadata (`icon` field); falls back per getIcon. */ icon?: string; + /** The object's palette colour (`ObjectSchema.color`), for its tile (objectstack#35985). */ + color?: string; /** * The nav entry's spec `id` (objectui#11774) — the entry's IDENTITY, which * `{type,name}` is not: an app may hold several entries that open one diff --git a/ui/packages/fields/src/RecordHoverCard.tsx b/ui/packages/fields/src/RecordHoverCard.tsx index 5aa09c73573..18058e86dc8 100644 --- a/ui/packages/fields/src/RecordHoverCard.tsx +++ b/ui/packages/fields/src/RecordHoverCard.tsx @@ -41,7 +41,7 @@ import * as React from 'react'; import { createPortal } from 'react-dom'; -import { HoverCard, HoverCardContent, HoverCardTrigger, LazyIcon, Skeleton } from '@object-ui/components'; +import { HoverCard, HoverCardContent, HoverCardTrigger, ObjectIconTile, Skeleton } from '@object-ui/components'; import { buildExpandFields, getRecordDisplayName, @@ -375,13 +375,12 @@ function RecordHoverCardBody({ aria-busy={pending || undefined} >
    - - + {/* The target object's tile, in its colour (objectstack#35985). */} +
    {name} diff --git a/ui/packages/plugin-detail/src/RelatedList.tsx b/ui/packages/plugin-detail/src/RelatedList.tsx index 19c76044dcc..bb02e17d125 100644 --- a/ui/packages/plugin-detail/src/RelatedList.tsx +++ b/ui/packages/plugin-detail/src/RelatedList.tsx @@ -30,6 +30,7 @@ import { Skeleton, useIsMobile, RelatedCountStore, + ObjectIconTile, } from '@object-ui/components'; import { SchemaRenderer, ActionCtxReact, useCapabilityGate, useCondition, toPredicateInput, useSettledSchema, useFilterScope, useResolvedFilter, usePredicateScope, classifyLoadError, answeredLoadFailure, declaredUserMessage, type LoadErrorKind, type RelatedRowActionDef } from '@object-ui/react'; import { @@ -3610,7 +3611,11 @@ export const RelatedList: React.FC = ({ const headerClassName = isCollapsible ? 'cursor-pointer select-none' : undefined; const handleHeaderClick = isCollapsible ? () => setCollapsed((c) => !c) : undefined; - const SectionIcon = resolveIconComponent(icon); + // The section names the related object by its tile (objectstack#35985): the + // glyph is the list's own `icon`, else the object's; the colour is always + // the object's, so the list looks as the object does in the menu. + const SectionIcon = resolveIconComponent(icon ?? (typeof objectSchema?.icon === 'string' ? objectSchema.icon : undefined)); + const sectionColor = typeof objectSchema?.color === 'string' ? objectSchema.color : undefined; // Badge shows the COLLECTION size: the server total in windowed mode (only // one page is in memory), the loaded row count otherwise. // objectstack#27056 — a compact card counted up front answers from that @@ -3732,8 +3737,7 @@ export const RelatedList: React.FC = ({ - {/* eslint-disable-next-line react-hooks/static-components -- resolveIconComponent returns a stable icon component from a static registry, not a component created during render */} - + {title} @@ -4154,8 +4158,7 @@ export const RelatedList: React.FC = ({ ? () : () )} - {/* eslint-disable-next-line react-hooks/static-components -- resolveIconComponent returns a stable icon component from a static registry, not a component created during render */} - + {title} diff --git a/ui/packages/plugin-grid/src/RecordPointerCell.tsx b/ui/packages/plugin-grid/src/RecordPointerCell.tsx index 460333ecf36..d12a90c645d 100644 --- a/ui/packages/plugin-grid/src/RecordPointerCell.tsx +++ b/ui/packages/plugin-grid/src/RecordPointerCell.tsx @@ -46,7 +46,7 @@ */ import React, { useEffect, useSyncExternalStore } from 'react'; -import { Skeleton, resolveIcon } from '@object-ui/components'; +import { ObjectIconTile, Skeleton, resolveIcon } from '@object-ui/components'; import { buildExpandFields, extractRecords, getRecordDisplayName, resolveNameField, withoutDeniedFields } from '@object-ui/core'; import type { RecordPointer } from '@object-ui/fields'; import { createSafeTranslation } from '@object-ui/i18n'; @@ -73,6 +73,7 @@ interface ObjectDefLike { name?: string; label?: string; icon?: string; + color?: string; [key: string]: unknown; } @@ -326,11 +327,9 @@ export function RecordPointerCell({ pointer, dataSource }: RecordPointerCellProp // bundle only when none is served (objectstack#30390). const typeLabel = def?.label || objectLabel({ name: objectName, label: objectName }); const Icon = def?.icon ? resolveIcon(def.icon) : null; - // The annotation the other `resolveIcon` seam call sites carry: it returns a - // STABLE, cached component per icon name; it does not create one during - // render. The rule cannot see that through a call. - // eslint-disable-next-line react-hooks/static-components - const icon = Icon ?