diff --git a/docs/navigation-design.md b/docs/navigation-design.md index c1ce0f21..f7311c73 100644 --- a/docs/navigation-design.md +++ b/docs/navigation-design.md @@ -114,10 +114,11 @@ the Storage shell during solo resource navigation. - It reads the owner from the pod context, so it does not depend on the navbar existing. ### File explorer header -- Never shown for the profile and friends panes. +- Never shown for profile, friends, preferences or dashboard panes (`home` and `dashboard`). +- Never shown over the folder pane, which supplies its own storage header or navbar. - Never shown for root resources or WebIDs. -- For account-menu views and for panes with their own subject: shown only when the URL is inside the - viewer's own pod. +- For other account-menu views and panes with their own subject: shown only when the URL is inside + the viewer's own pod. ## Modules diff --git a/package-lock.json b/package-lock.json index 32f9c187..5d1d8b1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10578,22 +10578,22 @@ } }, "node_modules/tldts": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.5.3.tgz", - "integrity": "sha512-Gt09nFFdNq5+Gm7qubL33O+g1UZ6lAlV3QXUTbXpqYWS+OI58IqzuxUrwk/D6S6jLNvEZrHaBtXIGMh1mW1poA==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.5.4.tgz", + "integrity": "sha512-Rn2ABgjHZrA+jzqom5zhxA0hLohzYrIgfCPyhpTUxqsUrcsBYuab49LseR9waB9Jr8/MxdodvMHA91oRiGLO3Q==", "devOptional": true, "license": "MIT", "dependencies": { - "tldts-core": "^7.5.3" + "tldts-core": "^7.5.4" }, "bin": { "tldts": "bin/cli.js" } }, "node_modules/tldts-core": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.5.3.tgz", - "integrity": "sha512-G9K/M0Ah+U22clAb1r0fYNheSysv7Y6OAIundzKcFQx5jBgPId3CnFl44sAGGqJA+lUXMOrREFXHX1lrtEApdA==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.5.4.tgz", + "integrity": "sha512-9+4zWtKEDZ3V3FoZ1B97rv+5z5oqp7yeXGVze3CxgQ+CJro9do9DCPD00wxstYZDXDMXsurkBerFfiB6GYtPbA==", "devOptional": true, "license": "MIT" }, diff --git a/src/navigation/chrome.ts b/src/navigation/chrome.ts index f573af34..f185295f 100644 --- a/src/navigation/chrome.ts +++ b/src/navigation/chrome.ts @@ -165,7 +165,7 @@ export function deriveExplorerHeader (input: ExplorerHeaderInput): boolean { } /** - * The header is never shown over a person's profile or friends, whatever the resource, + * The header is never shown over profile, friends, preferences or dashboard panes, * nor over a storage view, which has its own header or the navbar. */ export function explorerHeaderForPane ( @@ -174,6 +174,6 @@ export function explorerHeaderForPane ( folderView?: FolderView, solo = false ): boolean { - if (paneName === 'folder') return false + if (paneName === 'folder' || paneName === 'basicPreferences' || paneName === 'home' || paneName === 'dashboard') return false return resourceHeader && !isPersonPane(paneName) } diff --git a/test/unit/navigation/chrome.test.ts b/test/unit/navigation/chrome.test.ts index 313720f4..e95cd406 100644 --- a/test/unit/navigation/chrome.test.ts +++ b/test/unit/navigation/chrome.test.ts @@ -216,6 +216,11 @@ describe('file explorer header', () => { expect(explorerHeaderForPane(false, 'folder')).toBe(false) }) + it.each(['basicPreferences', 'home', 'dashboard'])('is never shown over %s', paneName => { + expect(explorerHeaderForPane(true, paneName)).toBe(false) + expect(explorerHeaderForPane(true, paneName, undefined, true)).toBe(false) + }) + it('is never shown over a storage view, which has its own header or the navbar', () => { expect(explorerHeaderForPane(true, 'folder', 'explorer')).toBe(false) expect(explorerHeaderForPane(true, 'folder', 'storage')).toBe(false) diff --git a/test/unit/outline/manager.test.ts b/test/unit/outline/manager.test.ts index 93e022f0..48db3afb 100644 --- a/test/unit/outline/manager.test.ts +++ b/test/unit/outline/manager.test.ts @@ -586,7 +586,7 @@ describe('manager', () => { expect(provider.querySelector('solid-ui-file-explorer-header')).not.toBeNull() }) - it('reuses resource visibility and menu items when switching panes', async () => { + it.each(['profile', 'basicPreferences', 'home', 'dashboard'])('reuses resource visibility and menu items when switching to %s and back', async paneName => { isInViewerPodMock.mockResolvedValue(true) const provider = createExplorer(MockPane, { headerOnlyInViewerPod: true }) await vi.waitFor(() => { @@ -594,7 +594,7 @@ describe('manager', () => { }) const header = provider.querySelector('solid-ui-file-explorer-header')! const menuItems = header.menuItems - findPane.mockReturnValue({ ...MockPane, name: 'profile' }) + findPane.mockReturnValue({ ...MockPane, name: paneName }) menuItems[0].action(new Event('click')) expect(provider.querySelector('solid-ui-file-explorer-header')).toBeNull() @@ -718,6 +718,12 @@ describe('manager', () => { expect(await headerShown(false)).toBe(true) }) + it.each(['basicPreferences', 'home', 'dashboard'])('is hidden for account-menu %s even inside the viewer\'s pod', async name => { + isInViewerPodMock.mockResolvedValue(true) + + expect(await headerShown(false, { ...MockPane, name })).toBe(false) + }) + it('is not affected for navbar navigation to a pane without its own subject', async () => { isInViewerPodMock.mockResolvedValue(false)