diff --git a/frontend/src/components/ds/Drawer.jsx b/frontend/src/components/ds/Drawer.jsx index ecc1c431..afb4f840 100644 --- a/frontend/src/components/ds/Drawer.jsx +++ b/frontend/src/components/ds/Drawer.jsx @@ -23,6 +23,10 @@ import { cn } from '@/lib/utils'; // // // +// +// Pass `headless` when the body opens with its own header (a tab switch, a +// toolbar) that already says what the drawer is: the title is then kept for +// assistive tech only, instead of stacking a heading above the real one. export function Drawer({ open, onOpenChange, @@ -36,24 +40,29 @@ export function Drawer({ className, bodyClassName, flush = false, + headless = false, children, }) { return ( -
- {icon && ( - - {icon} - - )} -
- {/* SheetTitle is required by Radix for a11y; keep it as the visible title. */} - {title} - {subtitle &&
{subtitle}
} + {headless ? ( + {title} + ) : ( +
+ {icon && ( + + {icon} + + )} +
+ {/* SheetTitle is required by Radix for a11y; keep it as the visible title. */} + {title} + {subtitle &&
{subtitle}
} +
+ {headerExtra}
- {headerExtra} -
+ )}
{children}
diff --git a/frontend/src/components/ds/grid/GridFilterDrawer.jsx b/frontend/src/components/ds/grid/GridFilterDrawer.jsx index 2853cf8d..1337cbba 100644 --- a/frontend/src/components/ds/grid/GridFilterDrawer.jsx +++ b/frontend/src/components/ds/grid/GridFilterDrawer.jsx @@ -7,14 +7,18 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ import { cn } from '@/lib/utils'; import { useTranslation } from 'react-i18next'; import { - OPS, byKey, columnLabel, coerceValue, emptyValueFor, - isFilterable, isSortable, optionsFor, + OPS, applyFilters, byKey, columnLabel, coerceValue, emptyValueFor, + isDecorative, isFilterable, isSortable, optionsFor, } from './fields'; // Two panes behind one drawer, because they are the two halves of "what am I // looking at": FILTERS decides which rows, FIELDS decides which columns (and in // what order, at what density, with which detail line). The header menu is the // fast path for one column; this is the whole picture at once. +// +// The pane switch IS the drawer's header: a title saying "Filters and fields" +// above tabs reading "Filters" and "Fields" only repeated them. The footer +// answers the question a filter always raises: how many rows are left. export function GridFilterDrawer({ open, onOpenChange, columns, rows, cfg, grid, noun = 'rows', // Hosts whose table auto-sizes its columns and has no sub-detail line @@ -30,6 +34,19 @@ export function GridFilterDrawer({ const map = byKey(columns); const rules = cfg.filters.rules; const filterable = columns.filter(isFilterable); + // A rule can outlive its column's filterability (a saved view from before + // a column changed shape); those are skipped everywhere below. + const liveRules = rules.filter((rule) => isFilterable(map.get(rule.field))); + const allRows = rows || []; + const total = allRows.length; + const matching = applyFilters(allRows, cfg.filters, columns).length; + const singular = noun.replace(/s$/, ''); + const nounFor = (count) => (count === 1 ? singular : noun); + // Action / chevron columns have no name and nothing to toggle, so they are + // neither listed nor counted. + const namedColumns = columns.filter((column) => !isDecorative(column)); + const shownCount = cfg.cols.filter((key) => !isDecorative(map.get(key))).length; + const hiddenCount = namedColumns.length - shownCount; const patchRule = (id, patch) => grid.setRules( rules.map((r) => (r.id === id ? { ...r, ...patch } : r)), @@ -99,126 +116,156 @@ export function GridFilterDrawer({ ); }; + const panes = [ + { key: 'filters', icon: Filter, label: t('app.gridFilterDrawer.filters', 'Filters'), count: liveRules.length || null }, + { + key: 'fields', + icon: Layers, + label: t('app.gridFilterDrawer.fieldsTab', 'Fields'), + // Only worth a badge when something is hidden. + count: hiddenCount > 0 ? `${shownCount}/${namedColumns.length}` : null, + }, + ]; + return ( } - iconColor="var(--accent-bright)" + headless width={470} flush className="sk-griddrawer" > -
- {[['filters', Filter, 'Filters', rules.length], ['fields', Layers, 'Fields', cfg.cols.length]] - .map(([key, Icon, text, n]) => ( +
+
+ {panes.map(({ key, icon: Icon, label, count }) => ( ))} +
{tab === 'filters' && (
-
-
{t('app.gridFilterDrawer.conditions', 'Conditions')}
- -
- -
- {t('app.gridFilterDrawer.match', 'Match')} -
- {['all', 'any'].map((value) => ( - - ))} -
- {t('app.gridFilterDrawer.ofTheFollowing', 'of the following')} -
- - {rules.length === 0 && ( -
- {t('app.gridFilterDrawer.noConditionsThisViewShowsEvery', 'No conditions. This view shows every')} {noun.replace(/s$/, '')}. -
- )} - - {rules.map((rule, i) => { - const column = map.get(rule.field); - // A rule can outlive its column's filterability — a - // saved view from before a column changed shape, or - // a column whose data went empty. Skip it rather - // than look up OPS[undefined] and crash the drawer. - if (!column || !isFilterable(column)) return null; - return ( -
- {i > 0 && ( -
- {cfg.filters.match === 'all' ? 'and' : 'or'} + {liveRules.length === 0 ? ( +
+

+ {t('app.gridFilterDrawer.nothingFiltered', { + count: total, + noun: nounFor(total), + defaultValue_one: 'The only {{noun}} is showing.', + defaultValue_other: 'All {{count}} {{noun}} are showing.', + })} +

+ {filterable.length > 0 && ( + <> +
{t('app.gridFilterDrawer.filterBy', 'Filter by')}
+
+ {filterable.map((column) => ( + + ))}
- )} -
- - - -
{valueEditor(rule)}
-
-
- ); - })} + + )} +
+ ) : ( + <> + {liveRules.map((rule, i) => { + const column = map.get(rule.field); + return ( +
+ {i > 0 && ( + // The word between two conditions is the switch for how + // they combine; it applies to the whole list. +
+
+ {[ + ['all', t('app.gridFilterDrawer.and', 'and')], + ['any', t('app.gridFilterDrawer.or', 'or')], + ].map(([value, text]) => ( + + ))} +
+
+ )} +
+ + + +
{valueEditor(rule)}
+
+
+ ); + })} + + + )}
)} @@ -226,18 +273,21 @@ export function GridFilterDrawer({ <>
-
{t('app.gridFilterDrawer.fields', 'Fields ·')} {cfg.cols.length} shown
+
{t('app.gridFilterDrawer.columns', 'Columns')}
+ + {t('app.gridFilterDrawer.shownOf', '{{shown}} of {{total}} shown', { shown: shownCount, total: namedColumns.length })} +
{ordered.map((key, i) => { const column = map.get(key); - if (!column) return null; + if (!column || isDecorative(column)) return null; const on = cfg.cols.includes(key); const locked = !!column.locked || column.hideable === false; return (
setDragging(i)} onDragEnd={() => setDragging(null)} onDragOver={(e) => { @@ -248,7 +298,7 @@ export function GridFilterDrawer({ {columnLabel(column)} {locked - ? pinned + ? {t('app.gridFilterDrawer.pinned', 'pinned')} : (
+ {/* What the filters leave: the number this drawer exists to change. */} + + {matching === total + ? t('app.gridFilterDrawer.countAll', '{{count}} {{noun}}', { count: total, noun: nounFor(total) }) + : t('app.gridFilterDrawer.countOf', '{{matching}} of {{total}} {{noun}}', { matching, total, noun: nounFor(total) })} + + -
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json index f244c928..630836bc 100644 --- a/frontend/src/i18n/locales/ar.json +++ b/frontend/src/i18n/locales/ar.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "إضافة شرط", - "conditions": "شروط", - "conditions_one": "شرط واحد", - "conditions_other": "{{count}} شرط", "density": "كثافة", "extraFieldsPrintedUnderTheFirst": "الحقول الإضافية المطبوعة تحت العمود الأول.", "field": "مجال", - "fields": "الحقول ·", - "fieldsShown_one": "حقل واحد ظاهر", - "fieldsShown_other": "{{count}} حقل ظاهر", "filtersFields": "المرشحات والحقول", - "match": "مباراة", - "noConditionsThisViewShowsEvery": "لا توجد شروط - يظهر هذا العرض كل", - "ofTheFollowing": "مما يلي", "off": "عن", "operator": "المشغل", "removeCondition": "إزالة الشرط", diff --git a/frontend/src/i18n/locales/bn.json b/frontend/src/i18n/locales/bn.json index a4de9f34..b956a170 100644 --- a/frontend/src/i18n/locales/bn.json +++ b/frontend/src/i18n/locales/bn.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "শর্ত যোগ করুন", - "conditions": "শর্তাবলী", - "conditions_one": "1টি শর্ত", - "conditions_other": "{{count}}টি শর্ত", "density": "ঘনত্ব", "extraFieldsPrintedUnderTheFirst": "প্রথম কলামের অধীনে অতিরিক্ত ক্ষেত্র মুদ্রিত।", "field": "মাঠ", - "fields": "ক্ষেত্র ·", - "fieldsShown_one": "1টি ফিল্ড দেখানো হচ্ছে", - "fieldsShown_other": "{{count}}টি ফিল্ড দেখানো হচ্ছে", "filtersFields": "ফিল্টার এবং ক্ষেত্র", - "match": "ম্যাচ", - "noConditionsThisViewShowsEvery": "কোন শর্ত নেই — এই দৃশ্য প্রতিটি দেখায়", - "ofTheFollowing": "নিম্নলিখিত", "off": "বন্ধ", "operator": "অপারেটর", "removeCondition": "শর্ত সরান", diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json index e138f86d..6140e5c9 100644 --- a/frontend/src/i18n/locales/de.json +++ b/frontend/src/i18n/locales/de.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Bedingung hinzufügen", - "conditions": "Bedingungen", - "conditions_one": "1 Bedingung", - "conditions_other": "{{count}} Bedingungen", "density": "Dichte", "extraFieldsPrintedUnderTheFirst": "Zusätzliche Felder werden unter der ersten Spalte gedruckt.", "field": "Feld", - "fields": "Felder ·", - "fieldsShown_one": "1 Feld angezeigt", - "fieldsShown_other": "{{count}} Felder angezeigt", "filtersFields": "Filter und Felder", - "match": "Spiel", - "noConditionsThisViewShowsEvery": "Keine Bedingungen – diese Ansicht zeigt alle", - "ofTheFollowing": "des Folgenden", "off": "Aus", "operator": "Betreiber", "removeCondition": "Bedingung entfernen", diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index be2beaf5..45f6bcd3 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -3043,25 +3043,29 @@ }, "gridFilterDrawer": { "addCondition": "Add condition", - "conditions": "Conditions", - "conditions_one": "1 condition", - "conditions_other": "{{count}} conditions", + "and": "and", + "columns": "Columns", + "combine": "How conditions combine", + "countAll": "{{count}} {{noun}}", + "countOf": "{{matching}} of {{total}} {{noun}}", "density": "Density", "extraFieldsPrintedUnderTheFirst": "Extra fields printed under the first column.", "field": "Field", - "fields": "Fields ·", - "fieldsShown_one": "1 field shown", - "fieldsShown_other": "{{count}} fields shown", + "fieldsTab": "Fields", + "filterBy": "Filter by", + "filters": "Filters", "filtersFields": "Filters and fields", - "match": "Match", - "noConditionsThisViewShowsEvery": "No conditions. This view shows every", - "ofTheFollowing": "of the following", + "nothingFiltered_one": "The only {{noun}} is showing.", + "nothingFiltered_other": "All {{count}} {{noun}} are showing.", "off": "Off", "operator": "Operator", + "or": "or", + "pinned": "pinned", "removeCondition": "Remove condition", "reset": "Reset", "rowDetail": "Row detail", - "show": "Show {{value}}" + "show": "Show {{value}}", + "shownOf": "{{shown}} of {{total}} shown" }, "gridFooter": { "firstPage": "First page", diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json index 88a8c479..f760ba0f 100644 --- a/frontend/src/i18n/locales/es.json +++ b/frontend/src/i18n/locales/es.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Añadir condición", - "conditions": "Condiciones", - "conditions_one": "1 condición", - "conditions_other": "{{count}} condiciones", "density": "Densidad", "extraFieldsPrintedUnderTheFirst": "Los campos adicionales se muestran debajo de la primera columna.", "field": "Campo", - "fields": "Campos ·", - "fieldsShown_one": "1 campo visible", - "fieldsShown_other": "{{count}} campos visibles", "filtersFields": "Filtros y campos", - "match": "Cumplir", - "noConditionsThisViewShowsEvery": "Sin condiciones — esta vista muestra cada", - "ofTheFollowing": "de las siguientes", "off": "Desactivado", "operator": "Operador", "removeCondition": "Quitar condición", diff --git a/frontend/src/i18n/locales/fr.json b/frontend/src/i18n/locales/fr.json index 1747f085..645d215a 100644 --- a/frontend/src/i18n/locales/fr.json +++ b/frontend/src/i18n/locales/fr.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Ajouter une condition", - "conditions": "Conditions", - "conditions_one": "1 condition", - "conditions_other": "{{count}} conditions", "density": "Densité", "extraFieldsPrintedUnderTheFirst": "Champs supplémentaires imprimés sous la première colonne.", "field": "Champ", - "fields": "Champs ·", - "fieldsShown_one": "1 champ affiché", - "fieldsShown_other": "{{count}} champs affichés", "filtersFields": "Filtres et champs", - "match": "Correspondre", - "noConditionsThisViewShowsEvery": "Aucune condition : cette vue affiche chaque", - "ofTheFollowing": "des éléments suivants", "off": "Désactivé", "operator": "Opérateur", "removeCondition": "Supprimer la condition", diff --git a/frontend/src/i18n/locales/id.json b/frontend/src/i18n/locales/id.json index 9eba06bc..7fb159c1 100644 --- a/frontend/src/i18n/locales/id.json +++ b/frontend/src/i18n/locales/id.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Tambahkan kondisi", - "conditions": "Kondisi", - "conditions_one": "1 kondisi", - "conditions_other": "{{count}} kondisi", "density": "Kepadatan", "extraFieldsPrintedUnderTheFirst": "Bidang tambahan dicetak di bawah kolom pertama.", "field": "Bidang", - "fields": "Bidang ·", - "fieldsShown_one": "1 kolom ditampilkan", - "fieldsShown_other": "{{count}} kolom ditampilkan", "filtersFields": "Filter & bidang", - "match": "Cocok", - "noConditionsThisViewShowsEvery": "Tanpa syarat — tampilan ini menunjukkan semuanya", - "ofTheFollowing": "berikut ini", "off": "Mati", "operator": "Operator", "removeCondition": "Hapus kondisi", diff --git a/frontend/src/i18n/locales/it.json b/frontend/src/i18n/locales/it.json index aff90313..1daf4f78 100644 --- a/frontend/src/i18n/locales/it.json +++ b/frontend/src/i18n/locales/it.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Aggiungi condizione", - "conditions": "Condizioni", - "conditions_one": "1 condizione", - "conditions_other": "{{count}} condizioni", "density": "Densità", "extraFieldsPrintedUnderTheFirst": "Campi aggiuntivi stampati sotto la prima colonna.", "field": "Campo", - "fields": "Campi ·", - "fieldsShown_one": "1 campo mostrato", - "fieldsShown_other": "{{count}} campi mostrati", "filtersFields": "Filtri e campi", - "match": "Incontro", - "noConditionsThisViewShowsEvery": "Nessuna condizione: questa visualizzazione mostra ogni", - "ofTheFollowing": "di quanto segue", "off": "Spento", "operator": "Operatore", "removeCondition": "Rimuovi condizione", diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json index 821e61c6..df2896e8 100644 --- a/frontend/src/i18n/locales/ko.json +++ b/frontend/src/i18n/locales/ko.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "조건 추가", - "conditions": "조건", - "conditions_one": "조건 1개", - "conditions_other": "조건 {{count}}개", "density": "밀도", "extraFieldsPrintedUnderTheFirst": "첫 번째 열 아래에 추가 필드가 인쇄됩니다.", "field": "필드", - "fields": "분야 ·", - "fieldsShown_one": "필드 1개 표시됨", - "fieldsShown_other": "필드 {{count}}개 표시됨", "filtersFields": "필터 및 필드", - "match": "경기", - "noConditionsThisViewShowsEvery": "조건 없음 - 이 보기에는 모든 조건이 표시됩니다.", - "ofTheFollowing": "다음 중", "off": "끄기", "operator": "운영자", "removeCondition": "조건 제거", diff --git a/frontend/src/i18n/locales/pl.json b/frontend/src/i18n/locales/pl.json index e5e3c0f4..582e3beb 100644 --- a/frontend/src/i18n/locales/pl.json +++ b/frontend/src/i18n/locales/pl.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Dodaj warunek", - "conditions": "Warunki", - "conditions_one": "1 warunek", - "conditions_other": "Warunki: {{count}}", "density": "Gęstość", "extraFieldsPrintedUnderTheFirst": "Dodatkowe pola wydrukowane pod pierwszą kolumną.", "field": "Pole", - "fields": "Pola ·", - "fieldsShown_one": "Pokazano 1 pole", - "fieldsShown_other": "Pokazane pola: {{count}}", "filtersFields": "Filtry i pola", - "match": "Mecz", - "noConditionsThisViewShowsEvery": "Brak warunków — ten widok pokazuje wszystkie", - "ofTheFollowing": "z poniższych", "off": "Wyłączony", "operator": "Operator", "removeCondition": "Usuń warunek", diff --git a/frontend/src/i18n/locales/pt.json b/frontend/src/i18n/locales/pt.json index 61d10af1..614b5c78 100644 --- a/frontend/src/i18n/locales/pt.json +++ b/frontend/src/i18n/locales/pt.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Adicionar condição", - "conditions": "Condições", - "conditions_one": "1 condição", - "conditions_other": "{{count}} condições", "density": "Densidade", "extraFieldsPrintedUnderTheFirst": "Campos extras impressos na primeira coluna.", "field": "Campo", - "fields": "Campos ·", - "fieldsShown_one": "1 campo exibido", - "fieldsShown_other": "{{count}} campos exibidos", "filtersFields": "Filtros e campos", - "match": "Partida", - "noConditionsThisViewShowsEvery": "Sem condições — esta visualização mostra todos", - "ofTheFollowing": "dos seguintes", "off": "Desligado", "operator": "Operador", "removeCondition": "Remover condição", diff --git a/frontend/src/i18n/locales/ru.json b/frontend/src/i18n/locales/ru.json index ce2673d9..3d573719 100644 --- a/frontend/src/i18n/locales/ru.json +++ b/frontend/src/i18n/locales/ru.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Добавить условие", - "conditions": "Условия", - "conditions_one": "1 условие", - "conditions_other": "Условий: {{count}}", "density": "Плотность", "extraFieldsPrintedUnderTheFirst": "Дополнительные поля печатаются под первым столбцом.", "field": "Поле", - "fields": "Поля ·", - "fieldsShown_one": "Показано 1 поле", - "fieldsShown_other": "Показано полей: {{count}}", "filtersFields": "Фильтры и поля", - "match": "Соответствовать", - "noConditionsThisViewShowsEvery": "Никаких условий — в этом представлении отображаются все", - "ofTheFollowing": "из следующих", "off": "Выкл.", "operator": "Оператор", "removeCondition": "Удалить условие", diff --git a/frontend/src/i18n/locales/th.json b/frontend/src/i18n/locales/th.json index 9d67c8e1..f6cd0d54 100644 --- a/frontend/src/i18n/locales/th.json +++ b/frontend/src/i18n/locales/th.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "เพิ่มเงื่อนไข", - "conditions": "เงื่อนไข", - "conditions_one": "1 เงื่อนไข", - "conditions_other": "{{count}} เงื่อนไข", "density": "ความหนาแน่น", "extraFieldsPrintedUnderTheFirst": "ช่องพิเศษที่พิมพ์ใต้คอลัมน์แรก", "field": "สนาม", - "fields": "ทุ่งนา ·", - "fieldsShown_one": "แสดง 1 ฟิลด์", - "fieldsShown_other": "แสดง {{count}} ฟิลด์", "filtersFields": "ตัวกรองและฟิลด์", - "match": "จับคู่", - "noConditionsThisViewShowsEvery": "ไม่มีเงื่อนไข — มุมมองนี้แสดงทุกรายการ", - "ofTheFollowing": "ดังต่อไปนี้", "off": "ปิด", "operator": "ผู้ดำเนินการ", "removeCondition": "ถอนเงื่อนไข", diff --git a/frontend/src/i18n/locales/tr.json b/frontend/src/i18n/locales/tr.json index 9cbdc376..eff8903c 100644 --- a/frontend/src/i18n/locales/tr.json +++ b/frontend/src/i18n/locales/tr.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Koşul ekle", - "conditions": "Koşullar", - "conditions_one": "1 koşul", - "conditions_other": "{{count}} koşul", "density": "Yoğunluk", "extraFieldsPrintedUnderTheFirst": "İlk sütunun altına yazdırılan ekstra alanlar.", "field": "Alan", - "fields": "Alanlar ·", - "fieldsShown_one": "1 alan gösteriliyor", - "fieldsShown_other": "{{count}} alan gösteriliyor", "filtersFields": "Filtreler ve alanlar", - "match": "Kibrit", - "noConditionsThisViewShowsEvery": "Koşul yok — bu görünüm her koşulu gösterir", - "ofTheFollowing": "aşağıdakilerden", "off": "Kapalı", "operator": "Operatör", "removeCondition": "Koşulu kaldır", diff --git a/frontend/src/i18n/locales/vi.json b/frontend/src/i18n/locales/vi.json index e648e304..f17d165f 100644 --- a/frontend/src/i18n/locales/vi.json +++ b/frontend/src/i18n/locales/vi.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "Thêm điều kiện", - "conditions": "Điều kiện", - "conditions_one": "1 điều kiện", - "conditions_other": "{{count}} điều kiện", "density": "Tỉ trọng", "extraFieldsPrintedUnderTheFirst": "Các trường bổ sung được in dưới cột đầu tiên.", "field": "Cánh đồng", - "fields": "Cánh đồng ·", - "fieldsShown_one": "Hiển thị 1 trường", - "fieldsShown_other": "Hiển thị {{count}} trường", "filtersFields": "Bộ lọc & trường", - "match": "Cuộc thi đấu", - "noConditionsThisViewShowsEvery": "Không có điều kiện - chế độ xem này hiển thị mọi", - "ofTheFollowing": "những điều sau đây", "off": "Tắt", "operator": "Toán tử", "removeCondition": "Xóa điều kiện", diff --git a/frontend/src/i18n/locales/zh-Hans.json b/frontend/src/i18n/locales/zh-Hans.json index 6bf57d18..c75b1d70 100644 --- a/frontend/src/i18n/locales/zh-Hans.json +++ b/frontend/src/i18n/locales/zh-Hans.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "添加条件", - "conditions": "状况", - "conditions_one": "1 个条件", - "conditions_other": "{{count}} 个条件", "density": "密度", "extraFieldsPrintedUnderTheFirst": "额外字段打印在第一列下。", "field": "场地", - "fields": "领域 ·", - "fieldsShown_one": "显示 1 个字段", - "fieldsShown_other": "显示 {{count}} 个字段", "filtersFields": "过滤器和字段", - "match": "匹配", - "noConditionsThisViewShowsEvery": "无条件 — 该视图显示了所有", - "ofTheFollowing": "以下的", "off": "关闭", "operator": "操作员", "removeCondition": "删除条件", diff --git a/frontend/src/i18n/locales/zh-Hant.json b/frontend/src/i18n/locales/zh-Hant.json index 1751e473..8cfdad6e 100644 --- a/frontend/src/i18n/locales/zh-Hant.json +++ b/frontend/src/i18n/locales/zh-Hant.json @@ -2970,19 +2970,10 @@ }, "gridFilterDrawer": { "addCondition": "新增條件", - "conditions": "條件", - "conditions_one": "1 個條件", - "conditions_other": "{{count}} 個條件", "density": "密度", "extraFieldsPrintedUnderTheFirst": "其他欄位顯示在第一欄下方。", "field": "欄位", - "fields": "欄位 ·", - "fieldsShown_one": "顯示 1 個欄位", - "fieldsShown_other": "顯示 {{count}} 個欄位", "filtersFields": "篩選器和欄位", - "match": "相符", - "noConditionsThisViewShowsEvery": "無條件 — 此檢視顯示了所有", - "ofTheFollowing": "以下的", "off": "關閉", "operator": "運算子", "removeCondition": "刪除條件", diff --git a/frontend/src/styles/components/_datagrid.scss b/frontend/src/styles/components/_datagrid.scss index 2c38a007..c93c111b 100644 --- a/frontend/src/styles/components/_datagrid.scss +++ b/frontend/src/styles/components/_datagrid.scss @@ -825,55 +825,31 @@ padding: 0; } - &__tabs { + // The pane switch is the drawer's header. The right padding keeps it clear + // of the sheet's close button, which sits in the same corner. + &__head { display: flex; - gap: $space-hair; - padding: 0 $space-4; + align-items: center; + padding: $space-4 calc(#{$space-4} + #{$control-sm} + #{$space-3}) $space-4 $space-4; border-bottom: 1px solid var(--border); - background: var(--surface-0); flex-shrink: 0; + } - button { - position: relative; - display: flex; - align-items: center; - gap: $space-2; - height: $control-lg; // underline tabs: 40 - padding: 0 $space-3; - border: none; - background: transparent; - font-size: $text-sm; - font-weight: $font-weight-medium; - font-family: inherit; - color: var(--text-faint); - cursor: pointer; - transition: color 0.13s; + &__switch button { + display: inline-flex; + align-items: center; + gap: $space-2; + font-size: $text-sm; + } - &:hover { color: var(--text-dim); } - &.is-on { color: var(--text); } - - &.is-on::after { - content: ''; - position: absolute; - left: 8px; - right: 8px; - bottom: -1px; - height: 2px; - border-radius: $radius-badge $radius-badge 0 0; - background: var(--accent); - } - - .n { - font-size: $text-xs; - color: var(--text-ghost); - background: var(--surface-2); - border: 1px solid var(--border-soft); - border-radius: $radius-control; - padding: 1px $space-tight; - } - - &.is-on .n { color: var(--text-dim); background: var(--surface-3); border-color: var(--border); } - } + // Count beside a pane's name: active conditions, or shown/total fields. + &__n { + padding: 0 $space-tight; + border-radius: $radius-control; + background: var(--surface-2); + color: var(--text-dim); + font-size: $text-xs; + font-variant-numeric: tabular-nums; } &__body { flex: 1; overflow-y: auto; } @@ -882,15 +858,48 @@ display: flex; align-items: center; gap: $space-2; - padding: $space-4 $space-5; + padding: $space-3 $space-5; border-top: 1px solid var(--border); background: var(--surface-0); flex-shrink: 0; } + // How many rows the current conditions leave. + &__count { + font-size: $text-sm; + color: var(--text-dim); + font-variant-numeric: tabular-nums; + } + &__sp { flex: 1; } } +// Empty filters pane: what is showing, and one tap to start narrowing it. +.sk-gridstart { + display: flex; + flex-direction: column; + gap: $space-3; + + &__lead { + margin: 0; + font-size: $text-sm; + color: var(--text-dim); + } + + // A field chip that adds a condition on that field. Doubled class: it is + // also a .sk-gridrule__tag, whose capitalize would turn "Last seen" into + // "Last Seen". + &__field.sk-gridrule__tag { + display: inline-flex; + align-items: center; + gap: $space-tight; + text-transform: none; + + svg { color: var(--text-ghost); } + &:hover svg { color: var(--accent-bright); } + } +} + .sk-gridsec { padding: $space-5 $space-5; border-bottom: 1px solid var(--border-soft); @@ -910,30 +919,35 @@ flex: 1; } + // Right-hand figure on a section head ("9 of 12 shown"). + &__meta { + font-size: $text-xs; + color: var(--text-ghost); + font-variant-numeric: tabular-nums; + } + + // "Add condition": sits where the next condition will appear. &__add { display: flex; align-items: center; + justify-content: center; gap: $space-tight; - font-size: $text-xs; - font-family: inherit; - color: var(--accent-bright); - height: $control-sm; - padding: 0 $space-2; - border: none; - border-radius: $radius-control; - background: transparent; - cursor: pointer; - - &:hover { background: var(--accent-bg); } - } - - &__none { - padding: $space-4; + width: 100%; + height: $control-md; + margin-top: $space-3; border: 1px dashed var(--border); border-radius: $radius-card; - text-align: center; + background: transparent; + color: var(--text-dim); font-size: $text-sm; - color: var(--text-ghost); + font-family: inherit; + cursor: pointer; + transition: 0.12s; + + &:hover { + border-color: var(--accent-dim); + @include status-variant(var(--accent-bright), var(--accent-bg)); + } } &__hint { @@ -945,15 +959,6 @@ &__tags { display: flex; flex-wrap: wrap; gap: 6px; } } -.sk-gridmatch { - display: inline-flex; - align-items: center; - gap: $space-2; - font-size: $text-sm; - color: var(--text-faint); - margin-bottom: $space-3; -} - .sk-gridseg { display: inline-flex; gap: $space-hair; @@ -980,12 +985,16 @@ &--wide { width: fit-content; } } +// One condition: field, operator and remove on a row, its value underneath. .sk-gridrule { display: grid; - grid-template-columns: 1fr 116px $control-md; - gap: $space-tight; + grid-template-columns: 1fr 132px $control-md; + gap: $space-2 $space-tight; align-items: center; - margin-bottom: $space-2; + padding: $space-3; + border: 1px solid var(--border-soft); + border-radius: $radius-card; + background: var(--surface-0); &__value { grid-column: 1 / -1; } @@ -1027,10 +1036,20 @@ &:hover { @include status-variant(var(--red), var(--red-bg)); } } + // Between two conditions: the and/or switch, on a hairline that ties the + // two cards together. &__join { - font-size: $text-xs; - color: var(--text-ghost); - padding: 1px 0 $space-tight $space-hair; + display: flex; + align-items: center; + gap: $space-2; + margin-block: $space-2; + + &::before, + &::after { + content: ''; + flex: 1; + border-top: 1px solid var(--border-soft); + } } &__enum { display: flex; flex-wrap: wrap; gap: 6px; } @@ -1071,6 +1090,8 @@ &:hover { background: var(--surface-2); border-color: var(--border); } &.is-drag { opacity: 0.35; } &.is-off .sk-gridcol__nm { color: var(--text-ghost); } + // A pinned column cannot be moved, so it offers no handle. + &.is-locked .sk-gridcol__grip { visibility: hidden; } &__grip { color: var(--text-ghost); display: grid; place-items: center; cursor: grab; } &__nm { flex: 1; min-width: 0; }