Skip to content

Commit 2961b4a

Browse files
committed
feat(console): 「All documentation」 is the first docs row under the way back to the app; the docs-pages changeset and the app-shell doc name the portal's frame
Claude-Session: https://claude.ai/code/session_01QSeKYo1Rb7aYhQiJdWshkL Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7977d28 commit 2961b4a

5 files changed

Lines changed: 35 additions & 18 deletions

File tree

‎.changeset/37150-docs-pages-in-app-shell.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ From 768 px up every app page lost the top bar and keeps the app menu, search, n
1313

1414
The documentation still has one navigation, its own: the sidebar's body carries the docs column (「← Back to APP」, every book of the app with the current one open, a title filter and 「All documentation」) in place of the app's menu. The reader no longer draws that column inside the page there. The app's other docs pages (its docs index, a book with no articles, a book or doc that is not found) carry the same column in the sidebar instead of a back link above the page.
1515

16-
Unchanged: every docs address resolves to the same page as before, and a phone keeps its app bar, no sidebar and the in-page column. The `/docs` portal is not changed by this release. Nothing to migrate.
16+
Unchanged: every docs address resolves to the same page as before, and a phone keeps its app bar, no sidebar and the in-page column. The `/docs` portal draws in the same frame from 768 px up too, in a variant that belongs to no app (its own entry describes it). Nothing to migrate.

‎.changeset/37197-docs-portal-app-less-shell.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ The documentation portal (`/docs`, a book, an article) was the last desktop page
1313

1414
Opening the portal does not pick an app: no app's colours are applied, and the app you last used, and the one you had open, stay what they were.
1515

16-
「All documentation」 is now also the first row of an app's documentation sidebar, above 「← Back to APP」, so the two documentation sidebars match.
16+
「All documentation」 is now also the first documentation row of an app's documentation sidebar, right under 「← Back to APP」 and above the title filter and the books, so the two documentation sidebars match.
1717

1818
Unchanged: every documentation address resolves to the same page as before, and a phone keeps the portal's documentation bar and the in-page column, with 「All documentation」 at its foot. Nothing to migrate.

‎content/docs/frontend/app-shell.mdx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ of its own to it, in particular **no sidebar toggle**. If you want one, render i
7575
Pass `showHeader={false}` to draw no header at all, for a page that draws its own top bar:
7676
the shell then renders no `<header>` element and does not mount `navbar`. It defaults to
7777
`true`, and leaving `navbar` out alone still draws the (empty) bar. The Console draws the
78-
app bar only on a phone (below 768 px) and on an app's docs pages, which mount no sidebar.
79-
From 768 px up an app page starts at the window's top: the sidebar's head carries the app
80-
menu, search and the notification bell, its foot the account menu, the content area the
81-
standing banners, and the page header its own buttons (objectstack#36112). On a phone a
78+
app bar only on a phone (below 768 px). From 768 px up an app page, its docs pages included,
79+
starts at the window's top: the sidebar's head carries the app menu, search and the
80+
notification bell, its foot the account menu, the content area the standing banners, and
81+
the page header its own buttons (objectstack#36112). The documentation portal (`/docs`),
82+
which belongs to no app, draws the same frame there with a neutral 「Documentation」 head
83+
in place of the app menu and the docs tree as the sidebar's body (objectstack#37197). On a phone a
8284
record page's own top bar, with its back link to the object's list, is the page's only bar,
8385
and every other route keeps the app bar.
8486

‎ui/apps/console/src/pages/DocsNav.tsx‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ export interface DocsNavSection {
3333
}
3434

3535
/**
36-
* The docs reader's one navigation column (objectstack#35424): 「All
37-
* documentation」, a way back to the app the reader came from, a title
38-
* filter, and the books (the current one open, the others folded, each with
36+
* The docs reader's one navigation column (objectstack#35424): a way back to
37+
* the app the reader came from, 「All documentation」, a title filter, and
38+
* the books (the current one open, the others folded, each with
3939
* its article count) — the package's, or, in the portal, every app's under
4040
* its app's heading (`sections`). Inside an app it takes the app menu's place;
4141
* the shell draws no menu beside it.
4242
*
4343
* objectstack#37197 — in the shell sidebar (from 768 px up, an app's docs
44-
* pages and the portal alike) 「All documentation」 is the column's first row,
45-
* marked while it is the page in view. The same column drawn in the page —
44+
* pages and the portal alike) 「All documentation」 is the first row of the
45+
* docs entries, marked while it is the page in view: under the way back to the
46+
* app, which is the shell's navigation and not a docs row, and above the
47+
* filter and the books. The same column drawn in the page —
4648
* which only a phone draws, since from 768 px up both docs frames carry it in
4749
* the sidebar — keeps it at the foot, unchanged.
4850
*/
@@ -88,6 +90,7 @@ export function DocsNav({
8890

8991
return (
9092
<div className="flex flex-col gap-4 text-sm" data-testid="docs-nav">
93+
{backTo ? <AppDocsBackLink backTo={backTo} /> : null}
9194
{inSidebar ? (
9295
<Link
9396
to={allDocsHref}
@@ -101,7 +104,6 @@ export function DocsNav({
101104
<span>{allDocsLabel}</span>
102105
</Link>
103106
) : null}
104-
{backTo ? <AppDocsBackLink backTo={backTo} /> : null}
105107
<div className="relative">
106108
<label htmlFor={searchId} className="sr-only">
107109
{searchLabel}

‎ui/apps/console/src/pages/docs-portal.test.tsx‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ describe('objectstack#37150 — from 768 px up an app\'s docs pages draw in the
10991099
});
11001100
});
11011101

1102-
describe('objectstack#37197 — the portal\'s tree in the app-less shell, 「All documentation」 first in both docs sidebars', () => {
1102+
describe('objectstack#37197 — the portal\'s tree in the app-less shell, 「All documentation」 the first docs row in both docs sidebars', () => {
11031103
function Where() {
11041104
return <div data-testid="where">{useLocation().pathname}</div>;
11051105
}
@@ -1158,6 +1158,10 @@ describe('objectstack#37197 — the portal\'s tree in the app-less shell, 「All
11581158
const column = () => within(sidebar()).getByTestId('docs-nav');
11591159
/** The column's rows in reading order: links and book buttons, by their test id or name. */
11601160
const firstRow = (nav: HTMLElement) => nav.querySelector('a, button, input');
1161+
/** The first docs entry: the first row after the way back to an app, which is the shell's navigation, not a docs row. */
1162+
const firstDocsRow = (nav: HTMLElement) =>
1163+
[...nav.querySelectorAll('a, button, input')].find((el) => el.getAttribute('data-testid') !== 'docs-nav-back');
1164+
const precedes = (a: Element, b: Element) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
11611165
const lastLink = (nav: HTMLElement) => [...nav.querySelectorAll('a')].pop();
11621166
/** The headings of the tree's sections and each section's books, in order. */
11631167
const treeSections = () =>
@@ -1252,22 +1256,31 @@ describe('objectstack#37197 — the portal\'s tree in the app-less shell, 「All
12521256
expect(within(page()).queryByTestId('docs-nav')).toBeNull();
12531257
});
12541258

1255-
it('an app\'s docs sidebar puts 「All documentation」 first too, above the way back to the app', async () => {
1259+
it('an app\'s docs sidebar puts 「All documentation」 first among the docs entries: under the way back to the app, above the filter and the books', async () => {
12561260
render(<InPortalShell entry="/apps/com.example.showcase/docs/manual/showcase_lead_guide" />);
12571261
await screen.findByTestId('doc-content');
12581262
const nav = column();
12591263
const allDocs = within(nav).getByTestId('docs-nav-all-docs');
1260-
expect(firstRow(nav)).toBe(allDocs);
1264+
const back = within(nav).getByTestId('docs-nav-back');
12611265
expect(allDocs).toHaveAttribute('href', '/docs');
1262-
expect(allDocs.compareDocumentPosition(within(nav).getByTestId('docs-nav-back')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
1266+
// The way back is the shell's navigation and stays the column's top row.
1267+
expect(firstRow(nav)).toBe(back);
1268+
expect(precedes(back, allDocs)).toBe(true);
1269+
// 「All documentation」 is the first docs row: before the filter and the first book.
1270+
expect(firstDocsRow(nav)).toBe(allDocs);
1271+
expect(precedes(allDocs, within(nav).getByTestId('docs-nav-search'))).toBe(true);
1272+
expect(precedes(allDocs, within(nav).getAllByRole('button')[0])).toBe(true);
12631273
// The app's column is one package's books, with no app headings.
12641274
expect(within(nav).queryAllByTestId('docs-nav-section')).toHaveLength(0);
12651275
});
12661276

12671277
it('…and so does an app\'s docs page that is not the reader (its docs index)', async () => {
12681278
render(<InPortalShell entry="/apps/com.example.showcase/docs" />);
12691279
await within(page()).findByText('Leads Book');
1270-
expect(firstRow(column())).toBe(within(column()).getByTestId('docs-nav-all-docs'));
1280+
const nav = column();
1281+
expect(firstRow(nav)).toBe(within(nav).getByTestId('docs-nav-back'));
1282+
expect(firstDocsRow(nav)).toBe(within(nav).getByTestId('docs-nav-all-docs'));
1283+
expect(precedes(within(nav).getByTestId('docs-nav-all-docs'), within(nav).getAllByRole('button')[0])).toBe(true);
12711284
});
12721285

12731286
it('PHONE CONTROL — the column the page draws itself keeps 「All documentation」 at its foot, the portal\'s and an app\'s alike', async () => {
@@ -1280,7 +1293,7 @@ describe('objectstack#37197 — the portal\'s tree in the app-less shell, 「All
12801293
for (const nav of navs) {
12811294
const allDocs = within(nav).getByTestId('docs-nav-all-docs');
12821295
expect(lastLink(nav), entry).toBe(allDocs);
1283-
expect(firstRow(nav), entry).not.toBe(allDocs);
1296+
expect(firstDocsRow(nav), entry).not.toBe(allDocs);
12841297
// The phone's column is one package's books, as before.
12851298
expect(within(nav).queryAllByTestId('docs-nav-section'), entry).toHaveLength(0);
12861299
}

0 commit comments

Comments
 (0)