fix(awards): hide Missing refs where it cannot mean anything

"In this award's scope but with no reference" needs a scope to be in. On a
worldwide reference award — POTA, SOTA, IOTA, WWFF — every contact anywhere
would qualify, so the backend returns nothing and the window says it found
nothing. The button was there regardless, and could only ever open that.

It now appears only for an award scoped to a DXCC entity, which is what the
help text underneath used to have to explain. Better than what I did first,
which was to make a useless screen fast.

Kept from that: the assign dropdown is searched rather than scrolled above 300
references, and the reference list is not fetched until there are rows to
assign it to. Both still bite on a scoped award with a long list — Russian
districts, the bigger European ones.
This commit is contained in:
2026-08-16 18:04:34 +02:00
parent e81500f809
commit b5a88ee5a2
3 changed files with 23 additions and 13 deletions
+2 -2
View File
@@ -4,11 +4,11 @@
"date": "",
"en": [
"Opening the Awards panel no longer pulls the whole logbook several times at once — a large log briefly took gigabytes of memory.",
"Awards Missing refs no longer freezes on an award with a huge reference list, POTA above all: the list is searched, not scrolled."
"Awards: the Missing refs button now only appears where it means something — a worldwide award like POTA could only ever answer “nothing found”."
],
"fr": [
"Ouvrir le panneau Awards ne tire plus plusieurs fois le journal entier en même temps — un gros log occupait brièvement des gigaoctets de mémoire.",
"Awards Réf. manquantes ne fige plus sur un diplôme à très longue liste de références, POTA en tête : la liste se cherche, elle ne se déroule plus."
"Awards : le bouton Réf. manquantes napparaît plus que là où il a un sens — un diplôme mondial comme POTA ne pouvait répondre que « aucun manque »."
]
},
{
+12 -2
View File
@@ -64,7 +64,9 @@ function ProgressBar({ worked, confirmed, total }: { worked: number; confirmed:
);
}
type AwardListItem = { code: string; name: string; valid?: boolean; bands?: string[]; emission?: string[] };
// scoped: the award is limited to one or more DXCC entities. Missing-reference
// detection only means anything for those — see the Missing refs button.
type AwardListItem = { code: string; name: string; valid?: boolean; bands?: string[]; emission?: string[]; scoped?: boolean };
export function AwardsPanel({ onEditQSO, onAwardsChanged }: { onEditQSO?: (id: number) => void; onAwardsChanged?: () => void } = {}) {
const { t } = useI18n();
@@ -150,7 +152,7 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged }: { onEditQSO?: (id: n
]);
const follow = new Set(tracked);
let list: AwardListItem[] = defs
.map((d) => ({ code: d.code, name: d.name, valid: d.valid, bands: d.valid_bands ?? [], emission: d.emission ?? [] }))
.map((d) => ({ code: d.code, name: d.name, valid: d.valid, bands: d.valid_bands ?? [], emission: d.emission ?? [], scoped: (d.dxcc_filter ?? []).length > 0 }))
.sort((a, b) => a.code.localeCompare(b.code));
if (follow.size > 0) list = list.filter((a) => follow.has(a.code));
setAwardList(list);
@@ -427,6 +429,13 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged }: { onEditQSO?: (id: n
))}
</div>
<span className="text-xs text-muted-foreground">{filteredRefs.length} {t('awp.refs')}</span>
{/* Only for an award scoped to a DXCC entity. "In this award's
scope but with no reference" needs a scope to be in: on a
worldwide reference award — POTA, SOTA, IOTA, WWFF — every
contact anywhere would qualify, so the answer is always none.
The button used to be there regardless and could only ever
open a window saying it had found nothing. */}
{awardList.find((a) => a.code === selected)?.scoped && (
<button
onClick={() => setShowMissing(true)}
className="flex items-center gap-1 text-xs text-warning-muted-foreground hover:text-warning border border-warning-border bg-warning-muted rounded px-2 py-1"
@@ -434,6 +443,7 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged }: { onEditQSO?: (id: n
>
<AlertTriangle className="size-3" /> {t('awp.missingRefs')}
</button>
)}
<div className="flex-1" />
{/* Legend */}
<div className="flex items-center gap-2 text-[10px] text-muted-foreground">
File diff suppressed because one or more lines are too long