Skip to content

Commit 33d65a5

Browse files
Copilothotlong
andcommitted
feat: implement ConfigRow layout optimization (#4) and toolbar summary chip (#7)
- ConfigRow: add label maxWidth (45%), text truncation with title tooltip for both label and value - Toolbar section: add summary chip showing "X of Y enabled" at top of expanded section - Add toolbarEnabledCount i18n key to all 10 locales - Update view-config-schema tests for new _toolbarSummary field Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b8c6fc4 commit 33d65a5

File tree

13 files changed

+33
-3
lines changed

13 files changed

+33
-3
lines changed

apps/console/src/__tests__/view-config-schema.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ describe('buildViewConfigSchema', () => {
394394
const section = schema.sections.find((s: any) => s.key === 'toolbar')!;
395395
const fieldKeys = section.fields.map((f: any) => f.key);
396396
expect(fieldKeys).toEqual([
397-
'showSearch', 'showSort', 'showFilters', 'showHideFields', 'showGroup', 'showColor', 'showDensity',
397+
'_toolbarSummary', 'showSearch', 'showSort', 'showFilters', 'showHideFields', 'showGroup', 'showColor', 'showDensity',
398398
]);
399399
});
400400

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,33 @@ function buildGeneralSection(
340340
function buildToolbarSection(
341341
t: ViewSchemaFactoryOptions['t'],
342342
): ConfigPanelSchema['sections'][number] {
343+
/** Keys of all toolbar toggles (used for enabled-count summary) */
344+
const toolbarKeys = ['showSearch', 'showSort', 'showFilters', 'showHideFields', 'showGroup', 'showColor', 'showDensity'];
345+
343346
return {
344347
key: 'toolbar',
345348
title: t('console.objectView.toolbar'),
346349
hint: t('console.objectView.toolbarHint'),
347350
collapsible: true,
348351
defaultCollapsed: true,
349352
fields: [
353+
// Summary chip — "X of Y enabled" at-a-glance overview at the top of expanded section
354+
{
355+
key: '_toolbarSummary',
356+
label: t('console.objectView.toolbar'),
357+
type: 'custom' as const,
358+
render: (_value: any, _onChange: any, draft: Record<string, any>) => {
359+
const total = toolbarKeys.length;
360+
const count = toolbarKeys.filter(k => draft[k] !== false).length;
361+
return (
362+
<div className="flex items-center gap-1.5 py-1" data-testid="toolbar-summary-chip">
363+
<span className="inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground">
364+
{t('console.objectView.toolbarEnabledCount', { count, total })}
365+
</span>
366+
</div>
367+
);
368+
},
369+
},
350370
// Toolbar toggles — ordered per spec: showSearch, showSort, showFilters, showHideFields, showGroup, showColor, showDensity
351371
buildSwitchField('showSearch', t('console.objectView.enableSearch'), 'toggle-showSearch', true), // spec: NamedListView.showSearch
352372
buildSwitchField('showSort', t('console.objectView.enableSort'), 'toggle-showSort', true), // spec: NamedListView.showSort

packages/components/src/custom/config-row.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ function ConfigRow({ label, value, onClick, children, className }: ConfigRowProp
3939
onClick={onClick}
4040
type={onClick ? 'button' : undefined}
4141
>
42-
<span className="text-xs text-muted-foreground shrink-0">{label}</span>
42+
<span className="text-xs text-muted-foreground shrink-0 max-w-[45%] truncate" title={label}>{label}</span>
4343
{children || (
44-
<span className="text-xs text-foreground truncate ml-4 text-right">{value}</span>
44+
<span className="text-xs text-foreground truncate ml-4 text-right max-w-[55%]" title={value}>{value}</span>
4545
)}
4646
</Wrapper>
4747
)

packages/i18n/src/locales/ar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ const ar = {
368368
generalHint: 'عنوان العرض والوصف والنوع',
369369
toolbar: 'شريط الأدوات',
370370
toolbarHint: 'البحث والتصفية والفرز والتجميع ومفاتيح الكثافة',
371+
toolbarEnabledCount: '{{count}} of {{total}} enabled',
371372
navigationSection: 'التنقل',
372373
navigationHint: 'سلوك النقر على الصف وإعدادات العرض التفصيلي',
373374
records: 'السجلات',

packages/i18n/src/locales/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ const de = {
372372
generalHint: 'Ansichtstitel, Beschreibung und Typ',
373373
toolbar: 'Symbolleiste',
374374
toolbarHint: 'Suche, Filter, Sortierung, Gruppierung und Dichteumschaltung',
375+
toolbarEnabledCount: '{{count}} of {{total}} enabled',
375376
navigationSection: 'Navigation',
376377
navigationHint: 'Zeilenklickverhalten und Detailansichtseinstellungen',
377378
records: 'Datensätze',

packages/i18n/src/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ const en = {
372372
generalHint: 'View title, description, and type',
373373
toolbar: 'Toolbar',
374374
toolbarHint: 'Search, filter, sort, group, and density toggles',
375+
toolbarEnabledCount: '{{count}} of {{total}} enabled',
375376
navigationSection: 'Navigation',
376377
navigationHint: 'Row click behavior and detail view settings',
377378
records: 'Records',

packages/i18n/src/locales/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ const es = {
367367
generalHint: 'Título, descripción y tipo de la vista',
368368
toolbar: 'Barra de herramientas',
369369
toolbarHint: 'Búsqueda, filtro, orden, agrupación y alternancia de densidad',
370+
toolbarEnabledCount: '{{count}} of {{total}} enabled',
370371
navigationSection: 'Navegación',
371372
navigationHint: 'Comportamiento al hacer clic en la fila y configuración de la vista detallada',
372373
records: 'Registros',

packages/i18n/src/locales/fr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ const fr = {
372372
generalHint: 'Titre, description et type de la vue',
373373
toolbar: 'Barre d\'outils',
374374
toolbarHint: 'Recherche, filtre, tri, regroupement et bascule de densité',
375+
toolbarEnabledCount: '{{count}} of {{total}} enabled',
375376
navigationSection: 'Navigation',
376377
navigationHint: 'Comportement au clic sur la ligne et paramètres de la vue détaillée',
377378
records: 'Enregistrements',

packages/i18n/src/locales/ja.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ const ja = {
367367
generalHint: 'ビューのタイトル、説明、タイプ',
368368
toolbar: 'ツールバー',
369369
toolbarHint: '検索、フィルター、ソート、グループ、密度の切り替え',
370+
toolbarEnabledCount: '{{count}} of {{total}} enabled',
370371
navigationSection: 'ナビゲーション',
371372
navigationHint: '行クリック時の動作と詳細ビューの設定',
372373
records: 'レコード',

packages/i18n/src/locales/ko.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ const ko = {
367367
generalHint: '보기 제목, 설명 및 유형',
368368
toolbar: '도구 모음',
369369
toolbarHint: '검색, 필터, 정렬, 그룹화 및 밀도 전환',
370+
toolbarEnabledCount: '{{count}} of {{total}} enabled',
370371
navigationSection: '탐색',
371372
navigationHint: '행 클릭 동작 및 상세 보기 설정',
372373
records: '레코드',

0 commit comments

Comments
 (0)