fix(decodes): new-band-mode had no badge, so its rows looked unfiltered
A station new on this band AND in this mode is one status, 'new-band-mode', and the badge table has an entry for neither half. The lookup returned nothing, so those rows showed only their grid or prefix badge — and with NEW/BAND/MODE selected, a row whose visible badges were LOC and PFX read as the filter letting through things nobody asked for. It was not: the row belonged there and the panel failed to say why. catsOf has always split that status into its two categories for filtering. The badges now do the same on screen.
This commit is contained in:
@@ -316,6 +316,22 @@ const ENTITY_BADGE: Record<string, { label: string; cls: string }> = {
|
||||
'new-call': { label: 'dec.stCall', cls: 'bg-muted text-muted-foreground' },
|
||||
};
|
||||
|
||||
// entityBadgesFor turns a status into the badges that describe it.
|
||||
//
|
||||
// A LIST, because "new-band-mode" is two facts at once — new on this band and
|
||||
// new in this mode — and the map above has an entry for neither. It was read
|
||||
// with a single lookup, which returned nothing for that status: those rows
|
||||
// passed the BAND and MODE filters and then showed no reason for being there,
|
||||
// which is precisely what was reported. catsOf has always split the status into
|
||||
// its two categories; this is the same split, on the screen.
|
||||
function entityBadgesFor(status: string): { label: string; cls: string }[] {
|
||||
if (status === 'new-band-mode') {
|
||||
return [ENTITY_BADGE['new-band'], ENTITY_BADGE['new-mode']];
|
||||
}
|
||||
const one = ENTITY_BADGE[status];
|
||||
return one ? [one] : [];
|
||||
}
|
||||
|
||||
// The orthogonal ones: a station already worked for its entity can still be a
|
||||
// new grid, a new prefix or a park never logged.
|
||||
//
|
||||
@@ -1004,10 +1020,10 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
{g.decodes.map((d, i) => {
|
||||
const e = statusOf(d);
|
||||
const st = e?.status && e.status !== 'worked' ? e.status : '';
|
||||
const entity = st ? ENTITY_BADGE[st] : undefined;
|
||||
const entities = st ? entityBadgesFor(st) : [];
|
||||
const extras = EXTRA_BADGES.filter((b) => !!e?.[b.key]);
|
||||
const mine = !!me && d.call === me;
|
||||
const hot = !!entity || extras.length > 0;
|
||||
const hot = entities.length > 0 || extras.length > 0;
|
||||
// Someone answering us outranks everything else on the screen.
|
||||
const replying = answersMe(d.msg);
|
||||
// The station we are calling, so it can be picked out of a slot
|
||||
@@ -1096,11 +1112,11 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
{t('dec.wkd')}
|
||||
</span>
|
||||
)}
|
||||
{entity && (
|
||||
<span className={cn('rounded px-1 py-px text-[10px] font-bold uppercase tracking-wide shrink-0', entity.cls)}>
|
||||
{t(entity.label)}
|
||||
{entities.map((b) => (
|
||||
<span key={b.label} className={cn('rounded px-1 py-px text-[10px] font-bold uppercase tracking-wide shrink-0', b.cls)}>
|
||||
{t(b.label)}
|
||||
</span>
|
||||
)}
|
||||
))}
|
||||
{extras.map((b) => {
|
||||
// A square WORKED but not yet confirmed is a different job
|
||||
// from one never worked: a QSL to chase, not a QSO to make.
|
||||
|
||||
Reference in New Issue
Block a user