Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
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
43 changes: 43 additions & 0 deletions .changeset/10827-app-branding-logo-one-spelling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
'@object-ui/types': minor
'@object-ui/layout': patch
'@object-ui/app-shell': patch
'@object-ui/runner': patch
---

An app's `branding.logo` now shows in the console, and it is the only logo spelling
(objectui#10827).

**The console renders it.** The designer (`AppCreationWizard`, `BrandingEditor`) writes an
app's `branding.logo` and previews it, but nothing mounted in the console drew it. Its only
reader was `AppSidebar`, which was never mounted and has since been removed. `UnifiedSidebar`,
the console's sidebar, now reads the active app's `branding.logo` and shows it as an image in a
header at the top of the sidebar. The image's alt text is the app's label. An app without a
logo gets no header, so its sidebar looks the same as before. The header appears only inside
an app. On Home the sidebar's fallback app is not the screen's app, so no logo is shown there.
`AppShellBranding` is unchanged: objectui#4818 removed its `logo` key, and this change does not
add it back.

**One spelling — breaking for a top-level `logo`.** `@objectstack/spec` declares the app logo
only as `branding.logo` (a URL). Its app schema refuses a top-level `logo` and suggests
`branding`. objectui had a second spelling of its own: `AppComponentSchema.logo`, described as
"Logo URL or icon name". This change retires it:

- `@object-ui/types`: `AppComponentSchema.logo` is now `never` on the TypeScript face, and the
zod mirror refuses a top-level `logo` by name, answering "Did you mean `logo` → `branding`?".
It is a named refusal rather than a deletion because the node is `.passthrough()`, and a
deleted key would be kept without any error. `wizardDraftToAppSchema` no longer copies the
draft's logo to the top level. The logo goes into `branding` only.
- `@object-ui/layout`: `AppSchemaRenderer`'s default sidebar header draws `branding.logo` as
an image. This includes site-relative paths and `data:` URIs, which the old read skipped
because it drew an image only for values starting with `http`. The header's icon now comes
from the app's `icon`.
- `@object-ui/runner`: `LayoutRenderer`'s sidebar brand mark does the same. It draws
`branding.logo` as an image and takes an icon name from `icon`. It no longer guesses the kind
of value from a `/` or `.`.

Migration: move a top-level `logo` URL to `branding: { logo: '…' }`. An icon name that was
written as `logo` belongs in `icon`. The published 17.6.0 changelog entry that removed
`AppShellBranding.logo` says the top-level `logo` is "rendered directly by
`AppSchemaRenderer`'s default sidebar header". That is no longer true: the header reads
`branding.logo`.
11 changes: 8 additions & 3 deletions content/docs/core/app-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const app: AppComponentSchema = {
type: 'app',
name: 'my-crm',
title: 'My CRM Application',
logo: '/logo.svg',
branding: { logo: '/logo.svg' },
favicon: '/favicon.ico',
layout: 'sidebar',

Expand Down Expand Up @@ -65,9 +65,14 @@ topic; the declaration remains the complete list.
| `name` | `string` | Application system identifier |
| `title` | `string` | Display title shown in browser |
| `description` | `string` | Application description |
| `logo` | `string` | Logo URL or icon name |
| `icon` | `string` | Lucide icon name |
| `branding.logo` | `string` | Logo image URL (or a `data:` URI) |
| `favicon` | `string` | Favicon URL |

The logo has one spelling, `branding.logo`. A top-level `logo` is refused by the validator and
names `branding` as the fix (objectui#10827): it was a second spelling that `@objectstack/spec`
never declared. For an icon name, use `icon`.

### Layout Configuration

| Property | Type | Default | Description |
Expand Down Expand Up @@ -182,7 +187,7 @@ const crm: AppComponentSchema = {
name: 'acme-crm',
title: 'Acme CRM',
description: 'Customer Relationship Management System',
logo: '/acme-logo.svg',
branding: { logo: '/acme-logo.svg' },
favicon: '/favicon.ico',
layout: 'sidebar',

Expand Down
6 changes: 6 additions & 0 deletions content/docs/guide/console-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ light-mode HSL triple and does not follow the light/dark toggle, whereas `--prim
`--accent` carry the mode-adjusted value. Theme against the Shadcn tokens; treat the
`--brand-*` names as an alias kept for whatever already consumes it.

**The app's logo is not part of that object.** `AppShellBranding` carries theme values and the
tab title only. An app's `branding.logo` (an image URL — the one logo spelling the app schema
declares) is drawn by `UnifiedSidebar`, which already resolves the active app: a header at the top
of the sidebar shows the image, with the app's label as its alt text. An app without a
`branding.logo` gets no header, so its sidebar is unchanged.

## Development Mode

There is **no bundled mock backend** — offline development is not a thing here. In dev exactly as
Expand Down
19 changes: 17 additions & 2 deletions packages/app-shell/src/layout/UnifiedSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { useRecentItems } from '../hooks/useRecentItems.js';
import { useFavorites } from '../hooks/useFavorites.js';
import { useNavPins } from '../hooks/useNavPins.js';
import { useNavActionDispatch } from '../hooks/useNavActionDispatch.js';
import { matchAppBySegment, appRouteSegment } from '../utils/index.js';
import { matchAppBySegment, appRouteSegment, resolveKeyedI18nLabel } from '../utils/index.js';
import { useHomePath } from '../hooks/useHomePath.js';
// Aliased for symmetry with objectui's own `resolveKeyedI18nLabel` above (the
// names stopped colliding in objectui#4167): this is the spec's resolver (new in
Expand Down Expand Up @@ -159,7 +159,7 @@ export function UnifiedSidebar({ activeAppName }: UnifiedSidebarProps) {
const { isMobile, setOpenMobile } = useSidebar();
const location = useLocation();
const { t, language } = useObjectTranslation();
const { objectLabel: resolveNavObjectLabel, dashboardLabel: resolveNavDashboardLabel, viewLabel: resolveNavViewLabel } = useObjectLabel();
const { objectLabel: resolveNavObjectLabel, dashboardLabel: resolveNavDashboardLabel, viewLabel: resolveNavViewLabel, appLabel } = useObjectLabel();
const { context, currentAppName } = useNavigationContext();
const { user, activeOrganization } = useAuth();
const { isAdmin: isWorkspaceAdmin } = useWorkspaceAdminStatus();
Expand Down Expand Up @@ -205,6 +205,12 @@ export function UnifiedSidebar({ activeAppName }: UnifiedSidebarProps) {
const activeApps = apps.filter((a: any) => a.active !== false && a.hidden !== true);
// ADR-0048 (A) — route segment may be a package id; match by it (name fallback).
const activeApp = matchAppBySegment(apps.filter((a: any) => a.active !== false), activeAppName || currentAppName) || activeApps[0];
// The active app's logo (objectui#10827): `branding.logo`, the one spelling
// `@objectstack/spec` declares — an image URL. This is the console chrome's
// only reader of it. App context only: on Home `activeApp` falls back to the
// FIRST app, whose logo is not this screen's. No logo, no header — the
// sidebar renders exactly as it did before the key had a reader.
const appLogo: string | undefined = context === 'app' ? activeApp?.branding?.logo : undefined;

// Drag-reorder and pin persistence
const { applyOrder, handleReorder } = useNavOrder(activeApp?.name || 'home');
Expand Down Expand Up @@ -442,6 +448,15 @@ export function UnifiedSidebar({ activeAppName }: UnifiedSidebarProps) {
return (
<>
<Sidebar collapsible="icon" className="!top-14 !h-[calc(100svh-3.5rem)]">
{appLogo && (
<SidebarHeader className="border-b p-2">
<img
src={appLogo}
alt={appLabel({ name: activeApp.name, label: resolveKeyedI18nLabel(activeApp.label, t) })}
className="h-8 w-auto max-w-full object-contain object-left"
/>
</SidebarHeader>
)}
{/* Mobile-only "Home" affordance — the desktop topbar exposes Home
via the platform logo + AppSwitcher pill, but those are hidden
on phones. Without this row, users entering an app on mobile
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.

/**
* The console chrome draws the active app's `branding.logo` (objectui#10827).
*
* `branding.logo` is authored by the designer (`AppCreationWizard`,
* `BrandingEditor`), documented, and set by downstream apps, and until this
* card nothing mounted in the console rendered it: its only reader was the
* never-mounted `AppSidebar`, removed by PR #10617. The mounted sidebar,
* `UnifiedSidebar`, now reads it — the chrome's one reader — and draws it as a
* header image. An app without a logo gets no header: today's sidebar, which
* is the control.
*
* ## Real subjects
*
* `ConsoleLayout` with its real `AppShell` (`@object-ui/layout`) and real
* `UnifiedSidebar`, under the real `NavigationProvider` — so the sidebar is in
* `app` context only because `ConsoleLayout` put it there, as in the running
* console. The stand-ins are the providers the sidebar reads (metadata,
* permissions, auth, expressions) and the siblings this card does not touch:
* the top bar (`AppHeader`), the chat dock and FAB, and the preview and
* notification bars.
*
* The logo is read from `[data-sidebar="sidebar"]`, the sidebar's own root,
* so no other surface can answer for it.
*/

import '@testing-library/jest-dom/vitest';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import React from 'react';
import { render, cleanup } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';

// Partial mock: @object-ui/components also imports from @object-ui/i18n
// (createSafeTranslation), so the rest of the module must stay real.
vi.mock('@object-ui/i18n', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
useObjectTranslation: () => ({
t: (key: string, options?: Record<string, unknown>) => String(options?.defaultValue ?? key),
language: 'en',
}),
useObjectLabel: () => ({
objectLabel: ({ label }: { label?: string }) => label,
viewLabel: (_o: string, _v: string, fallback?: string) => fallback,
dashboardLabel: ({ label }: { label?: string }) => label,
appLabel: ({ name, label }: { name: string; label?: string }) => label || name,
}),
}));

vi.mock('@object-ui/auth', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
useAuth: () => ({ user: null, activeOrganization: null }),
useWorkspaceAdminStatus: () => ({ isAdmin: false, isResolved: true }),
}));

vi.mock('@object-ui/permissions', async (importOriginal) => ({
...(await importOriginal<typeof import('@object-ui/permissions')>()),
usePermissions: () => ({ can: () => true, hasCapabilities: () => true }),
}));

let metadataState: { apps: unknown[]; objects: unknown[] };
vi.mock('../../providers/MetadataProvider', () => ({
useMetadata: () => metadataState,
}));

vi.mock('../../providers/ExpressionProvider', () => ({
useExpressionContext: () => ({ evaluator: null }),
evaluateVisibility: (expr: unknown) => expr !== false && expr !== 'false',
}));

// Lazy lucide DynamicIcon would suspend mid-test; a null icon is enough here.
vi.mock('../../utils/getIcon', () => ({ getIcon: () => () => null }));

vi.mock('../../hooks/useRecentItems', () => ({ useRecentItems: () => ({ recentItems: [] }) }));
vi.mock('../../hooks/useFavorites', () => ({
useFavorites: () => ({ favorites: [], removeFavorite: vi.fn() }),
}));
vi.mock('../../hooks/useNavPins', () => ({
useNavPins: () => ({ togglePin: vi.fn(), applyPins: (items: unknown) => items }),
}));
vi.mock('../../hooks/useNavActionDispatch', () => ({
useNavActionDispatch: () => vi.fn(),
}));
vi.mock('../ContextSelectors', () => ({
useAppContextSelectors: () => ({ contextValues: {}, element: null }),
contextSelectorQueryKey: (id: string) => (id === 'active_package' ? 'package' : id),
STUDIO_PACKAGE_SELECTOR_ID: 'active_package',
}));
vi.mock('../LocalizedSidebarTrigger', () => ({
LocalizedSidebarTrigger: () => null,
}));

// Siblings in `ConsoleLayout` this card does not touch.
vi.mock('../AppHeader', () => ({ AppHeader: () => <div data-testid="app-header-stub" /> }));
vi.mock('../../hooks/useAiSurface', () => ({
useAiSurfaceEnabled: () => ({ enabled: false, isLoading: false }),
}));
vi.mock('../ChatDock', () => ({
useChatDockState: () => ({
expanded: false,
width: 420,
dragging: false,
maximized: false,
toggle: vi.fn(),
expand: vi.fn(),
collapse: vi.fn(),
maximize: vi.fn(),
restore: vi.fn(),
onResizePointerDown: vi.fn(),
}),
ChatDockPanel: () => null,
ChatDockMobileSheet: () => null,
}));
vi.mock('../ConsoleChatbotFab', () => ({ ConsoleChatbotFab: () => null }));
vi.mock('../ConsoleNotificationBanners', () => ({ ConsoleNotificationBanners: () => null }));
vi.mock('../../preview/DraftPreviewBar', () => ({ DraftPreviewBar: () => null }));
vi.mock('../../preview/UnpublishedAppBar', () => ({ UnpublishedAppBar: () => null }));

import { SidebarProvider } from '@object-ui/components';
import { ConsoleLayout } from '../ConsoleLayout';
import { UnifiedSidebar } from '../UnifiedSidebar';
import { NavigationProvider } from '../../context/NavigationContext';

const LOGO = 'https://cdn.example.test/acme-logo.svg';

const NAV = [{ id: 'n1', type: 'object', label: 'Accounts', objectName: 'account' }];

/** The two apps an author can have: one with `branding.logo`, one without. */
const BRANDED = { name: 'acme_crm', label: 'Acme CRM', active: true, branding: { primaryColor: '#2563eb', logo: LOGO }, navigation: NAV };
const PLAIN = { name: 'plain_app', label: 'Plain App', active: true, branding: { primaryColor: '#2563eb' }, navigation: NAV };

function mountConsole(activeApp: Record<string, unknown>, apps: Record<string, unknown>[] = [activeApp]) {
metadataState = { apps, objects: [] };
const name = String(activeApp.name);
return render(
<MemoryRouter initialEntries={[`/apps/${name}`]}>
<NavigationProvider>
<ConsoleLayout activeAppName={name} activeApp={activeApp} onAppChange={vi.fn()} objects={[]}>
<div data-testid="route-content">page</div>
</ConsoleLayout>
</NavigationProvider>
</MemoryRouter>,
);
}

function sidebarRoot(): HTMLElement {
const root = document.querySelector<HTMLElement>('[data-sidebar="sidebar"]');
if (!root) throw new Error('the console chrome mounted no sidebar');
return root;
}

const imagesIn = (el: HTMLElement) => [...el.querySelectorAll('img')].map((img) => img.getAttribute('src'));

beforeEach(() => {
localStorage.clear();
});
afterEach(() => cleanup());

describe('the console chrome renders the active app\'s `branding.logo` (objectui#10827)', () => {
it('an app with `branding.logo` shows it at the top of the sidebar, named by the app\'s label', () => {
const view = mountConsole(BRANDED);
// The mount is real: the route content and the sidebar's navigation render.
expect(view.getByTestId('route-content')).toBeInTheDocument();
expect(view.getByText('Accounts')).toBeInTheDocument();

const sidebar = sidebarRoot();
expect(imagesIn(sidebar)).toEqual([LOGO]);
expect(view.getByRole('img', { name: 'Acme CRM' })).toHaveAttribute('src', LOGO);
});

it('CONTROL — an app without a logo keeps today\'s sidebar: no image, same navigation', () => {
const view = mountConsole(PLAIN);
expect(view.getByText('Accounts')).toBeInTheDocument();
expect(imagesIn(sidebarRoot())).toEqual([]);
});

it('the retired top-level `logo` renders nothing — only `branding.logo` is read', () => {
const aliasOnly = { ...PLAIN, name: 'alias_app', logo: LOGO };
const view = mountConsole(aliasOnly);
expect(view.getByText('Accounts')).toBeInTheDocument();
expect(imagesIn(sidebarRoot())).toEqual([]);
});

it('switching to a branded app shows ITS logo, not the first app\'s', () => {
// `PLAIN` is listed first: the sidebar must follow the active app.
mountConsole(BRANDED, [PLAIN, BRANDED]);
expect(imagesIn(sidebarRoot())).toEqual([LOGO]);
cleanup();
mountConsole(PLAIN, [BRANDED, PLAIN]);
expect(imagesIn(sidebarRoot())).toEqual([]);
});
});

describe('outside an app, the sidebar draws no app logo (objectui#10827)', () => {
it('home context, with a branded app first in the list, draws no image', () => {
// No `ConsoleLayout`, so nothing moves the context off `home` — where the
// sidebar's `activeApp` falls back to the FIRST app.
metadataState = { apps: [BRANDED, PLAIN], objects: [] };
render(
<MemoryRouter initialEntries={['/home']}>
<NavigationProvider>
<SidebarHost />
</NavigationProvider>
</MemoryRouter>,
);
expect(imagesIn(sidebarRoot())).toEqual([]);
});
});

/** The real sidebar in the real `SidebarProvider`, as `AppShell` mounts it. */
function SidebarHost() {
return (
<SidebarProvider>
<UnifiedSidebar activeAppName="" />
</SidebarProvider>
);
}
13 changes: 9 additions & 4 deletions packages/layout/src/AppSchemaRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,12 @@ function InternalSidebar({
enableReorder?: boolean;
onReorder?: (reorderedItems: NavigationItem[]) => void;
}) {
const Icon = resolveIcon(schema.logo);
// The app logo is `branding.logo`, an image URL (objectui#10827) — the one
// spelling `@objectstack/spec` declares. An icon NAME comes from `icon`, the
// key every other app surface reads; the retired top-level `logo` carried
// both and is read by nothing.
const logo = schema.branding?.logo;
const Icon = resolveIcon(schema.icon);
const [searchQuery, setSearchQuery] = useState('');

return (
Expand All @@ -393,9 +398,9 @@ function InternalSidebar({
<SidebarMenuItem>
<SidebarMenuButton size="lg" tooltip={schema.title ?? schema.name}>
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground">
{schema.logo && schema.logo.startsWith('http') ? (
{logo ? (
<img
src={schema.logo}
src={logo}
alt={schema.title ?? ''}
className="size-6 object-contain"
/>
Expand Down Expand Up @@ -473,7 +478,7 @@ function InternalSidebar({
* Renders a complete application shell from an `AppSchema` JSON document.
*
* Responsibilities:
* - Reads `name`, `title`, `description`, `logo`, `favicon` for branding
* - Reads `name`, `title`, `description`, `icon`, `branding.logo`, `favicon` for branding
* - Renders sidebar navigation from `navigation` or `areas[].navigation`
* - Area switcher when multiple areas are VISIBLE — area visibility is
* derived from the items inside, not authored (objectui#3311): an area
Expand Down
Loading
Loading