diff --git a/.changeset/37163-desktop-way-home-names.md b/.changeset/37163-desktop-way-home-names.md new file mode 100644 index 00000000000..50ed649a84f --- /dev/null +++ b/.changeset/37163-desktop-way-home-names.md @@ -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. diff --git a/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx b/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx index 86db1c1dfd6..cf0fbd03849 100644 --- a/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx @@ -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); }); diff --git a/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx b/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx index 1e971dccd4b..1043b4cec09 100644 --- a/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx @@ -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'); }); diff --git a/ui/apps/console/src/components/StudioRoute.test.tsx b/ui/apps/console/src/components/StudioRoute.test.tsx index 6ae055d22eb..4b17d05a255 100644 --- a/ui/apps/console/src/components/StudioRoute.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.test.tsx @@ -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 () => { diff --git a/ui/packages/app-shell/src/components/NotFoundState.tsx b/ui/packages/app-shell/src/components/NotFoundState.tsx index b1f5296a22a..da89f6ff4ee 100644 --- a/ui/packages/app-shell/src/components/NotFoundState.tsx +++ b/ui/packages/app-shell/src/components/NotFoundState.tsx @@ -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 */ @@ -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". */ @@ -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', @@ -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 ( ); } diff --git a/ui/packages/app-shell/src/components/__tests__/NotFoundState.test.tsx b/ui/packages/app-shell/src/components/__tests__/NotFoundState.test.tsx index 902fb1bed73..51a9a970740 100644 --- a/ui/packages/app-shell/src/components/__tests__/NotFoundState.test.tsx +++ b/ui/packages/app-shell/src/components/__tests__/NotFoundState.test.tsx @@ -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'; @@ -47,7 +53,7 @@ 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'); @@ -55,19 +61,42 @@ describe('the unknown-object state offers a way back to Home', () => { // 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'); }); }); diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx index 669dde94e46..1e77de2026f 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx @@ -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(); diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx index 16a37674b25..8d0d5f724ca 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx @@ -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'); }); diff --git a/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx b/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx index b39c19024b8..5ff0fdd0808 100644 --- a/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx @@ -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(); }); @@ -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»'); + }); +}); diff --git a/ui/packages/app-shell/src/console/ai/AiUnavailable.tsx b/ui/packages/app-shell/src/console/ai/AiUnavailable.tsx index 5c5be12ca40..c01686b4569 100644 --- a/ui/packages/app-shell/src/console/ai/AiUnavailable.tsx +++ b/ui/packages/app-shell/src/console/ai/AiUnavailable.tsx @@ -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'; @@ -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 (
@@ -73,7 +78,9 @@ export function AiUnavailable({ )}
diff --git a/ui/packages/app-shell/src/layout/AppHeader.tsx b/ui/packages/app-shell/src/layout/AppHeader.tsx index 3ef08bae3c7..58402b88446 100644 --- a/ui/packages/app-shell/src/layout/AppHeader.tsx +++ b/ui/packages/app-shell/src/layout/AppHeader.tsx @@ -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 @@ -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. */} {isApp && ( diff --git a/ui/packages/app-shell/src/layout/AppSwitcher.tsx b/ui/packages/app-shell/src/layout/AppSwitcher.tsx index 7cdcab80e6e..d438caf7531 100644 --- a/ui/packages/app-shell/src/layout/AppSwitcher.tsx +++ b/ui/packages/app-shell/src/layout/AppSwitcher.tsx @@ -10,9 +10,13 @@ * The dropdown (objectui#12605): a 「Switch Application」 group of the * installed apps with the current one checked — the Setup app is not in it — * then 「Back to app start page」 with its `⌘⇧H` keycaps (where `/` lands from - * 768 px up, the platform home page being retired: objectstack#36732), - * 「All apps」, and 「Settings」 (the - * Setup app, when the viewer's app list carries it). For the viewers the top + * 768 px up, the platform home page being retired: objectstack#36732), and + * 「Settings」 (the Setup app, when the viewer's app list carries it). The + * dropdown is a desktop's alone, and a desktop has no page listing the apps + * any more: 「All apps」 opened the same app start page as the row above it, + * while the switch group at the top is the list of apps, so the menu carries + * no such row (objectstack#37163). A phone's 「All apps」 lives in its drawer + * (`UnifiedSidebar`) and opens its app list at `/home`. For the viewers the top * bar offers its Studio button to, 「Edit APP in Studio」 follows a second * divider; for a read-only package's app it is 「Open APP in Studio」 behind an * eye (#27356 row 12). @@ -38,7 +42,7 @@ import { DropdownMenuLabel, DropdownMenuSeparator, } from '@object-ui/components'; -import { ChevronDown, ChevronsUpDown, Check, Eye, Home, LayoutGrid, Pencil, Settings } from 'lucide-react'; +import { ChevronDown, ChevronsUpDown, Check, Eye, Home, Pencil, Settings } from 'lucide-react'; import { useMetadata } from '../providers/MetadataProvider.js'; import { matchAppBySegment, appRouteSegment } from '../utils/index.js'; import { appAddressSegment } from '../utils/appRoute.js'; @@ -98,15 +102,15 @@ export function AppSwitcher({ const { apps: metadataApps } = useMetadata(); // objectstack#35881 — on a phone the pill opens the app list as a bottom // sheet rather than a dropdown. Read before any return (rules of hooks). - // The sheet holds the list alone: 「Back to home」 and 「All apps」 would open - // that same list (a phone's `/home` is it), 「Settings」 is the Setup row in + // The sheet holds the list alone: a way home would open that same list (a + // phone's `/home` is it), 「Settings」 is the Setup row in // it, and 「Edit / Open APP in Studio」 stays a desktop entry. const phone = usePhoneViewport(); const [sheetOpen, setSheetOpen] = React.useState(false); const { t } = useObjectTranslation(); const { appLabel } = useServedAppLabel(); - // objectui#7256 — 「All apps」 goes to the DECLARED home, like every other - // Home affordance in the chrome. + // objectui#7256 — the way out goes where every other Home affordance in the + // chrome goes (`useHomePath`): from 768 px up, the app start page `/` lands on. const homePath = useHomePath(); const apps = metadataApps || []; @@ -263,16 +267,6 @@ export function AppSwitcher({ - - - - - - - {t('layout.appSwitcher.allApps', { defaultValue: 'All apps' })} - - - {setupApp && setupPath ? ( diff --git a/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx index a1584a1387d..5341a7d4780 100644 --- a/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx @@ -7,8 +7,11 @@ * What this file pins, through the real `AppHeader` under a real router: * - the left group reads: sidebar trigger, the product mark, the `/` rule, * the app pill, the PREVIEW chip; - * - the mark is named 「PRODUCT home」 (the product name from - * `getProductName`) and a click on it lands on `/home`; + * - the mark is named for where it goes: 「Back to app start page」 from + * 768 px up, where the home page is retired (objectstack#37163), and + * 「PRODUCT home」 (the product name from `getProductName`) on a phone, + * whose Home is its app list — the CONTROL in the last describe; a click + * on it lands home; * - the home chord, with ⌘ and with Ctrl, lands on `/home` as a PUSH, and * Back returns to the app page; typed into a text field it does nothing; * - the chord is advertised to the keyboard-shortcuts dialog while an app @@ -252,9 +255,9 @@ describe('inside an app the product mark is the way home (objectui#12605)', () = // objectstack#36732 — from 768 px up home is where `/` lands: with no last // app and nothing declared, the first product app, not the retired page. - it('the mark is named 「PRODUCT home」 and links home', () => { + it('the mark is named 「Back to app start page」 and links home', () => { mount('/apps/crm/lead'); - const link = screen.getByRole('link', { name: `${getProductName()} home` }); + const link = screen.getByRole('link', { name: 'Back to app start page' }); expect(link).toBe(mark()); expect(link).toHaveAttribute('href', DESKTOP_HOME); }); @@ -318,7 +321,7 @@ describe('`⌘⇧H` / `Ctrl+Shift+H` goes home from any app page (objectui#12605 describe('CONTROL — the home page draws the same mark and leaves the chord alone (objectui#12605)', () => { it('one mark, named and linked the same way; no `/` rule and no advertisement', () => { mount('/home'); - expect(screen.getByRole('link', { name: `${getProductName()} home` })).toBe(mark()); + expect(screen.getByRole('link', { name: 'Back to app start page' })).toBe(mark()); expect(mark()).toHaveAttribute('href', DESKTOP_HOME); expect(mark()).toHaveAttribute('title', getProductName()); expect(screen.queryByTestId('app-bar-home-separator')).not.toBeInTheDocument(); @@ -383,3 +386,29 @@ describe('the advertised ⌘⇧H row names where the chord goes (objectstack#371 expect(english('console.shortcuts.goHome')).toBe('Back to home'); }); }); + +describe('the product mark is named for 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)); + + // From 768 px up the platform home page is retired: the mark opens an app's + // start page, and its accessible name says so in the app pill's words; the + // product's name stays its tooltip. + it('on a desktop it names the app start page it opens, not a home page', () => { + setWidth(1280); + mount('/apps/crm/lead'); + expect(mark()).toHaveAccessibleName('Back to app start page'); + expect(mark().getAttribute('aria-label')).not.toMatch(/home/i); + expect(mark()).toHaveAttribute('title', getProductName()); + expect(mark()).toHaveAttribute('href', DESKTOP_HOME); + }); + + it('CONTROL — on a phone, whose Home is still its app list at `/home`, it keeps 「PRODUCT home」', () => { + setWidth(375); + mount('/home'); + expect(mark()).toHaveAccessibleName(`${getProductName()} home`); + expect(mark()).toHaveAttribute('href', '/home'); + }); +}); diff --git a/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx index 916c05c3f03..d43885b4f29 100644 --- a/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/AppHeader.pageRouteNoAuthoringHandles-12198.test.tsx @@ -244,7 +244,7 @@ async function studioEntriesOnPageRoute(perms: MePermissionsResponse): Promise new Promise((resolve) => setTimeout(resolve, 0))); diff --git a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx index abcb310e05c..bb2d4fc4025 100644 --- a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx @@ -9,9 +9,10 @@ * no `branding.logo` — its `icon` on a tile, coloured by its own * `branding.primaryColor` when that is a hex, else by the palette colour its * name picks (objectstack#36157). - * - The dropdown ends with the way back to Home, 「All apps」, and, for a - * viewer the top bar offers its Studio button to, 「Edit APP in Studio」 to - * the button's own target. + * - The dropdown ends with the way back to Home (「Back to app start page」; + * the 「All apps」 row beside it is gone from a desktop, objectstack#37163) + * and, for a viewer the top bar offers its Studio button to, 「Edit APP in + * Studio」 to the button's own target. * * Real subjects: `AppSwitcher`, `AppMark` and its colour derivation * (`appTileColors`), the real @@ -177,13 +178,12 @@ describe('every switcher row carries its app\'s glyph (objectui#12201)', () => { }); describe('the dropdown ends with the way back to Home and the admin Studio row (objectui#12201)', () => { - it('「All apps」 links to the declared home', () => { + it('the way back to Home links to the declared home', () => { apps = [HOTCRM, { ...PROJECTS, isDefault: true }]; renderSwitcher('hotcrm'); - const allApps = menu().getByTestId('app-switcher-all-apps'); - expect(allApps).toHaveTextContent('All apps'); + const home = menu().getByTestId('app-switcher-home'); // `useHomePath` — the app declared `isDefault`, not a literal launcher path. - expect(allApps).toHaveAttribute('href', '/apps/projects'); + expect(home).toHaveAttribute('href', '/apps/projects'); }); it('with the bridge target, the LAST row is 「Edit APP in Studio」 to that very target', () => { @@ -194,14 +194,14 @@ describe('the dropdown ends with the way back to Home and the admin Studio row ( expect(last).toContainElement(studio); expect(studio).toHaveTextContent('Edit HotCRM in Studio'); expect(studio).toHaveAttribute('href', '/studio/com.acme.hotcrm/data'); - // 「All apps」 sits right before it. - expect(rows[rows.length - 2]).toContainElement(menu().getByTestId('app-switcher-all-apps')); + // The way back to Home sits right before it (no Setup app in this list). + expect(rows[rows.length - 2]).toContainElement(menu().getByTestId('app-switcher-home')); }); it('without a bridge target (a member, or an app no package owns) there is no Studio row', () => { renderSwitcher('hotcrm', null); expect(menu().queryByTestId('app-switcher-edit-in-studio')).not.toBeInTheDocument(); - expect(menu().getByTestId('app-switcher-all-apps')).toBeInTheDocument(); + expect(menu().getByTestId('app-switcher-home')).toBeInTheDocument(); }); }); diff --git a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx index 65858ee5289..a4d6464dce8 100644 --- a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx @@ -7,9 +7,13 @@ * - The 「Switch Application」 group lists the installed apps with the current * one checked; the Setup app is not in it. * - After a divider: 「Back to app start page」 with the `⌘⇧H` keycaps (the - * platform home page is retired from 768 px up, objectstack#36732), 「All - * apps」 and - * 「Settings」 (the Setup app), in that order. + * platform home page is retired from 768 px up, objectstack#36732) and + * 「Settings」 (the Setup app), in that order. No 「All apps」 row + * (objectstack#37163): a desktop has no page listing the apps, the row + * opened the same app start page as the row above it, and the switch group + * is the list. A phone's 「All apps」 is its drawer's, still opening its app + * list at `/home` — pinned, as the CONTROL, in + * `UnifiedSidebar.mobileAppHeader-12201.test.tsx`. * - For a viewer the top bar offers its Studio button to, 「Edit APP in * Studio」 follows a second divider. * - Below `sm` the pill is the app's glyph alone, named in its tooltip. @@ -110,7 +114,7 @@ beforeEach(() => { }); describe('the app pill\'s menu (objectui#12605)', () => { - it('the switch group, then Back to app start page → All apps → Settings, then the Studio row after a second divider', () => { + it('the switch group, then Back to app start page → Settings, then the Studio row after a second divider', () => { renderSwitcher('hotcrm', '/studio/com.acme.hotcrm/data'); expect(menuOutline()).toEqual([ 'label', @@ -119,13 +123,11 @@ describe('the app pill\'s menu (objectui#12605)', () => { 'app-switcher-row-hotcrm_service', 'divider', 'app-switcher-home', - 'app-switcher-all-apps', 'app-switcher-settings', 'divider', 'app-switcher-edit-in-studio', ]); expect(menu().getByTestId('app-switcher-home')).toHaveTextContent('Back to app start page'); - expect(menu().getByTestId('app-switcher-all-apps')).toHaveTextContent('All apps'); // objectstack#27521 row 1 — the entry carries the Setup app's own label, // the name its header shows once it is open. expect(menu().getByTestId('app-switcher-settings')).toHaveTextContent('Setup'); @@ -138,6 +140,18 @@ describe('the app pill\'s menu (objectui#12605)', () => { expect(menu().getByTestId('app-switcher-settings')).not.toHaveTextContent('Settings'); }); + it('offers no 「All apps」 row: no row repeats the way home, and the switch group lists every app (objectstack#37163)', () => { + renderSwitcher('hotcrm'); + expect(menu().queryByTestId('app-switcher-all-apps')).not.toBeInTheDocument(); + expect(menuEl()).not.toHaveTextContent('All apps'); + // One row leads to the app start page, under the name it is. + const home = menu().getByTestId('app-switcher-home'); + expect(menuEl().querySelectorAll(`a[href="${home.getAttribute('href')}"]`)).toHaveLength(1); + // The apps the removed row promised are the switch group's rows. + expect(menu().getByTestId('app-switcher-row-hotcrm')).toBeInTheDocument(); + expect(menu().getByTestId('app-switcher-row-hotcrm_service')).toBeInTheDocument(); + }); + it('Setup is not in the switch group; the current app is checked', () => { renderSwitcher('hotcrm'); expect(menu().queryByTestId('app-switcher-row-setup')).not.toBeInTheDocument(); diff --git a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.hostSingleApp-12913.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.hostSingleApp-12913.test.tsx index bdfca95434b..3a89b29b4ba 100644 --- a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.hostSingleApp-12913.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.hostSingleApp-12913.test.tsx @@ -128,7 +128,7 @@ describe('the host asked, and the viewer is served one app (objectui#12913)', () }); describe('CONTROLS (objectui#12913)', () => { - it('a viewer served two apps keeps the switcher and its 「All apps」', async () => { + it('a viewer served two apps keeps the switcher and its way home', async () => { await serveRuntimeConfig({ hideSingleAppSwitcher: true }); apps = [CLOUD, CLOUD_ADMIN, ACCOUNT]; renderSwitcher('cloud_control'); @@ -138,7 +138,7 @@ describe('CONTROLS (objectui#12913)', () => { const menu = within(screen.getByTestId('app-switcher-menu')); expect(menu.getByTestId('app-switcher-row-cloud_control')).toBeInTheDocument(); expect(menu.getByTestId('app-switcher-row-platform_admin')).toBeInTheDocument(); - expect(menu.getByTestId('app-switcher-all-apps')).toHaveTextContent('All apps'); + expect(menu.getByTestId('app-switcher-home')).toHaveTextContent('Back to app start page'); }); it('a viewer served Setup as well keeps the switcher and its 「Settings」 row', async () => { @@ -161,6 +161,5 @@ describe('CONTROLS (objectui#12913)', () => { const menu = within(screen.getByTestId('app-switcher-menu')); expect(menu.getByTestId('app-switcher-row-cloud_control')).toBeInTheDocument(); expect(menu.getByTestId('app-switcher-home')).toHaveTextContent('Back to app start page'); - expect(menu.getByTestId('app-switcher-all-apps')).toHaveTextContent('All apps'); }); }); diff --git a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.publishState.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.publishState.test.tsx index 02d997a88d3..41dbb87be41 100644 --- a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.publishState.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.publishState.test.tsx @@ -95,7 +95,7 @@ vi.mock('../../providers/MetadataProvider', () => ({ import { AppSwitcher } from '../AppSwitcher'; function renderSwitcher(active = 'crm') { - // The router is for the menu's link rows (「All apps」, objectui#12201). + // The router is for the menu's link rows (the way home, objectui#12201). render( diff --git a/ui/packages/app-shell/src/views/RecordDetailView.recordReadFailure-11902.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.recordReadFailure-11902.test.tsx index a0d6594c293..2cb9e82d5ad 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.recordReadFailure-11902.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.recordReadFailure-11902.test.tsx @@ -324,12 +324,14 @@ describe('the not-found state offers a way out: the object list, then Home (obje expect(await screen.findByRole('heading', { name: 'Invoice list' })).toBeInTheDocument(); }); - it('Back to home opens Home', async () => { + // objectstack#37163 — on a desktop (jsdom's 1024 px) the way home names the + // app start page Home now is; the phone CONTROL is in `NotFoundState.test`. + it('the way home (「Back to app start page」 on a desktop) opens Home', async () => { answer = 'notFound'; await openRecordPage(EN); await screen.findByTestId('record-not-found', undefined, { timeout: 5000 }); - 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(); }); @@ -339,6 +341,6 @@ describe('the not-found state offers a way out: the object list, then Home (obje await screen.findByText(NOT_FOUND_ZH, undefined, { timeout: 5000 }); expect(screen.getByRole('link', { name: /^返回发票/ })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: '返回首页' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '返回应用起始页' })).toBeInTheDocument(); }); });