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:
@@ -172,8 +172,17 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
|||||||
() => (lat == null || lon == null ? null : sunTimes(new Date(), lat, lon)),
|
() => (lat == null || lon == null ? null : sunTimes(new Date(), lat, lon)),
|
||||||
[lat, lon],
|
[lat, lon],
|
||||||
);
|
);
|
||||||
|
// Stacked, not side by side. Laid out in a row this cost about 150 px of a
|
||||||
|
// header that has to hold the callsign, the badges and the band grid, and it
|
||||||
|
// was what pushed the whole row onto a second line. Two short times one above
|
||||||
|
// the other take a fraction of that and no extra height: the row is already
|
||||||
|
// taller than one line of text.
|
||||||
|
//
|
||||||
|
// "UTC" moves into the tooltip with them — the times are monospaced and always
|
||||||
|
// UTC everywhere in OpsLog, so the label was spending width to repeat a
|
||||||
|
// convention the operator already lives by.
|
||||||
const sunBlock = sun ? (
|
const sunBlock = sun ? (
|
||||||
<div className="ml-auto flex items-center gap-3 text-xs shrink-0"
|
<div className="ml-auto flex flex-col items-end leading-tight text-xs shrink-0"
|
||||||
title="Sunrise / sunset at the DX station (UTC)">
|
title="Sunrise / sunset at the DX station (UTC)">
|
||||||
{sun.polarDay ? (
|
{sun.polarDay ? (
|
||||||
<span className="font-semibold text-warning">midnight sun</span>
|
<span className="font-semibold text-warning">midnight sun</span>
|
||||||
@@ -182,14 +191,13 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<span className="flex items-center gap-1">
|
<span className="flex items-center gap-1">
|
||||||
<Sunrise className="size-3.5 text-warning" />
|
<Sunrise className="size-3 text-warning" />
|
||||||
<span className="font-mono tabular-nums">{sun.rise || '—'}</span>
|
<span className="font-mono tabular-nums">{sun.rise || '—'}</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="flex items-center gap-1">
|
<span className="flex items-center gap-1">
|
||||||
<Sunset className="size-3.5 text-info" />
|
<Sunset className="size-3 text-info" />
|
||||||
<span className="font-mono tabular-nums">{sun.set || '—'}</span>
|
<span className="font-mono tabular-nums">{sun.set || '—'}</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="text-muted-foreground">UTC</span>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -121,7 +121,12 @@ const STATUS_VALUES: { v: string; label: string }[] = [
|
|||||||
{ v: '_', label: 'bulk.statusBlank' },
|
{ 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.
|
// Maps the internal group key → its i18n label key.
|
||||||
const GROUP_LABELS: Record<string, string> = {
|
const GROUP_LABELS: Record<string, string> = {
|
||||||
'QSL / upload': 'bulk.groupQsl',
|
'QSL / upload': 'bulk.groupQsl',
|
||||||
@@ -130,6 +135,7 @@ const GROUP_LABELS: Record<string, string> = {
|
|||||||
'Contest': 'bulk.groupContest',
|
'Contest': 'bulk.groupContest',
|
||||||
'Propagation': 'bulk.groupPropagation',
|
'Propagation': 'bulk.groupPropagation',
|
||||||
'Misc': 'bulk.groupMisc',
|
'Misc': 'bulk.groupMisc',
|
||||||
|
'The contact': 'bulk.groupContact',
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -188,7 +194,7 @@ export function BulkEditModal({ open, ids, onClose, onApplied }: Props) {
|
|||||||
<SelectContent>
|
<SelectContent>
|
||||||
{GROUPS.map((g) => (
|
{GROUPS.map((g) => (
|
||||||
<div key={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)
|
{FIELDS.filter((f) => f.group === g)
|
||||||
.map((f) => ({ f, txt: t(f.label) }))
|
.map((f) => ({ f, txt: t(f.label) }))
|
||||||
.sort((a, b) => a.txt.localeCompare(b.txt))
|
.sort((a, b) => a.txt.localeCompare(b.txt))
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user