Skip to content

Commit bd98dd1

Browse files
fix(console): on a desktop the way-home controls name the app start page, and the pill drops its duplicate All apps row (#37204)
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW Fixes #37163 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:桌面端应用切换菜单去掉了多余的「全部应用」一行;找不到页面、无权访问、AI 不可用等页面上的「返回首页」按钮,以及左上角产品标志的读屏名称,改为「返回应用起始页」;手机端完全不变。 - 为什么做:属于「去掉顶栏和平台首页那一层」专题的收尾,桌面端平台首页已下线,这几处还在承诺一个不存在的首页或应用列表。 - 出错会怎样:最坏是某处文案读起来不顺,跳转目标没有任何改动;可直接撤回。 - 要你做什么:无。 ## What changes Measured first, at `origin/main` a10345a. From 768 px up `useHomePath()` answers `resolveDesktopHomePath` (the last-used app, else the declared default, else the first product app). Desktop `/home` redirects into that app (`HomeRoute` → `RootLandingRedirect`) and draws only the no-apps empty state for a viewer with no product app. So no desktop page lists the apps. The pill's 「Switch Application」 group lists every app the launcher serves (`useLauncherApps`, Setup as the 「Settings」 row). It has no cap. - `layout/AppSwitcher.tsx`: the 「All apps」 row (`app-switcher-all-apps`) is removed. It linked to `homePath`, the same target as the 「Back to app start page」 row above it, and the switch group is the list it promised. This dropdown is desktop-only: a phone opens the app-list sheet, which never had the row. The `LayoutGrid` import and the stale comments go with it. - `components/NotFoundState.tsx` `BackToHomeButton` (access denied, verdict screens and route-not-found in `AppContent.tsx`, plus `RecordDetailView.tsx`): reads `layout.appSwitcher.backToHome` 「Back to app start page」 from 768 px up and `empty.appAccessDeniedHome` 「Back to home」 on a phone (`usePhoneViewport`, imported directly so the component still does not load the `useHomePath` module graph). - `console/ai/AiUnavailable.tsx`: same split for its way-home button. - `layout/AppHeader.tsx`: the product mark's `aria-label` is `layout.appSwitcher.backToHome` on a desktop and `layout.appSwitcher.productHome` 「PRODUCT home」 on a phone. `title` stays the product name. - `@object-ui/i18n`: untouched. No key added or removed (`backToHome` already reads 「Back to app start page」 / 返回应用起始页 in all eleven locales since #37159; `allApps`, `productHome`, `appAccessDeniedHome` and `unavailableHome` keep their phone readers). Hence `Clause-②: no`. - Targets: unchanged everywhere. Serial constraint with #37166 (zone a4-S; it also edits `AiUnavailable.tsx` and three StudioRoute console tests). Round 1's one-line import overlap in `AiUnavailable.tsx` was removed by moving the import one line up. Round 2 (head `156171ded`) updates three console tests to the desktop wording. They are `StudioRoute.test.tsx:387` and `StudioRoute.lazyBuilder-11798.test.tsx:187`, which looked the mark up by its phone name at jsdom's 1024 px, and `StudioRoute.metadataArea-28561.test.tsx:150`, whose old-name absence check could no longer fail; it now checks `data-testid="app-bar-product-home"`. Those three files conflict textually with #37166. By the seat's ruling this PR lands first, and #37166 resolves them as follows: it keeps its own deletion of the two front-door tests, and on `metadataArea-28561` keeps its comment line plus this PR's test-id assertion (posted on #37166 as 7153261562). `overlap-check` at `156171ded`: `origin/main`, #37215 and #37185 merge cleanly; the only overlap is #37166 in those three files. Read first, by risk: 1. `ui/packages/app-shell/src/layout/AppSwitcher.tsx`: the removed row (the only behaviour change besides labels). 2. `ui/packages/app-shell/src/components/NotFoundState.tsx`: the viewport choice shared by four screens. 3. `ui/packages/app-shell/src/layout/AppHeader.tsx`: the mark's `label` ternary. Two-minute check: at a desktop width, open any app's pill. The menu lists the apps, then 「Back to app start page ⌘⇧H」 and 「Settings」, with no 「All apps」. Open `/apps/APP/no-such-page`: the button reads 「Back to app start page」. Narrow the window under 768 px and the same page reads 「Back to home」. ## Tests Pins per surface at desktop width, with the phone as the CONTROL. Each new pin is a top-level `describe` in the surface's existing harness: - App pill: `AppSwitcher.homeMenu-12605`. The outline has no `app-switcher-all-apps`, exactly one link to the app start page, and every app in the switch group. Phone control: the drawer's 「All apps」 still pinned, unchanged, in `UnifiedSidebar.mobileAppHeader-12201`. - `BackToHomeButton`: `NotFoundState.test`. At 1280 px it reads 「Back to app start page」 with no "home" in it. CONTROL at 375 px: 「Back to home」, opens `/home`. - `AiUnavailable`: `RequireAiSurface.test`. Desktop reads `layout.appSwitcher.backToHome`. CONTROL on a phone: `console.ai.unavailableHome`. - Product mark: `AppHeader.homeMark-12605`. At 1280 px its accessible name is 「Back to app start page」 and `title` the product name. CONTROL at 375 px on `/home`: 「PRODUCT home」, href `/home`. Existing pins re-pointed to the desktop wording, or to `app-switcher-home` in place of the removed row: `AppSwitcher.appIdentity-12201`, `AppSwitcher.hostSingleApp-12913`, `AppHeader.pageRouteNoAuthoringHandles-12198`, `RecordDetailView.recordReadFailure-11902`, `AppContent.deniedVsUnpublished`, `AppContent.noAppComponentRoutes`. <details><summary>Affected suites (vitest, from ui/), head 646cd3e</summary> ``` pnpm exec vitest run --maxWorkers=2 NotFoundState RecordDetailView.recordReadFailure-11902 AppContent.deniedVsUnpublished AppContent.noAppComponentRoutes RequireAiSurface AiChatPage AiUnavailable AppHeader. AppSwitcher. SidebarAppMenu-36112 UnifiedSidebar. usePhoneNavDrawerHistory-29131 KeyboardShortcutsDialog StudioDesignSurface.homeLoop-12513 StudioDesignSurface.backToApp ConsoleLayout. AppContent.packageless setupRedirectTarget Test Files 127 passed (127) Tests 974 passed (974) os-verify-lock: VERDICT command-exit 0 ``` </details> <details><summary>Reverse verification (one-shot, restored)</summary> `node scripts/ablation-replace.mjs` replaced the desktop arm of `BackToHomeButton` with the old `empty.appAccessDeniedHome` key (anchor x1 -> x0, replacement x0 -> x1, blob da89f6f -> 07b506144a86) and ran `NotFoundState.test`: ``` × names the object and its cause, and the way back opens Home × a deployment that declares its landing app returns there × zh: the way back reads in the reader language × on a desktop it names the app start page Home now is, not a home page Tests 4 failed | 1 passed (5) ablation-replace: ok restored: blob == HEAD (da89f6f) and `git diff HEAD` is empty ``` The phone CONTROL stayed green under the mutation. There was no build step, because the harness imports app-shell source relatively. </details> <details><summary>Type-check, lint, gates</summary> ``` pnpm --filter '@object-ui/app-shell^...' build && pnpm --filter @object-ui/app-shell run type-check TYPECHECK_EXIT=0 eslint --no-inline-config (14 touched ui files): 0 errors, 23 warnings (pre-existing no-explicit-any) node scripts/pm/overlap-check.mjs: VERDICT clean exit 0 (origin/main, #37166) dispatch-gates --commands: 38 derived families, all 38 exit 0 (ui scripts/ suite: Test Files 172 passed | 2 skipped); --ran: 0 UNRUN ``` </details> ## Acceptance notes - `RequireAiSurface`'s published `redirectTo` prop can send the no-assistant screen's button somewhere other than `useHomePath()`. No in-repo caller passes it. The desktop label assumes the default target. - On a desktop the way home briefly names `/home` until the `/me/apps` answer is held, or for a viewer with no product app, where `/home` draws the no-apps empty state. That is the same caveat #37159 accepted for the ⌘⇧H row. - The `console.ai.unavailableError` sentence still says "head back home" on a desktop. Fixing it needs a new locale key, so it stays outside this diff (see report). - Same family, outside this card's file surface: `ui/apps/console/src/components/StudioRoute.tsx` `StudioAccessRequired` 「Back to home」 links to `useHomePath()`. It is in #37166's diff, so it is reported rather than touched. Also stale prose only: `runtime-config.ts` (the `hideSingleAppSwitcher` doc mentions the 「All apps」 row) and `docs/qa/platform-checklist/areas/approvals.json` (the switcher offers "Showcase, Back to home and All apps"). ## Verification Round 2, head `156171ded`: the 3 StudioRoute files `Tests 34 passed (34)`; the red leg (the two files at their old content) gave `Tests 2 failed | 20 passed (22)`; a broad sweep of 872 test files `Tests 8296 passed (8296)`; the derived gate families, 38 of 38 exit 0. CI at this head: 38 success, 13 expected skip, 0 failed. Round 1, head 646cd3e. Local: affected suites, ablation, app-shell type-check, touched-file eslint, the derived gate families. CI owns the full farm. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a386a1d commit bd98dd1

19 files changed

Lines changed: 217 additions & 71 deletions
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
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
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
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:
11+
12+
- 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.
13+
- 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.
14+
- The no-assistant screen at `/ai` does the same.
15+
- 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.
16+
17+
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.

‎ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ describe('/studio/* — the builder module loads behind the gate (objectui#11798
182182

183183
await waitFor(() => expect(screen.getByTestId('studio-front-door')).toBeInTheDocument());
184184
// The console header is the frame the landing's fallback sits under; its
185-
// brand links home (objectui#11863), named 「PRODUCT home」 since
186-
// objectui#12605.
187-
expect(screen.getByRole('link', { name: 'ObjectOS home' })).toHaveAttribute('href', '/home');
185+
// brand links home (objectui#11863), named 「Back to app start page」 at
186+
// this desktop width (objectstack#37163; 「PRODUCT home」 on a phone).
187+
expect(screen.getByRole('link', { name: 'Back to app start page' })).toHaveAttribute('href', '/home');
188188
// Both `lazy()` declarations name one specifier, so one module serves both.
189189
expect(builderModuleLoads.count).toBe(1);
190190
});

‎ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ describe('/studio — the "All metadata" area\'s routes (objectstack#28561)', ()
147147
expect(surface).toHaveAttribute('data-package', '~all');
148148
expect(surface).toHaveAttribute('data-area', 'metadata');
149149
// The landing's frame (the console's top bar) no longer draws it.
150-
expect(screen.queryByRole('link', { name: 'ObjectOS home' })).toBeNull();
150+
// By its test id, not its name: the name depends on the width
151+
// (objectstack#37163), and an absence asserted by an old name passes on
152+
// a mark that is drawn.
153+
expect(screen.queryByTestId('app-bar-product-home')).toBeNull();
151154
expect(screen.queryByTestId('studio-metadata-area')).toBeNull();
152155
expect(location()).toBe('/studio/~all/metadata/permission?scope=environment');
153156
});

‎ui/apps/console/src/components/StudioRoute.test.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,10 @@ describe('/studio/* — the entry decision, both ways', () => {
382382
renderStudioDeepLink('/studio/', CONTROL_PLANE_APPS);
383383

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

390391
it('the package-less scope\'s bare leg lands on its one pillar, the builder mounted (objectui#11553)', async () => {

‎ui/packages/app-shell/src/components/NotFoundState.tsx‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
* factory, into every view that draws a not-found state. A screen that already
2121
* holds `useHomePath()` passes it as `to`.
2222
*
23+
* The button names where it goes. A phone's Home is still its app list, so
24+
* there it reads 「Back to home」. From 768 px up the platform home page is
25+
* retired (objectstack#36732) and Home is an app's start page, so there it
26+
* reads 「Back to app start page」, the app pill's words for the same place
27+
* (`layout.appSwitcher.backToHome`, objectstack#37163).
28+
*
2329
* @module
2430
*/
2531

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

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

66-
/** "Back to home": navigates to the console's Home, the declared landing app where there is one. */
73+
/**
74+
* The way home: navigates to the console's Home, the declared landing app where
75+
* there is one. 「Back to home」 on a phone, 「Back to app start page」 from 768 px
76+
* up (module doc).
77+
*/
6778
export function BackToHomeButton({
6879
testId,
6980
variant = 'outline',
@@ -78,9 +89,12 @@ export function BackToHomeButton({
7889
const { apps } = useMetadata();
7990
const homePath = to ?? resolveDeclaredHomePath(apps as DeclaredHomeApp[] | undefined) ?? HOME_LAUNCHER_PATH;
8091
const { t } = useObjectTranslation();
92+
const phone = usePhoneViewport();
8193
return (
8294
<Button variant={variant} onClick={() => navigate(homePath)} data-testid={testId}>
83-
{t('empty.appAccessDeniedHome', { defaultValue: 'Back to home' })}
95+
{phone
96+
? t('empty.appAccessDeniedHome', { defaultValue: 'Back to home' })
97+
: t('layout.appSwitcher.backToHome', { defaultValue: 'Back to app start page' })}
8498
</Button>
8599
);
86100
}

‎ui/packages/app-shell/src/components/__tests__/NotFoundState.test.tsx‎

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
* harnesses: the unmatched URL in `AppContent.noAppComponentRoutes`, the
99
* unknown record in `RecordDetailView.recordReadFailure-11902`, the unknown app
1010
* in `AppContent.deniedVsUnpublished`.
11+
*
12+
* The button names where it goes (objectstack#37163): from 768 px up, where
13+
* the platform home page is retired and Home is an app's start page, it reads
14+
* 「Back to app start page」, the app pill's words; on a phone, whose Home is
15+
* still its app list, 「Back to home」 (the CONTROL). jsdom's window is 1024 px
16+
* wide, a desktop, so the tests above the last describe read the desktop name.
1117
*/
1218

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

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

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

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

6975
it('zh: the way back reads in the reader language', () => {
7076
renderObjectNotFound([], 'zh');
71-
expect(screen.getByRole('button', { name: '返回首页' })).toBeInTheDocument();
77+
expect(screen.getByRole('button', { name: '返回应用起始页' })).toBeInTheDocument();
78+
});
79+
});
80+
81+
describe('the way home names where it goes, by viewport (objectstack#37163)', () => {
82+
const realWidth = window.innerWidth;
83+
const setWidth = (value: number) =>
84+
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value });
85+
afterEach(() => setWidth(realWidth));
86+
87+
it('on a desktop it names the app start page Home now is, not a home page', () => {
88+
setWidth(1280);
89+
renderObjectNotFound();
90+
const button = screen.getByRole('button', { name: 'Back to app start page' });
91+
expect(button.textContent).not.toMatch(/home/i);
92+
});
93+
94+
it('CONTROL — on a phone, whose Home is still its app list, it keeps 「Back to home」 and opens `/home`', async () => {
95+
setWidth(375);
96+
renderObjectNotFound();
97+
expect(screen.queryByRole('button', { name: 'Back to app start page' })).not.toBeInTheDocument();
98+
fireEvent.click(screen.getByRole('button', { name: 'Back to home' }));
99+
expect(await screen.findByRole('heading', { name: 'Home page' })).toBeInTheDocument();
100+
expect(screen.getByTestId('pathname').textContent).toBe('/home');
72101
});
73102
});

‎ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ describe('AppContent — every screen here states what the probe measured (objec
612612

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

‎ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,13 @@ describe('AppContent — the unmatched-URL state offers two ways out (objectstac
436436
vi.clearAllMocks();
437437
});
438438

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

442443
const state = await screen.findByTestId('route-not-found');
443444
expect(state).toHaveTextContent('Page not found');
444-
fireEvent.click(screen.getByRole('button', { name: 'Back to home' }));
445+
fireEvent.click(screen.getByRole('button', { name: 'Back to app start page' }));
445446
expect(await screen.findByTestId('home-launcher')).toBeInTheDocument();
446447
expect(pathname()).toBe('/home');
447448
});

‎ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ describe('RequireAiSurface', () => {
111111
expect(screen.queryByText('HOME')).not.toBeInTheDocument();
112112
const page = screen.getByTestId('ai-unavailable');
113113
expect(page).toHaveTextContent('«console.ai.unavailableDescription»');
114-
expect(screen.getByTestId('ai-unavailable-home')).toHaveTextContent('«console.ai.unavailableHome»');
114+
// objectstack#37163 — on a desktop the way home names the app start page
115+
// it opens, in the app pill's words (phone: the describe at the end).
116+
expect(screen.getByTestId('ai-unavailable-home')).toHaveTextContent('«layout.appSwitcher.backToHome»');
115117
// Nothing failed, so nothing is offered again.
116118
expect(screen.queryByTestId('ai-unavailable-retry')).toBeNull();
117119
});
@@ -192,3 +194,25 @@ describe('RequireAiSurface', () => {
192194
expect(screen.queryByText('DECLARED LANDING')).not.toBeInTheDocument();
193195
});
194196
});
197+
198+
describe('the no-assistant screen\'s way home names where it goes, by viewport (objectstack#37163)', () => {
199+
beforeEach(() => {
200+
mockSurface.mockReturnValue({ enabled: false, isLoading: false, buildServed: false });
201+
viewer.phone = false;
202+
});
203+
204+
it('on a desktop, where Home is an app\'s start page, it reads as the app pill\'s row does', () => {
205+
renderGuardedAi([{ name: 'crm', label: 'CRM' }]);
206+
const home = screen.getByTestId('ai-unavailable-home');
207+
expect(home).toHaveTextContent('«layout.appSwitcher.backToHome»');
208+
expect(home).not.toHaveTextContent('«console.ai.unavailableHome»');
209+
});
210+
211+
it('CONTROL — on a phone, whose Home is still its app list, it keeps 「Back to home」', () => {
212+
viewer.phone = true;
213+
renderGuardedAi([{ name: 'crm', label: 'CRM' }]);
214+
const home = screen.getByTestId('ai-unavailable-home');
215+
expect(home).toHaveTextContent('«console.ai.unavailableHome»');
216+
expect(home).not.toHaveTextContent('«layout.appSwitcher.backToHome»');
217+
});
218+
});

‎ui/packages/app-shell/src/console/ai/AiUnavailable.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { Link } from 'react-router-dom';
2424
import { useWorkspaceAdminStatus } from '@object-ui/auth';
2525
import { Button, Empty, EmptyDescription, EmptyTitle } from '@object-ui/components';
2626
import { useCanAuthorMetadata } from '../../hooks/useCanAuthorMetadata.js';
27+
import { usePhoneViewport } from '../../hooks/usePhoneViewport.js';
2728
import { isAiStudioEnabled } from '../../runtime-config.js';
2829
import { STUDIO_NEW_PACKAGE_PATH } from '../../views/studio-design/studioNewPackage.js';
2930

@@ -42,6 +43,10 @@ export function AiUnavailable({
4243
const { isAdmin } = useWorkspaceAdminStatus();
4344
const canAuthorMetadata = useCanAuthorMetadata();
4445
const offerStudio = !hasError && isAdmin && isAiStudioEnabled() && canAuthorMetadata;
46+
// The way home names where it goes: a phone's Home is its app list; from
47+
// 768 px up the home page is retired (objectstack#36732) and `onHome` opens
48+
// an app's start page, named in the app pill's words (objectstack#37163).
49+
const phone = usePhoneViewport();
4550
return (
4651
<div className="flex flex-1 items-center justify-center p-6" data-testid="ai-unavailable">
4752
<Empty>
@@ -73,7 +78,9 @@ export function AiUnavailable({
7378
</Button>
7479
)}
7580
<Button onClick={onHome} data-testid="ai-unavailable-home">
76-
{t('console.ai.unavailableHome', { defaultValue: 'Back to home' })}
81+
{phone
82+
? t('console.ai.unavailableHome', { defaultValue: 'Back to home' })
83+
: t('layout.appSwitcher.backToHome', { defaultValue: 'Back to app start page' })}
7784
</Button>
7885
</div>
7986
</Empty>

0 commit comments

Comments
 (0)