Skip to content

Commit 945466c

Browse files
committed
fix(app-shell): the key-fields editor draws no record-page strip preview
The default record page no longer draws a key-fields strip, so Studio's highlightFields editor stops previewing one: the ordered rows are the one rendering of the list. The file header and HIGHLIGHT_FIELDS_MAX comment say what highlightFields drives now, and the engine.studio.settings.highlightPreview key leaves the studio en/zh catalogues. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgW85kwjGaz7HqsmEuv
1 parent ec24363 commit 945466c

5 files changed

Lines changed: 27 additions & 37 deletions

File tree

‎ui/packages/app-shell/src/views/studio-design/HighlightFieldsEditor.tsx‎

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@
99
/**
1010
* The object's `highlightFields` (ADR-0085) as an ORDERED pick list.
1111
*
12-
* Order is the whole meaning of the key: the spec says "first entry wins where
13-
* only one fits", and the record page's highlight strip draws the fields in
14-
* this order. So the editor is a list, not a chip cloud:
12+
* Order is the whole meaning of the key. The spec: "Ordered most-important
13+
* fields; first entry wins where only one fits. Drives default list and
14+
* related-list columns, cards, hover cards, previews and the record picker;
15+
* the default record page draws no strip from it." Each of those surfaces
16+
* takes the fields in this order, as many as it has room for. So the editor
17+
* is a list, not a chip cloud:
1518
*
1619
* - each row can be dragged to a new place, or moved with the up / down
1720
* buttons (the keyboard path; the drag has no keyboard equivalent) — the
1821
* rows are the shared `OrderedRowList`, which `RelatedListsEditor` uses too;
1922
* - fields are added at the end, from the object's visible fields not already
20-
* picked, up to {@link HIGHLIGHT_FIELDS_MAX};
21-
* - a preview below draws the strip in the picked order, so the order is seen
22-
* as the record page will show it.
23+
* picked, up to {@link HIGHLIGHT_FIELDS_MAX}.
24+
*
25+
* The row order is the one rendering of the list here: no surface preview is
26+
* drawn, since no single surface shows the list the way every other does.
2327
*
2428
* Removing the last field removes the key: an empty list and an absent key
2529
* would both read "not declared" here, and only the absent key says it.
@@ -32,8 +36,9 @@ import { OrderedRowList } from './OrderedRowList.js';
3236
import { t, tFormat, type SupportedLocale } from '../metadata-admin/i18n.js';
3337

3438
/**
35-
* How many highlight fields the editor offers. The record-page strip shows a
36-
* handful of facts at a glance; six is the ruled ceiling for authoring here.
39+
* How many highlight fields the editor offers. The surfaces that read the key
40+
* show a handful of facts at a glance, each taking as many as fit; six is the
41+
* ruled ceiling for authoring here.
3742
* A stored list that is already longer is shown whole and never truncated.
3843
*/
3944
export const HIGHLIGHT_FIELDS_MAX = 6;
@@ -53,7 +58,7 @@ export function HighlightFieldsEditor({
5358
}: {
5459
/** The stored list, in order. */
5560
value: string[];
56-
/** The object's fields (labels for the rows and the preview). */
61+
/** The object's fields (labels for the rows). */
5762
fields: readonly FieldEntry[];
5863
/** The next list; `undefined` removes the key. */
5964
onChange: (next: string[] | undefined) => void;
@@ -93,22 +98,6 @@ export function HighlightFieldsEditor({
9398
<span className="text-[11px] text-muted-foreground">{t('engine.studio.settings.undeclared', locale)}</span>
9499
)}
95100
</div>
96-
{value.length > 0 && (
97-
<div className="space-y-1">
98-
<span className="block text-[10px] text-muted-foreground">{t('engine.studio.settings.highlightPreview', locale)}</span>
99-
<div
100-
data-testid="highlight-preview"
101-
className="flex gap-5 overflow-x-auto rounded-md border bg-muted/20 px-3 py-2"
102-
>
103-
{value.map((name) => (
104-
<div key={name} className="min-w-0 shrink-0" data-testid="highlight-preview-cell">
105-
<div className="text-[10px] text-muted-foreground">{labelOf(fields, name)}</div>
106-
<div className="text-[13px] text-muted-foreground/70">—</div>
107-
</div>
108-
))}
109-
</div>
110-
</div>
111-
)}
112101
</div>
113102
);
114103
}

‎ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.highlightOrder-27054.test.tsx‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
* one fits"), and the object settings panel authors it as one.
1212
*
1313
* The real panel, inside a host that feeds every patch back into the draft:
14-
* - the stored order is the row order and the strip preview's order;
14+
* - the stored order is the row order, and no strip preview is drawn: the
15+
* default record page draws no strip from the key, so the rows are the one
16+
* rendering of the list;
1517
* - up / down and a drag move a field, and the written list keeps every other
1618
* field in place;
1719
* - a picked field is appended at the end;
@@ -59,15 +61,16 @@ function Host({ initial, writes }: { initial: Row; writes: Row[] }) {
5961

6062
const rowOrder = () =>
6163
screen.getAllByTestId(/^highlight-row-/).map((el) => el.getAttribute('data-testid')!.replace('highlight-row-', ''));
62-
const previewOrder = () =>
63-
within(screen.getByTestId('highlight-preview')).getAllByTestId('highlight-preview-cell').map((c) => c.firstChild!.textContent);
6464
const lastHighlights = (writes: Row[]) => writes.at(-1)!.highlightFields;
6565

66-
describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a strip preview', () => {
67-
it('shows the stored order in the rows and in the strip preview', () => {
66+
describe('ObjectSettingsPanel — highlightFields is an ordered pick list', () => {
67+
it('shows the stored order in the rows, and draws no strip preview', () => {
6868
render(<Host initial={{ fields: FIELDS, highlightFields: ['status', 'amount', 'name'] }} writes={[]} />);
6969
expect(rowOrder()).toEqual(['status', 'amount', 'name']);
70-
expect(previewOrder()).toEqual(['Status', 'Amount', 'Name']);
70+
// The editor itself is drawn (the control), with no preview beside its rows.
71+
expect(screen.getByTestId('highlight-fields-editor')).toBeInTheDocument();
72+
expect(screen.queryByTestId('highlight-preview')).toBeNull();
73+
expect(screen.queryAllByTestId('highlight-preview-cell')).toHaveLength(0);
7174
});
7275

7376
it('moves a field with the up / down buttons, keeping every other field in place', () => {
@@ -76,7 +79,7 @@ describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a
7679
const amountRow = screen.getByTestId('highlight-row-amount');
7780
fireEvent.click(within(amountRow).getByRole('button', { name: 'Move up' }));
7881
expect(lastHighlights(writes)).toEqual(['amount', 'status', 'name']);
79-
expect(previewOrder()).toEqual(['Amount', 'Status', 'Name']);
82+
expect(rowOrder()).toEqual(['amount', 'status', 'name']);
8083
fireEvent.click(within(screen.getByTestId('highlight-row-amount')).getByRole('button', { name: 'Move down' }));
8184
expect(lastHighlights(writes)).toEqual(['status', 'amount', 'name']);
8285
});
@@ -130,7 +133,7 @@ describe('ObjectSettingsPanel — highlightFields is an ordered pick list with a
130133
render(<Host initial={{ fields: FIELDS, highlightFields: ['status'] }} writes={writes} />);
131134
fireEvent.click(screen.getByRole('button', { name: 'Remove status' }));
132135
expect(writes.at(-1)!.highlightFields).toBeUndefined();
133-
expect(screen.queryByTestId('highlight-preview')).toBeNull();
136+
expect(screen.queryAllByTestId(/^highlight-row-/)).toHaveLength(0);
134137
expect(screen.getByText(t('engine.studio.settings.undeclared', 'en-US'))).toBeInTheDocument();
135138
});
136139
});

‎ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
* first (`7a90afdf9`).
2828
* 3. Semantic roles (ADR-0085) — the cross-surface presentation roles:
2929
* `nameField`, `stageField` (string | false | unset), `highlightFields`
30-
* (an ordered list with a strip preview — `HighlightFieldsEditor`), and
30+
* (an ordered list — `HighlightFieldsEditor`), and
3131
* `relatedLists` (objectstack#27069), the business order of the record
3232
* page's related lists, over the object's inbound relationships
3333
* (`RelatedListsEditor`).
3434
* These are the ONLY presentation knobs the protocol carries, so the
3535
* builder must make them directly editable — otherwise designers fall
36-
* back to guessing which heuristic picked their title/stepper/columns.
36+
* back to guessing which heuristic picked their title/stage/columns.
3737
* 4. Capabilities (framework#2707/#2727) — the `enable.*` record-surface
3838
* switches. Only LIVE flags are exposed (every toggle is enforced at
3939
* runtime — writer gates, 403s, or UI surfaces): trackHistory & files

‎ui/packages/i18n/src/namespaces/studio/en.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,6 @@ const STUDIO_EN: Record<string, string> = {
23502350
'engine.studio.settings.addFieldOption': '+ Add field…',
23512351
'engine.studio.settings.undeclared': '(not declared — surfaces pick heuristically)',
23522352
'engine.studio.settings.highlightMax': 'Up to {max} highlight fields — remove one to add another.',
2353-
'engine.studio.settings.highlightPreview': 'Highlight strip preview',
23542353
'engine.studio.settings.relatedLists': 'Related list order (relatedLists) — the order of the lists of child records on this object\'s record page, most important first; it orders only, and showing or hiding a list stays on its relationship field',
23552354
'engine.studio.settings.relatedListsAdd': '+ Add relationship…',
23562355
'engine.studio.settings.relatedListsTail': 'Not listed — shown after these, in the default order',

‎ui/packages/i18n/src/namespaces/studio/zh.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,6 @@ const STUDIO_ZH: Record<string, string> = {
21362136
'engine.studio.settings.addFieldOption': '+ 添加字段…',
21372137
'engine.studio.settings.undeclared': '(未声明 —— 各处按启发式自动挑选)',
21382138
'engine.studio.settings.highlightMax': '最多 {max} 个重点字段——移除一个才能再添加。',
2139-
'engine.studio.settings.highlightPreview': '要点条预览',
21402139
'engine.studio.settings.relatedLists': '关联列表顺序(relatedLists)—— 本对象记录页上各子记录列表的顺序,最重要的在前;只管排序,显示与否仍在关系字段上设置',
21412140
'engine.studio.settings.relatedListsAdd': '+ 添加关系…',
21422141
'engine.studio.settings.relatedListsTail': '未列出 —— 排在以上之后,按默认顺序',

0 commit comments

Comments
 (0)