Skip to content
17 changes: 17 additions & 0 deletions .changeset/37163-desktop-way-home-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@object-ui/app-shell': patch
---

fix(console): on a desktop the way-home controls name the app start page they open, and the app pill drops its duplicate 「All apps」 row

Clause-②: no
Metadata-protocol: none

From 768 px up the platform home page is retired: Home is where `/` lands, the last-used app's start page. Four desktop controls still named a home page or a list of apps:

- The app pill's menu ended with 「All apps」, which opened the same app start page as the 「Back to app start page」 row above it. A desktop has no page that lists the apps; the menu's 「Switch Application」 group is that list. On a desktop the row is gone.
- The 「Back to home」 button on the not-found, access-denied and app-verdict screens, and on a record that cannot be read, now reads 「Back to app start page」 (zh: 返回应用起始页) on a desktop.
- The no-assistant screen at `/ai` does the same.
- The product mark's accessible name, 「PRODUCT home」, is 「Back to app start page」 on a desktop. Its tooltip is still the product's name.

A phone, whose Home is still its app list at `/home`, keeps 「Back to home」, 「PRODUCT home」 and its drawer's 「All apps」. No targets change. The wording reuses the existing `layout.appSwitcher.backToHome` key, so no locale key is added or removed. No props or exports change.
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ describe('/studio/* — the builder module loads behind the gate (objectui#11798

await waitFor(() => expect(screen.getByTestId('studio-front-door')).toBeInTheDocument());
// The console header is the frame the landing's fallback sits under; its
// brand links home (objectui#11863), named 「PRODUCT home」 since
// objectui#12605.
expect(screen.getByRole('link', { name: 'ObjectOS home' })).toHaveAttribute('href', '/home');
// brand links home (objectui#11863), named 「Back to app start page」 at
// this desktop width (objectstack#37163; 「PRODUCT home」 on a phone).
expect(screen.getByRole('link', { name: 'Back to app start page' })).toHaveAttribute('href', '/home');
// Both `lazy()` declarations name one specifier, so one module serves both.
expect(builderModuleLoads.count).toBe(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ describe('/studio — the "All metadata" area\'s routes (objectstack#28561)', ()
expect(surface).toHaveAttribute('data-package', '~all');
expect(surface).toHaveAttribute('data-area', 'metadata');
// The landing's frame (the console's top bar) no longer draws it.
expect(screen.queryByRole('link', { name: 'ObjectOS home' })).toBeNull();
// By its test id, not its name: the name depends on the width
// (objectstack#37163), and an absence asserted by an old name passes on
// a mark that is drawn.
expect(screen.queryByTestId('app-bar-product-home')).toBeNull();
expect(screen.queryByTestId('studio-metadata-area')).toBeNull();
expect(location()).toBe('/studio/~all/metadata/permission?scope=environment');
});
Expand Down
7 changes: 4 additions & 3 deletions ui/apps/console/src/components/StudioRoute.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,10 @@ describe('/studio/* — the entry decision, both ways', () => {
renderStudioDeepLink('/studio/', CONTROL_PLANE_APPS);

await waitFor(() => expect(screen.getByTestId('studio-front-door')).toBeInTheDocument());
// The mark is named 「PRODUCT home」 since objectui#12605 (the ruled
// accessible name: product name + home); its target is unchanged.
expect(screen.getByRole('link', { name: 'ObjectOS home' })).toHaveAttribute('href', '/home');
// The mark's target is unchanged. At this desktop width it is named
// 「Back to app start page」 (objectstack#37163; 「PRODUCT home」 on a phone,
// whose control is `AppHeader.homeMark-12605.test.tsx`).
expect(screen.getByRole('link', { name: 'Back to app start page' })).toHaveAttribute('href', '/home');
});

it('the package-less scope\'s bare leg lands on its one pillar, the builder mounted (objectui#11553)', async () => {
Expand Down
18 changes: 16 additions & 2 deletions ui/packages/app-shell/src/components/NotFoundState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
* factory, into every view that draws a not-found state. A screen that already
* holds `useHomePath()` passes it as `to`.
*
* The button names where it goes. A phone's Home is still its app list, so
* there it reads 「Back to home」. From 768 px up the platform home page is
* retired (objectstack#36732) and Home is an app's start page, so there it
* reads 「Back to app start page」, the app pill's words for the same place
* (`layout.appSwitcher.backToHome`, objectstack#37163).
*
* @module
*/

Expand All @@ -30,6 +36,7 @@ import { Button, Empty, EmptyDescription, EmptyTitle, cn } from '@object-ui/comp
import { useObjectTranslation } from '@object-ui/i18n';
import { useMetadata } from '@object-ui/react';
import { HOME_LAUNCHER_PATH, resolveDeclaredHomePath, type DeclaredHomeApp } from '../utils/homePath.js';
import { usePhoneViewport } from '../hooks/usePhoneViewport.js';

export interface NotFoundStateProps {
/** What was not found, e.g. "Record not found". */
Expand Down Expand Up @@ -63,7 +70,11 @@ export function NotFoundState({ title, description, actions, icon: Icon, testId,
);
}

/** "Back to home": navigates to the console's Home, the declared landing app where there is one. */
/**
* The way home: navigates to the console's Home, the declared landing app where
* there is one. 「Back to home」 on a phone, 「Back to app start page」 from 768 px
* up (module doc).
*/
export function BackToHomeButton({
testId,
variant = 'outline',
Expand All @@ -78,9 +89,12 @@ export function BackToHomeButton({
const { apps } = useMetadata();
const homePath = to ?? resolveDeclaredHomePath(apps as DeclaredHomeApp[] | undefined) ?? HOME_LAUNCHER_PATH;
const { t } = useObjectTranslation();
const phone = usePhoneViewport();
return (
<Button variant={variant} onClick={() => navigate(homePath)} data-testid={testId}>
{t('empty.appAccessDeniedHome', { defaultValue: 'Back to home' })}
{phone
? t('empty.appAccessDeniedHome', { defaultValue: 'Back to home' })
: t('layout.appSwitcher.backToHome', { defaultValue: 'Back to app start page' })}
</Button>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
* harnesses: the unmatched URL in `AppContent.noAppComponentRoutes`, the
* unknown record in `RecordDetailView.recordReadFailure-11902`, the unknown app
* in `AppContent.deniedVsUnpublished`.
*
* The button names where it goes (objectstack#37163): from 768 px up, where
* the platform home page is retired and Home is an app's start page, it reads
* 「Back to app start page」, the app pill's words; on a phone, whose Home is
* still its app list, 「Back to home」 (the CONTROL). jsdom's window is 1024 px
* wide, a desktop, so the tests above the last describe read the desktop name.
*/

import '@testing-library/jest-dom/vitest';
Expand Down Expand Up @@ -47,27 +53,50 @@ function renderObjectNotFound(apps: unknown[] = [], language = 'en') {
afterEach(() => cleanup());

describe('the unknown-object state offers a way back to Home', () => {
it('names the object and its cause, and Back to home opens Home', async () => {
it('names the object and its cause, and the way back opens Home', async () => {
renderObjectNotFound();
const state = screen.getByTestId('object-not-found');
expect(state).toHaveTextContent('Object Not Found');
// objectstack-ai/objectstack#34740: neutral on existence — an object the
// reader cannot read is answered exactly like a missing name.
expect(state).toHaveTextContent('The object "no_such_object" does not exist, or you do not have access to it.');

fireEvent.click(screen.getByRole('button', { name: 'Back to home' }));
fireEvent.click(screen.getByRole('button', { name: 'Back to app start page' }));
expect(await screen.findByRole('heading', { name: 'Home page' })).toBeInTheDocument();
expect(screen.getByTestId('pathname').textContent).toBe('/home');
});

it('a deployment that declares its landing app returns there', async () => {
renderObjectNotFound([{ name: 'cloud_control', label: 'Cloud', isDefault: true, navigation: [] }]);
fireEvent.click(screen.getByRole('button', { name: 'Back to home' }));
fireEvent.click(screen.getByRole('button', { name: 'Back to app start page' }));
expect(await screen.findByRole('heading', { name: 'Declared landing' })).toBeInTheDocument();
});

it('zh: the way back reads in the reader language', () => {
renderObjectNotFound([], 'zh');
expect(screen.getByRole('button', { name: '返回首页' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '返回应用起始页' })).toBeInTheDocument();
});
});

describe('the way home names where it goes, by viewport (objectstack#37163)', () => {
const realWidth = window.innerWidth;
const setWidth = (value: number) =>
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value });
afterEach(() => setWidth(realWidth));

it('on a desktop it names the app start page Home now is, not a home page', () => {
setWidth(1280);
renderObjectNotFound();
const button = screen.getByRole('button', { name: 'Back to app start page' });
expect(button.textContent).not.toMatch(/home/i);
});

it('CONTROL — on a phone, whose Home is still its app list, it keeps 「Back to home」 and opens `/home`', async () => {
setWidth(375);
renderObjectNotFound();
expect(screen.queryByRole('button', { name: 'Back to app start page' })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Back to home' }));
expect(await screen.findByRole('heading', { name: 'Home page' })).toBeInTheDocument();
expect(screen.getByTestId('pathname').textContent).toBe('/home');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ describe('AppContent — every screen here states what the probe measured (objec

renderConsoleAt('/apps/finance');
const home = await screen.findByTestId(`${testId}-home`);
expect(home).toHaveTextContent('Back to home');
// objectstack#37163 — a desktop's way home names the app start page it opens.
expect(home).toHaveTextContent('Back to app start page');
expect(screen.getByTestId(`${testId}-retry`)).toBeInTheDocument();
home.click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,13 @@ describe('AppContent — the unmatched-URL state offers two ways out (objectstac
vi.clearAllMocks();
});

it('Back to home opens Home', async () => {
// objectstack#37163 — on a desktop the button names the app start page.
it('the way home (「Back to app start page」 on a desktop) opens Home', async () => {
renderConsoleAt('/apps/setup/system/no-such-page');

const state = await screen.findByTestId('route-not-found');
expect(state).toHaveTextContent('Page not found');
fireEvent.click(screen.getByRole('button', { name: 'Back to home' }));
fireEvent.click(screen.getByRole('button', { name: 'Back to app start page' }));
expect(await screen.findByTestId('home-launcher')).toBeInTheDocument();
expect(pathname()).toBe('/home');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ describe('RequireAiSurface', () => {
expect(screen.queryByText('HOME')).not.toBeInTheDocument();
const page = screen.getByTestId('ai-unavailable');
expect(page).toHaveTextContent('«console.ai.unavailableDescription»');
expect(screen.getByTestId('ai-unavailable-home')).toHaveTextContent('«console.ai.unavailableHome»');
// objectstack#37163 — on a desktop the way home names the app start page
// it opens, in the app pill's words (phone: the describe at the end).
expect(screen.getByTestId('ai-unavailable-home')).toHaveTextContent('«layout.appSwitcher.backToHome»');
// Nothing failed, so nothing is offered again.
expect(screen.queryByTestId('ai-unavailable-retry')).toBeNull();
});
Expand Down Expand Up @@ -192,3 +194,25 @@ describe('RequireAiSurface', () => {
expect(screen.queryByText('DECLARED LANDING')).not.toBeInTheDocument();
});
});

describe('the no-assistant screen\'s way home names where it goes, by viewport (objectstack#37163)', () => {
beforeEach(() => {
mockSurface.mockReturnValue({ enabled: false, isLoading: false, buildServed: false });
viewer.phone = false;
});

it('on a desktop, where Home is an app\'s start page, it reads as the app pill\'s row does', () => {
renderGuardedAi([{ name: 'crm', label: 'CRM' }]);
const home = screen.getByTestId('ai-unavailable-home');
expect(home).toHaveTextContent('«layout.appSwitcher.backToHome»');
expect(home).not.toHaveTextContent('«console.ai.unavailableHome»');
});

it('CONTROL — on a phone, whose Home is still its app list, it keeps 「Back to home」', () => {
viewer.phone = true;
renderGuardedAi([{ name: 'crm', label: 'CRM' }]);
const home = screen.getByTestId('ai-unavailable-home');
expect(home).toHaveTextContent('«console.ai.unavailableHome»');
expect(home).not.toHaveTextContent('«layout.appSwitcher.backToHome»');
});
});
9 changes: 8 additions & 1 deletion ui/packages/app-shell/src/console/ai/AiUnavailable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { Link } from 'react-router-dom';
import { useWorkspaceAdminStatus } from '@object-ui/auth';
import { Button, Empty, EmptyDescription, EmptyTitle } from '@object-ui/components';
import { useCanAuthorMetadata } from '../../hooks/useCanAuthorMetadata.js';
import { usePhoneViewport } from '../../hooks/usePhoneViewport.js';
import { isAiStudioEnabled } from '../../runtime-config.js';
import { STUDIO_NEW_PACKAGE_PATH } from '../../views/studio-design/studioNewPackage.js';

Expand All @@ -42,6 +43,10 @@ export function AiUnavailable({
const { isAdmin } = useWorkspaceAdminStatus();
const canAuthorMetadata = useCanAuthorMetadata();
const offerStudio = !hasError && isAdmin && isAiStudioEnabled() && canAuthorMetadata;
// The way home names where it goes: a phone's Home is its app list; from
// 768 px up the home page is retired (objectstack#36732) and `onHome` opens
// an app's start page, named in the app pill's words (objectstack#37163).
const phone = usePhoneViewport();
return (
<div className="flex flex-1 items-center justify-center p-6" data-testid="ai-unavailable">
<Empty>
Expand Down Expand Up @@ -73,7 +78,9 @@ export function AiUnavailable({
</Button>
)}
<Button onClick={onHome} data-testid="ai-unavailable-home">
{t('console.ai.unavailableHome', { defaultValue: 'Back to home' })}
{phone
? t('console.ai.unavailableHome', { defaultValue: 'Back to home' })
: t('layout.appSwitcher.backToHome', { defaultValue: 'Back to app start page' })}
</Button>
</div>
</Empty>
Expand Down
23 changes: 17 additions & 6 deletions ui/packages/app-shell/src/layout/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,10 @@ export function AppBarCrumbTrail({
* (44 px below `md`, a phone's touch target) holding a 24 px tile on
* `--primary` with the stack glyph, or the deployment's logo. Inside an app
* the bar below `sm` has no room for it beside 44 px controls, so it is not
* drawn there: the app switcher's 「Back to home」 and the drawer's 「All apps」
* go home (objectstack#29075). Named 「PRODUCT home」; `title` keeps the product's name.
* drawn there: the phone's app-list sheet behind the app pill and the drawer's
* 「All apps」 go home (objectstack#29075). Named 「PRODUCT home」 on a phone and
* 「Back to app start page」 from 768 px up (objectstack#37163); `title` keeps
* the product's name.
*
* `homePath`, not a literal `/home` (objectui#7256): on a deployment that
* DECLARES a landing this is the declared one, so the mark and the post-login
Expand Down Expand Up @@ -723,12 +725,21 @@ export function AppHeader({
`/` rule follows it, so the bar reads 「PRODUCT / APP」. The rule
is drawn, not typed: it carries no text, and the `/` separators
the crumbs after the pill use stay theirs alone. */}
{/* Its accessible name says where it goes: 「PRODUCT home」 on a phone,
whose Home is its app list; from 768 px up, where the home page is
retired (objectstack#36732), 「Back to app start page」, the app
pill's words for the same place (objectstack#37163). The product's
name stays its tooltip. */}
<ProductHomeMark
homePath={homePath}
label={t('layout.appSwitcher.productHome', {
defaultValue: '{{product}} home',
product: getProductName(),
})}
label={
phone
? t('layout.appSwitcher.productHome', {
defaultValue: '{{product}} home',
product: getProductName(),
})
: t('layout.appSwitcher.backToHome', { defaultValue: 'Back to app start page' })
}
className={isApp ? 'max-sm:hidden' : undefined}
/>
{isApp && (
Expand Down
Loading
Loading