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
17 changes: 17 additions & 0 deletions .changeset/36150-authored-record-page-desktop-only.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@object-ui/app-shell': minor
---

feat(app-shell): an authored record page is drawn on the desktop full page only; a phone and the side drawer draw the standard page

Clause-②: no
Metadata-protocol: semantic
Skills-docs: follow-up #36179 — skills/objectstack-ui/rules/record-page.md rules 4 and 5 (the `record_more` advice); skills edits ride a domain:skills PR

What a `kind: 'full'` record page means changes: it is drawn on the desktop full page only. On a phone, and in every embedded record view (the side drawer a list opens, the split pane, an interface page's preview), the record draws the platform's standard page for its object, whether or not the object has an authored page. **Open full page** from the drawer still lands on the authored page.

The standard page keeps what the object declares: field groups and order, field permissions and visibility, the `record_header` / `record_more` actions, one tab per child table, the stage and the approval state. The authored page's layout does not apply there, nor anything that lives only on it: its tabs and sections, page-only related lists and blocks, banners, and `record_section` actions, which the standard page does not draw. To keep such an action reachable on a phone and in the drawer, add `record_more` to its `locations` (and leave it out of the authored header's `actions` list, so the full page still draws it once). There is no setting that keeps an authored page on the phone or in the drawer.

Unchanged: a slotted page (the standard page with slots filled) applies everywhere; a page named in the URL (`…/record/:id/page/:pageName`, print pages included) is drawn wherever that route renders; the platform's approval request (`sys_approval_request`) and user (`sys_user`) pages keep their own page on every surface.

Nothing to migrate: no metadata key changes, and the desktop full page draws exactly as before.
22 changes: 22 additions & 0 deletions content/docs/ui/pages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,28 @@ const accountDetailPage = {
Use a slotted page to change one or two parts of an otherwise standard record page, and a
`full` page for a record page that looks nothing like the default.

### Where an authored page applies

A `kind: 'full'` record page is drawn on the **desktop full page** only. On a phone (any window
narrower than 768 px, a narrowed desktop window included), and in every embedded record view (the
side drawer or split pane a list opens a record in, and an interface page's preview), the record
takes the platform's standard page for its object, whether or not the object has an authored page; **Open full page** from the
drawer lands on the authored one. There is no setting that keeps an authored page on the phone
or in the drawer.

What carries over is what the object declares: its field groups and their order, field
permissions and visibility, the actions placed at `record_header` and `record_more`, one tab per
child table, the stage and the approval state. What does not is the page's own layout and
anything that lives only on it: its tabs and sections, a related list or block placed only on
the page, a banner, and `record_section` actions, which the standard page does not draw. To keep
such an action reachable off the full page, add `record_more` to its `locations`, and leave it
out of the page header's `actions` list so the full page still draws it once.

A slotted page is the standard page with its slots filled, so its slots apply on every surface.
A page named in the URL (`…/record/:id/page/:pageName`, print pages and other named routes) is
drawn wherever that route renders. The platform's approval request and user pages keep their
own page on every surface.

### The discussion panel is composed, never appended

A record page shows a discussion panel if and only if the page composes a
Expand Down
14 changes: 9 additions & 5 deletions examples/app-showcase/src/ui/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,15 @@ export const RecalcEstimateAction = defineAction({
execution: 'perRecord',
// Names the task (see MarkDoneAction's note on the hole and its fallback).
successMessage: "Estimate recalculated for {{ record.title | default:'the task' }}.",
// `record_section` only: the Task Detail page's `record:quick_actions` bar
// names it, and the engine location-filters even explicitly-named actions.
// Not `record_more` too, so the page draws it once, in that bar, and not
// again under the header's ⋯ overflow.
locations: ['record_section'],
// `record_section`: the Task Detail page's `record:quick_actions` bar names
// it, and the engine location-filters even explicitly-named actions. And
// `record_more` (objectstack#36150): the authored page is drawn on the
// desktop full page only, and on a phone or in the side drawer the task
// takes the standard page, which draws no `record_section` action — the
// ⋯ overflow is where the action is found there. The authored header lists
// its action ids and leaves this one out, so the full page still draws it
// once, in the bar.
locations: ['record_section', 'record_more'],
// The endpoint is record-scoped and rejects a body without an id. On a
// record surface the page supplies it; invoked from a LIST ROW (see the
// `legacy_row_actions` view) nothing else can, so name the body key the
Expand Down
11 changes: 8 additions & 3 deletions examples/app-showcase/src/ui/pages/task-detail.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import { definePage } from '@objectstack/spec/ui';
* • `record:highlights` + `record:details` — the standard compact + section
* layout.
* `kind: 'full'` — this page fully owns the record layout, as the Project
* page does for its own tab strip.
* page does for its own tab strip. It is drawn on the desktop full page only
* (objectstack#36150): on a phone and in the side drawer a task opens on the
* standard page, without the review banner or the section bar.
*/
export const TaskDetailPage = definePage({
name: 'showcase_task_detail',
Expand Down Expand Up @@ -47,8 +49,11 @@ export const TaskDetailPage = definePage({
// `record_header` actions render as inline buttons, and an action
// declaring `record_more` without `record_header` always goes under
// the ⋯ overflow. The list is the object's whole `record_header` /
// `record_more` set, which is what the synthesized header would carry;
// `test/record-action-location-hosts.test.ts` holds the two equal.
// `record_more` set, which is what the synthesized header would carry,
// less the actions the section bar below draws (they declare
// `record_more` only for the standard page a phone or the side drawer
// shows, objectstack#36150); `test/record-action-location-hosts.test.ts`
// holds the two equal.
// The host still appends its own Edit / Share / Delete after these.
// No `title`: the header derives it from the record.
{
Expand Down
26 changes: 20 additions & 6 deletions examples/app-showcase/test/record-action-location-hosts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,16 @@ describe('showcase_task record action locations have a stock host (#22030)', ()
expect(result.data?.actions).toEqual(ids);
});

it('lists the task\'s whole record_header / record_more set — what the synthesized header carries', () => {
it('lists the task\'s whole record_header / record_more set — what the synthesized header carries — less the actions its section bar draws', () => {
expect(ids.every((id) => typeof id === 'string')).toBe(true);
expect(new Set(ids).size, 'no id is listed twice').toBe(ids.length);
// An action placed at record_section AND record_more is drawn on this
// page by the quick-actions bar; `record_more` is its place on the
// standard page a phone or the drawer draws (objectstack#36150), so the
// authored header leaves it out (see the record_section block below).
const headerSet = taskActions
.filter((a) => declares('record_header')(a) || declares('record_more')(a))
.filter((a) => !declares('record_section')(a))
.map((a) => a.name as string);
expect([...ids].sort()).toEqual([...headerSet].sort());
});
Expand Down Expand Up @@ -183,13 +188,22 @@ describe('showcase_task record action locations have a stock host (#22030)', ()
expect(names.length).toBeGreaterThan(0);
expect(headerIds.length).toBeGreaterThan(0);
expect(names.filter((n) => headerIds.includes(n))).toEqual([]);
// And by declaration: no task action is placed both in the header's
// locations and in the bar's, so a synthesized page cannot double it either.
const doubled = taskActions
// By declaration: no task action is placed both in the bar's location and
// INLINE in a header, so neither page draws one twice in view.
const inlineToo = taskActions
.filter(declares('record_section'))
.filter((a) => declares('record_header')(a) || declares('record_more')(a))
.filter(declares('record_header'))
.map((a) => a.name);
expect(doubled).toEqual([]);
expect(inlineToo).toEqual([]);
});

it('reaches every record_section action on the standard page too, under the ⋯ overflow (objectstack#36150)', () => {
// A phone and the side drawer draw the standard page, which has no
// section bar: an action the bar hosts is found there through its
// `record_more` location, which the synthesized header reads.
const sectionSet = taskActions.filter(declares('record_section'));
expect(sectionSet.length).toBeGreaterThan(0);
expect(sectionSet.filter((a) => !declares('record_more')(a)).map((a) => a.name)).toEqual([]);
});
});

Expand Down
7 changes: 6 additions & 1 deletion ui/packages/app-shell/src/console/AppContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,11 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
// app whose served item carries its package; the whole registry everywhere
// else, as before (that module says why). A page route reads the objects
// its page binds (objectui#12980), resolved as `PageView` resolves the page,
// and a record route those of its declared record page (objectui#13046).
// and a record route those of its declared record page (objectui#13046),
// on the desktop only: on a phone the view draws the standard page, whose
// related lists read every object that points at the record's
// (objectstack#36150), so the scope follows the width as the view does.
const phoneViewport = usePhoneViewport();
const {
candidate: scopeCandidate,
scope: objectScope,
Expand Down Expand Up @@ -546,6 +550,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
const appName = typeof activeApp?.name === 'string' ? activeApp.name : undefined;
return bundledReads && appName ? bundledReads.objectsReferencing(appName, objectName) : BUNDLE_MISS;
},
phoneViewport,
);
// Until the app list has loaded, a scope candidate does not know its package
// yet, and reads nothing (the splash is up).
Expand Down
Loading
Loading