up
This commit is contained in:
@@ -11,10 +11,21 @@ interface Props {
|
||||
busy: boolean;
|
||||
currentBand: string;
|
||||
currentMode: string;
|
||||
bands?: string[]; // operator's configured bands; falls back to DEFAULT_BANDS
|
||||
}
|
||||
|
||||
// 13-column band layout — no 4m, no SHF (per user preference).
|
||||
const BANDS: { tag: string; label: string }[] = [
|
||||
// Compact column label for a band tag: keep the classic V/U for 2m/70cm,
|
||||
// strip the trailing "m" for meter bands (160m→160), and shorten cm bands
|
||||
// (13cm→13c) so the column stays narrow.
|
||||
function bandColLabel(tag: string): string {
|
||||
if (tag === '2m') return 'V';
|
||||
if (tag === '70cm') return 'U';
|
||||
if (tag.endsWith('cm')) return tag.replace('cm', 'c');
|
||||
return tag.replace(/m$/, '');
|
||||
}
|
||||
|
||||
// Default 13-column band layout, used when the operator hasn't configured bands.
|
||||
const DEFAULT_BANDS: { tag: string; label: string }[] = [
|
||||
{ tag: '160m', label: '160' },
|
||||
{ tag: '80m', label: '80' },
|
||||
{ tag: '60m', label: '60' },
|
||||
@@ -67,7 +78,13 @@ function cellTitle(band: string, cls: string, status: string, current: boolean):
|
||||
return `${band} ${cls}: ${desc}${current ? ' — current entry' : ''}`;
|
||||
}
|
||||
|
||||
export function BandSlotGrid({ wb, busy, currentBand, currentMode }: Props) {
|
||||
export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands }: Props) {
|
||||
// Columns from the operator's configured bands (so the matrix shows only the
|
||||
// bands they actually use), falling back to the built-in default set.
|
||||
const cols = useMemo(
|
||||
() => (bands && bands.length ? bands.map((tag) => ({ tag, label: bandColLabel(tag) })) : DEFAULT_BANDS),
|
||||
[bands],
|
||||
);
|
||||
const dxcc = wb?.dxcc ?? 0;
|
||||
const dxccName = wb?.dxcc_name ?? '';
|
||||
const dxccCount = wb?.dxcc_count ?? 0;
|
||||
@@ -136,7 +153,7 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode }: Props) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="w-[26px]" />
|
||||
{BANDS.map((b) => (
|
||||
{cols.map((b) => (
|
||||
<th
|
||||
key={b.tag}
|
||||
className={cn(
|
||||
@@ -162,7 +179,7 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode }: Props) {
|
||||
>
|
||||
{cls}
|
||||
</th>
|
||||
{BANDS.map((b) => {
|
||||
{cols.map((b) => {
|
||||
const st = statusMap.get(`${b.tag}|${cls}`) ?? '';
|
||||
const isCurrent = b.tag === currentBand && classCurrent;
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user