Skip to content

Commit 1be28f6

Browse files
committed
fix(components): the synthesized stream tab has its own token; an authored Timeline tab stays a timeline
`detail.timeline` names the record page's 动态 stream now, so the tab strip no longer maps the bare word `Timeline` to it: that word is an author's too (the served approval page's history tab). The synthesizer writes `Activity stream` for its stream tab, read as `detail.timeline`; an authored `Timeline` reads the pack's own word for a timeline. The slotted approval request page is laid out, so its actions list opens by `?related=`. Claude-Session: https://claude.ai/code/session_01Utp6CaA9ZdTcj97mzGtHYt Co-authored-by: Claude <noreply@anthropic.com>
1 parent e8001d0 commit 1be28f6

7 files changed

Lines changed: 70 additions & 22 deletions

File tree

‎.changeset/27524-record-page-tiers-activity-panel.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The synthesized record page (record page v4) is laid out by one rule, the width
1919
- **动态** (formerly the timeline) is the first panel of the right column. It has the same header as a related panel: 「动态」 and the stream's count, and the header row opens the 动态 tab. Its body is a one-line composer (pressed, it opens the full composer, focused), the newest entries one line each, and 「查看全部 N 条」 when the stream holds more. The 动态 tab (`?related=timeline`) is the full stream: the 全部 · 活动 · 讨论 · 变更 chips, threaded replies, and "Load more" for the next page.
2020
- **⊟** (「右栏」, `⌘⇧,`) is one icon at the end of the record header's action row, drawn only where the tier has a right column. Off, the details take the row. It keeps the reader's earlier related-column choice: the stored preference `record.columns.related` is unchanged. The record header's `PanelToggles` (`@object-ui/components`) now draws icon-only toggles named by their label.
2121
- The 动态 panel is on screen at open in every tier, so a synthesized page reads its feed and its audit history at open. An authored page with tabs still waits for the tab that holds them.
22+
- **Tab labels** (`page:tabs`, `@object-ui/components`). A synthesized page that keeps its tab strip (one the layout cannot partition) labels its stream tab `Activity stream`, which the strip reads as 「动态」. An authored `Timeline` tab, such as the served approval page's history, is no longer read as the record stream: it keeps the pack's own word for a timeline (「时间线」, タイムライン, and so on).
2223

2324
**BREAKING** (`@object-ui/plugin-detail`, TypeScript only). The only importer is the console's own record view. `RecordPageTier` is now `'stack' | 'two-column' | 'wide'`: there is no tabbed tier, and the widest tier is called `wide`. `recordPageTierFor(width)` takes no second argument. `useRecordPageTier` answers `null` only while the page is not laid out (disabled, or not yet measured). `RecordPageColumnsProps.tier` takes every `RecordPageTier`. A caller still naming a retired symbol gets a compile error that names it.
2425

‎ui/apps/console/src/services/approvalRequestsDataSource.decisionPage.test.tsx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ const metadata = {
241241

242242
const EN: I18nConfig = { defaultLanguage: 'en', detectBrowserLanguage: false };
243243

244-
function openRequestPage() {
244+
function openRequestPage(search = '') {
245245
const ds = routeApprovalRecordReads(host as unknown as DataSource, {
246246
fetch: transport,
247247
baseUrl: 'http://test.local/api/v1',
248248
});
249249
return render(
250250
<I18nProvider config={EN} persistLanguage={false}>
251-
<MemoryRouter initialEntries={[`/apps/demo/${APPROVAL_REQUEST_OBJECT}/record/${REQ}`]}>
251+
<MemoryRouter initialEntries={[`/apps/demo/${APPROVAL_REQUEST_OBJECT}/record/${REQ}${search}`]}>
252252
<MetadataCtx.Provider value={metadata as never}>
253253
<AdapterCtx.Provider value={host as never}>
254254
<RecordDetailView
@@ -332,10 +332,10 @@ describe("an approval request's record page with record:approval_decision (objec
332332
});
333333

334334
it('the timeline reads the actions route, and no approvals are read ON the request itself', async () => {
335-
openRequestPage();
336-
const related = await screen.findByRole('tab', { name: /Related/ }, { timeout: 8000 });
337-
fireEvent.mouseDown(related);
338-
fireEvent.click(related);
335+
// The actions list's whole face (`?related=`): the slotted page is laid
336+
// out since objectstack#27524, so the list is a right-column panel and no
337+
// longer a Related tab to open.
338+
openRequestPage(`?related=${APPROVAL_ACTION_OBJECT}.request_id`);
339339
expect(await screen.findByText('Budget checked', undefined, { timeout: 8000 })).toBeTruthy();
340340
expect(wire.some((w) => w.path === `/api/v1/approvals/requests/${REQ}/actions`)).toBe(true);
341341
expect(host.find.mock.calls.some(([resource]) => resource === APPROVAL_ACTION_OBJECT)).toBe(false);

‎ui/packages/components/src/__tests__/page-tabs-builtin-label-i18n-4645.test.tsx‎

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ import '../renderers';
4747

4848
/**
4949
* The tokens `buildDefaultPageSchema` writes onto its tab nodes (Details,
50-
* Timeline, Related, Approvals since objectstack#27055), plus the ones it wrote
51-
* before, which the strip still localizes.
50+
* the stream's `Activity stream` — 「动态」, objectstack#27524 — Related,
51+
* Approvals since objectstack#27055), plus the ones it wrote before, which the
52+
* strip still localizes.
5253
*/
5354
const SYNTHESIZED_TABS: Array<{ token: string; packKey: keyof typeof builtInLocales.en.detail }> = [
5455
{ token: 'Details', packKey: 'details' },
55-
{ token: 'Timeline', packKey: 'timeline' },
56+
{ token: 'Activity stream', packKey: 'timeline' },
5657
{ token: 'Related', packKey: 'related' },
5758
{ token: 'Attachments', packKey: 'attachments' },
5859
{ token: 'Activity', packKey: 'activity' },
@@ -143,11 +144,11 @@ describe('page:tabs — built-in record-detail labels speak the session locale (
143144

144145
expect(texts).toContain('詳情');
145146
expect(texts).toContain('相關');
146-
expect(texts).toContain('時間線');
147+
expect(texts).toContain('動態');
147148
// The Simplified pack values, which a pack-first order would have produced.
148149
expect(texts).not.toContain('详情');
149150
expect(texts).not.toContain('相关');
150-
expect(texts).not.toContain('时间线');
151+
expect(texts).not.toContain('动态');
151152
});
152153

153154
/**
@@ -175,4 +176,41 @@ describe('page:tabs — built-in record-detail labels speak the session locale (
175176

176177
expect(tabTexts(container)).toEqual(['Invoices', '詳細']);
177178
});
179+
180+
/**
181+
* objectstack#27524 — the record page's stream is 「动态」 (Activity) now, and
182+
* `Timeline` is an author's word for something else: the served approval
183+
* page's history tab is labelled `Timeline`. The strip keeps it a timeline
184+
* in every pack (the pack's own word for one) — never the stream's 动态.
185+
*/
186+
it('leaves an authored Timeline tab a timeline, not the record stream\'s 动态', () => {
187+
const strip = (language: string) =>
188+
render(
189+
<I18nProvider config={{ defaultLanguage: language, detectBrowserLanguage: false }}>
190+
<SchemaRenderer
191+
schema={{
192+
type: 'page:tabs',
193+
id: 'tabs',
194+
properties: {
195+
items: [
196+
{ label: 'Details', value: 'details', children: textChild('D') },
197+
{ label: 'Timeline', value: 'timeline', children: textChild('T') },
198+
],
199+
},
200+
}}
201+
/>
202+
</I18nProvider>,
203+
);
204+
const en = strip('en');
205+
expect(tabTexts(en.container)).toEqual(['Details', 'Timeline']);
206+
en.unmount();
207+
const zhTW = strip('zh-TW');
208+
expect(tabTexts(zhTW.container)).toEqual(['詳情', '時間線']);
209+
zhTW.unmount();
210+
const zh = strip('zh');
211+
expect(tabTexts(zh.container)).toEqual(['详情', '时间线']);
212+
zh.unmount();
213+
const ja = strip('ja');
214+
expect(tabTexts(ja.container)).toEqual(['詳細', 'タイムライン']);
215+
});
178216
});

‎ui/packages/components/src/renderers/layout/containers.tsx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ const KNOWN_LABEL_DICT: Record<string, Record<string, string>> = {
213213
Details: '詳情',
214214
Related: '相關',
215215
Timeline: '時間線',
216+
'Activity stream': '動態',
216217
Activity: '活動',
217218
History: '歷史',
218219
Notes: '備註',
@@ -260,8 +261,14 @@ const KNOWN_LABEL_KEYS: Record<string, string> = {
260261
Related: 'detail.related',
261262
Activity: 'detail.activity',
262263
History: 'detail.history',
263-
// The synthesized record page's one timeline stream tab (objectstack#27055).
264-
Timeline: 'detail.timeline',
264+
// The synthesized record page's one stream tab (objectstack#27055), 「动态」
265+
// since objectstack#27524. Its own token, not `Timeline`: that word is an
266+
// author's too (the served approval page's history tab), and mapping it to
267+
// `detail.timeline` would now rename an authored Timeline tab 动态.
268+
'Activity stream': 'detail.timeline',
269+
// An authored `Timeline` stays a timeline: the pack's own word for one (the
270+
// timeline view type's label, in all ten packs).
271+
Timeline: 'console.objectView.viewTypeTimeline',
265272
Attachments: 'detail.attachments',
266273
Approvals: 'detail.approvalsPanelTitle',
267274
Discussion: 'detail.discussion',

‎ui/packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.strictPayload.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ describe('the accepted shape still carries the semantics (objectui#4232)', () =>
229229
related: [{ objectName: 'task', relationshipField: 'lead_id', title: 'Tasks' }],
230230
});
231231
const parsed = PageTabsProps.parse(tabs.properties) as any;
232-
expect(parsed.items.map((i: any) => i.label)).toEqual(['Details', 'Timeline', 'Related']);
232+
expect(parsed.items.map((i: any) => i.label)).toEqual(['Details', 'Activity stream', 'Related']);
233233
expect(parsed.items.map((i: any) => i.value)).toEqual(['details', 'timeline', 'related']);
234234
expect(parsed.items[0].children[0].type).toBe('record:details');
235235
expect(parsed.items[2].children[0].properties.objectName).toBe('task');

‎ui/packages/plugin-detail/src/synth/__tests__/buildDefaultPageSchema.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ describe('buildDefaultPageSchema', () => {
384384
],
385385
});
386386
const labels = tabItems(tabs).map((t: any) => t.label);
387-
expect(labels).toEqual(['Details', 'Timeline']);
387+
expect(labels).toEqual(['Details', 'Activity stream']);
388388
expect(tabItems(tabs)[0].children.map((c: any) => c.type)).toContain('record:related_list');
389389
});
390390

@@ -397,7 +397,7 @@ describe('buildDefaultPageSchema', () => {
397397
],
398398
});
399399
const labels = tabItems(tabs).map((t: any) => t.label);
400-
expect(labels).toEqual(['Details', 'Timeline', 'Related']);
400+
expect(labels).toEqual(['Details', 'Activity stream', 'Related']);
401401
const related = tabItems(tabs).find((t: any) => t.label === 'Related');
402402
expect(related.children).toHaveLength(2);
403403
expect(related.children.map((c: any) => props(c).objectName)).toEqual(['task', 'note']);
@@ -425,7 +425,7 @@ describe('buildDefaultPageSchema', () => {
425425
expect(values).not.toContain('activity');
426426
expect(values).not.toContain('history');
427427
const timeline = tabItems(tabs).find((t: any) => t.value === 'timeline');
428-
expect(timeline.label).toBe('Timeline');
428+
expect(timeline.label).toBe('Activity stream');
429429
expect(timeline.children[0]).toEqual({
430430
type: 'record:activity',
431431
properties: { showCompleted: true, enableThreading: true, enableReactions: true },
@@ -449,7 +449,7 @@ describe('buildDefaultPageSchema', () => {
449449
const tabs = page.regions[0].components.find((c: any) => c.type === 'page:tabs');
450450
expect(tabItems(tabs).map((t: any) => t.label)).toEqual([
451451
'Details',
452-
'Timeline',
452+
'Activity stream',
453453
'Related',
454454
'Approvals',
455455
]);
@@ -516,7 +516,7 @@ describe('buildDefaultPageSchema', () => {
516516
const tabs = page.regions[0].components.find((c: any) => c.type === 'page:tabs');
517517
expect(tabItems(tabs).map((t: any) => t.label)).toEqual([
518518
'Details',
519-
'Timeline',
519+
'Activity stream',
520520
'Related',
521521
]);
522522
expect(tabItems(tabs)[0].children).toEqual([{ type: 'div', id: 'custom-details' }]);
@@ -598,7 +598,7 @@ describe('buildDefaultPageSchema', () => {
598598
expect(tabs.type).toBe('page:tabs');
599599
expect(tabItems(tabs).map((t: any) => t.label)).toEqual([
600600
'Details',
601-
'Timeline',
601+
'Activity stream',
602602
'Related',
603603
]);
604604
});

‎ui/packages/plugin-detail/src/synth/buildDefaultPageSchema.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,9 +1085,11 @@ export function buildDefaultTabs(
10851085
// (审批): the timeline stream is ONE tab, second for every object
10861086
// (objectstack#27524, Target 5: 动态 is a panel, the first of the right
10871087
// column, for every object — no object-derived default places it);
1088-
// attachments close the Related tab, as they close the right column.
1088+
// attachments close the Related tab, as they close the right column. The
1089+
// stream tab's token is `Activity stream`, which the strip reads as
1090+
// `detail.timeline` (「动态」); a bare `Timeline` is an author's word.
10891091
const timeline = options.timeline ?? (options.hideDiscussion ? [] : [buildDefaultTimeline()]);
1090-
if (timeline.length > 0) items.push({ label: 'Timeline', value: 'timeline', children: timeline });
1092+
if (timeline.length > 0) items.push({ label: 'Activity stream', value: 'timeline', children: timeline });
10911093
// Attachments (objectstack#4358) — for `enable.files: true` objects; the
10921094
// tab strip's count badge reads the `record:attachments` node.
10931095
const relatedChildren = [

0 commit comments

Comments
 (0)