fix(bulk): a group missing from a hand-written list never rendered

The dialog walked a hand-written GROUPS array. "The contact" was added to the
fields and not to it, so mode, submode and RST existed, passed every check I had
written, and could not be picked — the same shape of fault as the missing column
mapping, one layer further out. Two lists that must agree, with nothing making
them agree.

GROUPS is derived from the fields now, in declaration order, so adding a group
is adding a field. A group with no translation falls back to its own name rather
than rendering an empty heading: a missing label should look untidy, not
invisible.

Also stacks the DX sunrise/sunset in the band-slot header. Side by side it cost
about 150 px of a row that also carries the callsign, the badges and the band
grid, and it was what pushed that row onto a second line. Two short times one
above the other cost a fraction of it and no extra height — the row is already
taller than one line of text. The "UTC" label goes to the tooltip: the times are
monospaced and always UTC everywhere in OpsLog, so it was spending width to
repeat a convention the operator already lives by.
This commit is contained in:
2026-08-11 20:46:59 +02:00
parent 2a6e09a1d7
commit 210a99983e
3 changed files with 22 additions and 8 deletions
+8 -2
View File
@@ -121,7 +121,12 @@ const STATUS_VALUES: { v: string; label: string }[] = [
{ v: '_', label: 'bulk.statusBlank' },
];
const GROUPS = ['QSL / upload', 'My station', 'Contacted station', 'Contest', 'Propagation', 'Misc'];
// Derived from the fields themselves, in the order they are declared.
//
// This used to be a hand-written list, and a group added to FIELDS but not to it
// simply never rendered — the fields existed, passed every check, and could not
// be picked. Two lists that must agree, with nothing to make them.
const GROUPS = [...new Set(FIELDS.map((f) => f.group))];
// Maps the internal group key → its i18n label key.
const GROUP_LABELS: Record<string, string> = {
'QSL / upload': 'bulk.groupQsl',
@@ -130,6 +135,7 @@ const GROUP_LABELS: Record<string, string> = {
'Contest': 'bulk.groupContest',
'Propagation': 'bulk.groupPropagation',
'Misc': 'bulk.groupMisc',
'The contact': 'bulk.groupContact',
};
type Props = {
@@ -188,7 +194,7 @@ export function BulkEditModal({ open, ids, onClose, onApplied }: Props) {
<SelectContent>
{GROUPS.map((g) => (
<div key={g}>
<div className="px-2 py-1 text-[10px] uppercase tracking-wider text-muted-foreground">{t(GROUP_LABELS[g])}</div>
<div className="px-2 py-1 text-[10px] uppercase tracking-wider text-muted-foreground">{GROUP_LABELS[g] ? t(GROUP_LABELS[g]) : g}</div>
{FIELDS.filter((f) => f.group === g)
.map((f) => ({ f, txt: t(f.label) }))
.sort((a, b) => a.txt.localeCompare(b.txt))