Skip to content

Commit 00048ca

Browse files
CopilotCopilot
andcommitted
refactor: reorder Appearance and UserActions fields to match NamedListView spec
Reorder fields in buildAppearanceSection and buildUserActionsSection to match the NamedListView spec property declaration order. Add spec source annotation comments to each field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1850d72 commit 00048ca

1 file changed

Lines changed: 43 additions & 35 deletions

File tree

apps/console/src/utils/view-config-schema.tsx

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,11 @@ function buildAppearanceSection(
972972
title: t('console.objectView.appearance'),
973973
collapsible: true,
974974
fields: [
975-
// Color field select
975+
// spec: NamedListView.striped
976+
buildSwitchField('striped', t('console.objectView.striped'), 'toggle-striped', false, true),
977+
// spec: NamedListView.bordered
978+
buildSwitchField('bordered', t('console.objectView.bordered'), 'toggle-bordered', false, true),
979+
// spec: NamedListView.color — field for row/card coloring
976980
{
977981
key: 'color',
978982
label: t('console.objectView.color'),
@@ -993,7 +997,11 @@ function buildAppearanceSection(
993997
</ConfigRow>
994998
),
995999
},
996-
// Field text color
1000+
// spec: NamedListView.wrapHeaders
1001+
buildSwitchField('wrapHeaders', t('console.objectView.wrapHeaders'), 'toggle-wrapHeaders', false, true),
1002+
// spec: NamedListView.collapseAllByDefault
1003+
buildSwitchField('collapseAllByDefault', t('console.objectView.collapseAllByDefault'), 'toggle-collapseAllByDefault', false, true),
1004+
// spec: NamedListView.fieldTextColor
9971005
{
9981006
key: 'fieldTextColor',
9991007
label: t('console.objectView.fieldTextColor'),
@@ -1014,7 +1022,31 @@ function buildAppearanceSection(
10141022
</ConfigRow>
10151023
),
10161024
},
1017-
// Row height (icon-group)
1025+
// spec: NamedListView.showDescription
1026+
buildSwitchField('showDescription', t('console.objectView.showFieldDescriptions'), 'toggle-showDescription', true),
1027+
// spec: NamedListView.resizable
1028+
buildSwitchField('resizable', t('console.objectView.resizableColumns'), 'toggle-resizable', false, true),
1029+
// spec: NamedListView.densityMode — compact/comfortable/spacious
1030+
{
1031+
key: 'densityMode',
1032+
label: t('console.objectView.densityMode'),
1033+
type: 'custom',
1034+
render: (value, onChange) => (
1035+
<ConfigRow label={t('console.objectView.densityMode')}>
1036+
<select
1037+
data-testid="select-densityMode"
1038+
className="text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]"
1039+
value={value || 'comfortable'}
1040+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => onChange(e.target.value)}
1041+
>
1042+
<option value="compact">{t('console.objectView.densityCompact')}</option>
1043+
<option value="comfortable">{t('console.objectView.densityComfortable')}</option>
1044+
<option value="spacious">{t('console.objectView.densitySpacious')}</option>
1045+
</select>
1046+
</ConfigRow>
1047+
),
1048+
},
1049+
// spec: NamedListView.rowHeight — 5-value enum: compact/short/medium/tall/extra_tall
10181050
{
10191051
key: 'rowHeight',
10201052
label: t('console.objectView.rowHeight'),
@@ -1049,34 +1081,7 @@ function buildAppearanceSection(
10491081
</ConfigRow>
10501082
),
10511083
},
1052-
// Toggles
1053-
buildSwitchField('wrapHeaders', t('console.objectView.wrapHeaders'), 'toggle-wrapHeaders', false, true),
1054-
buildSwitchField('showDescription', t('console.objectView.showFieldDescriptions'), 'toggle-showDescription', true),
1055-
buildSwitchField('collapseAllByDefault', t('console.objectView.collapseAllByDefault'), 'toggle-collapseAllByDefault', false, true),
1056-
buildSwitchField('striped', t('console.objectView.striped'), 'toggle-striped', false, true),
1057-
buildSwitchField('bordered', t('console.objectView.bordered'), 'toggle-bordered', false, true),
1058-
buildSwitchField('resizable', t('console.objectView.resizableColumns'), 'toggle-resizable', false, true),
1059-
// Density mode
1060-
{
1061-
key: 'densityMode',
1062-
label: t('console.objectView.densityMode'),
1063-
type: 'custom',
1064-
render: (value, onChange) => (
1065-
<ConfigRow label={t('console.objectView.densityMode')}>
1066-
<select
1067-
data-testid="select-densityMode"
1068-
className="text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]"
1069-
value={value || 'comfortable'}
1070-
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => onChange(e.target.value)}
1071-
>
1072-
<option value="compact">{t('console.objectView.densityCompact')}</option>
1073-
<option value="comfortable">{t('console.objectView.densityComfortable')}</option>
1074-
<option value="spacious">{t('console.objectView.densitySpacious')}</option>
1075-
</select>
1076-
</ConfigRow>
1077-
),
1078-
},
1079-
// Conditional formatting
1084+
// spec: NamedListView.conditionalFormatting
10801085
{
10811086
key: '_conditionalFormatting',
10821087
label: t('console.objectView.conditionalFormatting'),
@@ -1164,7 +1169,7 @@ function buildAppearanceSection(
11641169
);
11651170
},
11661171
},
1167-
// Empty state
1172+
// spec: NamedListView.emptyState
11681173
{
11691174
key: '_emptyState',
11701175
label: 'Empty state',
@@ -1221,10 +1226,13 @@ function buildUserActionsSection(
12211226
title: t('console.objectView.userActions'),
12221227
collapsible: true,
12231228
fields: [
1224-
buildSwitchField('clickIntoRecordDetails', t('console.objectView.clickIntoRecordDetails'), 'toggle-clickIntoRecordDetails', true),
1229+
// spec: NamedListView.inlineEdit
12251230
buildSwitchField('inlineEdit', t('console.objectView.inlineEdit'), 'toggle-inlineEdit', true),
1231+
// spec: NamedListView.clickIntoRecordDetails
1232+
buildSwitchField('clickIntoRecordDetails', t('console.objectView.clickIntoRecordDetails'), 'toggle-clickIntoRecordDetails', true),
1233+
// spec: NamedListView.addDeleteRecordsInline
12261234
buildSwitchField('addDeleteRecordsInline', t('console.objectView.addDeleteRecordsInline'), 'toggle-addDeleteRecordsInline', true),
1227-
// Row actions
1235+
// spec: NamedListView.rowActions
12281236
{
12291237
key: '_rowActions',
12301238
label: t('console.objectView.rowActions'),
@@ -1255,7 +1263,7 @@ function buildUserActionsSection(
12551263
);
12561264
},
12571265
},
1258-
// Bulk actions
1266+
// spec: NamedListView.bulkActions
12591267
{
12601268
key: '_bulkActions',
12611269
label: t('console.objectView.bulkActions'),

0 commit comments

Comments
 (0)