Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/37150-docs-pages-in-app-shell.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
'@object-ui/app-shell': patch
'@object-ui/console': patch
Expand All @@ -13,4 +13,4 @@

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.

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.
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.
18 changes: 18 additions & 0 deletions .changeset/37197-docs-portal-app-less-shell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@object-ui/app-shell': patch
'@object-ui/console': patch
'@objectstack/console': patch
---

feat(console): the documentation portal draws in the app shell's frame from 768 px up, belonging to no app

Clause-②: no
Metadata-protocol: none

The documentation portal (`/docs`, a book, an article) was the one documentation page that still drew a top bar on a desktop, in a frame of its own, while an app's documentation pages draw in the app shell. From 768 px up the portal now draws in the same frame, in a variant that belongs to no app: no top bar; the sidebar with search (when there is an app to search) and notifications in its head and the account at its foot; standing notices (impersonation, usage, storage, a lost connection) at the top of the page's content, beside the sidebar rather than over it; the page header's assistant and help buttons at the top right. Where an app's name sits in its sidebar, the portal's sidebar shows a neutral 「Documentation」 heading; it opens the list of your apps (none marked current) and 「Add app」, and choosing an app opens it. The sidebar's body is the documentation tree: 「All documentation」 first, a title filter, then every book under the heading of the app that carries it, as the portal's index groups them, with the book being read open. Books are named as the index names them, so a platform app's book reads as the app does (for example 「系统设置」) instead of its package's short name.

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.

「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.

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

Expand Down
13 changes: 8 additions & 5 deletions ui/apps/console/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
ConsoleToaster,
LoadingScreen,
DefaultHomeLayout,
DocsPortalShell,
DefaultHomePage,
DefaultOrganizationsLayout,
DefaultOrganizationsPage,
Expand Down Expand Up @@ -225,16 +226,18 @@ function HomeRoute() {
}

/**
* The docs portal's frame (objectstack#35424): Home's layout with the docs bar,
* around the lazily loaded docs layout, so the bar is up while the portal's
* chunk loads.
* The docs portal's frame, around the lazily loaded docs layout, so the frame
* is up while the portal's chunk loads. From 768 px up it is the app-less
* variant of the app shell (objectstack#37197): the sidebar with a neutral
* 「Documentation」 head and the docs tree, no top bar, no app guessed. A
* phone keeps Home's layout with the docs bar (objectstack#35424).
*/
function DocsPortalRoute() {
const { user } = useAuth();
return (
<DefaultHomeLayout userId={user?.id} variant="docs">
<DocsPortalShell userId={user?.id}>
<Suspense fallback={<LoadingScreen />}><DocsLayout /></Suspense>
</DefaultHomeLayout>
</DocsPortalShell>
);
}

Expand Down
2 changes: 2 additions & 0 deletions ui/apps/console/src/__tests__/App.docsPortalLazy.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
RequireOrganization: passthrough,
SystemRedirect: () => null,
DefaultHomeLayout: passthrough,
// objectstack#37197: the portal's frame, around the lazy docs layout.
DocsPortalShell: passthrough,
DefaultHomePage: stub('home-page'),
DefaultOrganizationsLayout: passthrough,
DefaultOrganizationsPage: stub('organizations-page'),
Expand Down
12 changes: 8 additions & 4 deletions ui/apps/console/src/pages/DocPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { rewriteDocLinks } from './doc-links';
import { conflictCandidates, readsByNameAfter } from './doc-address';
import { DocShell } from './DocShell';
import { useAppDocsBackTo } from './useAppDocsBackTo';
import { DocsNav, usePackageDocsNavBooks } from './DocsNav';
import { DocsNav, PortalDocsNav, usePackageDocsNavBooks } from './DocsNav';
import { DocRefusal } from './BookPage';
import { useBookData } from './use-book-data';
import { useActiveHeading } from './useActiveHeading';
Expand Down Expand Up @@ -395,12 +395,16 @@ export default function DocPage() {
const docsLabel = t('help.documentation', { defaultValue: 'Documentation' });

const pageNav = sidebarNav ? null : docsNav;
// The shell sidebar's column: the package's books inside an app; in the
// portal's app-less shell every app's books, this one open (objectstack#37197).
const sidebarColumn = appName ? docsNav ?? undefined : <PortalDocsNav currentSlug={slug} activeDoc={name} />;

return (
<DocShell backLink={!docsNav} nav={docsNav ?? undefined}>
<DocShell backLink={!docsNav} nav={sidebarColumn}>
{/* objectstack#35424 — the docs column is the page's one navigation.
* Inside an app from 768 px up it is the shell sidebar's body, where the
* app menu would be (objectstack#37150); elsewhere it sits full height
* From 768 px up it is the shell sidebar's body, where the app menu
* would be: an app's (objectstack#37150) and the portal's app-less
* shell (objectstack#37197); elsewhere (a phone) it sits full height
* beside the article, and on narrow screens it folds into a disclosure
* above it. */}
<div className="flex min-h-full" data-testid="doc-reader">
Expand Down
14 changes: 9 additions & 5 deletions ui/apps/console/src/pages/DocShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
useSidebarDocsNavSlot,
} from '@object-ui/app-shell';
import { AppDocsBackLink } from './AppDocsBackLink';
import { AppDocsNav, DocsNavLandmark } from './DocsNav';
import { AppDocsNav, DocsNavLandmark, PortalDocsNav } from './DocsNav';
import { useAppDocsBackTo } from './useAppDocsBackTo';

/**
Expand All @@ -34,7 +34,11 @@ import { useAppDocsBackTo } from './useAppDocsBackTo';
* page carries 「← Back to APP」 itself: at the top here, on every page but
* the reader, which carries it in its in-page column and passes
* `backLink={false}`.
* - The portal (`/docs/...`) is drawn in Home's frame, whose bar reads
* - The portal (`/docs/...`), from 768 px up, is drawn in the app-less
* variant of the shell (`DocsPortalShell`, objectstack#37197): the same
* sidebar and page header, and the sidebar's body is the portal's column
* (`PortalDocsNav`, every app's books) unless the page hands its own.
* - The portal on a phone is drawn in Home's frame, whose bar reads
* 「PRODUCT / Documentation」 and links to the portal's index (`App.tsx`,
* the `docs` variant of `AppHeader`).
*/
Expand All @@ -45,11 +49,11 @@ export function DocShell({
}: {
/** Without the shell sidebar: draw 「← Back to APP」 above the page. The reader turns it off when its column has it. */
backLink?: boolean;
/** The page's own docs column, for the shell sidebar (the reader's); else every book of the app. */
/** The page's own docs column, for the shell sidebar (the reader's); else every book of the app, or of the portal. */
nav?: ReactNode;
children: ReactNode;
}) {
const { appName } = useParams<{ appName?: string }>();
const { appName, slug } = useParams<{ appName?: string; slug?: string }>();
const backTo = useAppDocsBackTo();
const sidebarNav = useSidebarDocsNavSlot() !== null;
const renderActions = useShellPageActionsSlot();
Expand All @@ -58,7 +62,7 @@ export function DocShell({
<div className="min-h-full">
{sidebarNav ? (
<SidebarDocsNav>
<DocsNavLandmark>{nav ?? <AppDocsNav />}</DocsNavLandmark>
<DocsNavLandmark>{nav ?? (appName ? <AppDocsNav /> : <PortalDocsNav currentSlug={slug} />)}</DocsNavLandmark>
</SidebarDocsNav>
) : null}
{renderActions || renderExpand ? (
Expand Down
Loading
Loading