feat: Complete translation in French
This commit is contained in:
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { Trophy } from 'lucide-react';
|
||||
import { ListContests, ContestStats } from '../../wailsjs/go/main/App';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
|
||||
// ContestSession is the live contest-mode state, persisted as JSON in a UI pref
|
||||
// so a running contest (serial counter included) survives a restart.
|
||||
@@ -49,6 +50,7 @@ export function ContestPanel({ session, onChange }: {
|
||||
session: ContestSession;
|
||||
onChange: (patch: Partial<ContestSession>) => void;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const [contests, setContests] = useState<Def[]>([]);
|
||||
const [stats, setStats] = useState<Stats | null>(null);
|
||||
|
||||
@@ -84,14 +86,14 @@ export function ContestPanel({ session, onChange }: {
|
||||
<div className="rounded-xl border border-border bg-card shadow-sm overflow-hidden">
|
||||
<div className="flex items-center gap-2 px-4 py-2.5 border-b border-border/60 bg-muted/30">
|
||||
<Trophy className="size-4 text-amber-500" />
|
||||
<span className="text-xs font-bold uppercase tracking-wider text-foreground/80">Contest setup</span>
|
||||
{session.active && <span className="ml-auto rounded bg-amber-500 px-2 py-0.5 text-[10px] font-black uppercase tracking-wider text-white">Live</span>}
|
||||
<span className="text-xs font-bold uppercase tracking-wider text-foreground/80">{t('ctp.contestSetup')}</span>
|
||||
{session.active && <span className="ml-auto rounded bg-amber-500 px-2 py-0.5 text-[10px] font-black uppercase tracking-wider text-white">{t('ctp.live')}</span>}
|
||||
</div>
|
||||
<div className="p-4 space-y-3">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<select value={session.code} onChange={(e) => pickContest(e.target.value)}
|
||||
className="rounded-md border border-border bg-card px-2 py-1.5 text-sm flex-1 min-w-[220px]">
|
||||
<option value="">— choose a contest —</option>
|
||||
<option value="">{t('ctp.chooseContest')}</option>
|
||||
{contests.map((c) => <option key={c.code} value={c.code}>{c.name}</option>)}
|
||||
</select>
|
||||
{session.code && <code className="text-xs text-muted-foreground">{session.code}</code>}
|
||||
@@ -103,14 +105,14 @@ export function ContestPanel({ session, onChange }: {
|
||||
<button key={x} type="button" onClick={() => onChange({ exchange: x })}
|
||||
className={cn('px-3 py-1.5 text-xs font-bold border-l border-border first:border-l-0',
|
||||
session.exchange === x ? 'bg-primary text-primary-foreground' : 'bg-card text-muted-foreground hover:bg-muted')}>
|
||||
{x === 'serial' ? 'Serial' : 'Fixed exchange'}
|
||||
{x === 'serial' ? t('ctp.serial') : t('ctp.fixedExchange')}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{session.exchange === 'serial' ? (
|
||||
<label className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
Next serial
|
||||
{t('ctp.nextSerial')}
|
||||
<input type="number" min={1} value={session.nextSerial}
|
||||
onChange={(e) => onChange({ nextSerial: Math.max(1, parseInt(e.target.value || '1', 10)) })}
|
||||
className="w-20 rounded-md border border-border bg-card px-2 py-1.5 text-sm font-mono" />
|
||||
@@ -122,7 +124,7 @@ export function ContestPanel({ session, onChange }: {
|
||||
{FIXED_KINDS.map((k) => <option key={k} value={k}>{k}</option>)}
|
||||
</select>
|
||||
<input value={session.sentFixed} onChange={(e) => onChange({ sentFixed: e.target.value.toUpperCase() })}
|
||||
placeholder="your exchange" className="w-32 rounded-md border border-border bg-card px-2 py-1.5 text-sm font-mono" />
|
||||
placeholder={t('ctp.yourExchangePh')} className="w-32 rounded-md border border-border bg-card px-2 py-1.5 text-sm font-mono" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -131,35 +133,35 @@ export function ContestPanel({ session, onChange }: {
|
||||
dupe check — so old runs of the same contest aren't included. */}
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<label className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
Start (UTC)
|
||||
{t('ctp.startUtc')}
|
||||
<input type="datetime-local" value={isoToUtcInput(session.startISO)}
|
||||
onChange={(e) => onChange({ startISO: utcInputToISO(e.target.value) })}
|
||||
className="rounded-md border border-border bg-card px-2 py-1.5 text-sm" />
|
||||
</label>
|
||||
<label className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
End (UTC)
|
||||
{t('ctp.endUtc')}
|
||||
<input type="datetime-local" value={isoToUtcInput(session.endISO)}
|
||||
onChange={(e) => onChange({ endISO: utcInputToISO(e.target.value) })}
|
||||
className="rounded-md border border-border bg-card px-2 py-1.5 text-sm" />
|
||||
</label>
|
||||
<span className="text-[11px] text-muted-foreground">empty end = open · leave blank to count all</span>
|
||||
<span className="text-[11px] text-muted-foreground">{t('ctp.windowHint')}</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 pt-1">
|
||||
{session.active ? (
|
||||
<button type="button" onClick={() => onChange({ active: false })}
|
||||
className="rounded-md border border-rose-500/60 bg-rose-500/10 px-4 py-1.5 text-sm font-bold text-rose-600 hover:bg-rose-500/20">
|
||||
Stop contest
|
||||
{t('ctp.stopContest')}
|
||||
</button>
|
||||
) : (
|
||||
<button type="button" disabled={!session.code}
|
||||
onClick={() => onChange({ active: true, startISO: session.startISO || new Date().toISOString() })}
|
||||
className="rounded-md bg-amber-500 px-4 py-1.5 text-sm font-bold text-white hover:bg-amber-600 disabled:opacity-40">
|
||||
Start contest
|
||||
{t('ctp.startContest')}
|
||||
</button>
|
||||
)}
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{session.active ? 'The entry form shows Snt/Rcv and a DUPE badge; QSOs are stamped with this contest.' : 'Pick a contest, set the window, then Start.'}
|
||||
{session.active ? t('ctp.activeHint') : t('ctp.inactiveHint')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -169,22 +171,22 @@ export function ContestPanel({ session, onChange }: {
|
||||
{session.active && (
|
||||
<div className="rounded-xl border border-border bg-card shadow-sm overflow-hidden">
|
||||
<div className="flex items-center gap-2 px-4 py-2.5 border-b border-border/60 bg-muted/30">
|
||||
<span className="text-xs font-bold uppercase tracking-wider text-foreground/80">Scoreboard</span>
|
||||
<span className="text-[10px] text-muted-foreground">estimate</span>
|
||||
<span className="text-xs font-bold uppercase tracking-wider text-foreground/80">{t('ctp.scoreboard')}</span>
|
||||
<span className="text-[10px] text-muted-foreground">{t('ctp.estimate')}</span>
|
||||
</div>
|
||||
<div className="p-4 space-y-4">
|
||||
<div className="grid grid-cols-2 sm:grid-cols-4 gap-2">
|
||||
<Stat label="QSOs" value={stats?.qsos ?? 0} />
|
||||
<Stat label={stats?.mult_label || 'Mult'} value={stats?.mult ?? 0} accent="#f59e0b" />
|
||||
<Stat label="Score (est.)" value={(stats?.score ?? 0).toLocaleString()} accent="#16a34a" />
|
||||
<Stat label="Last 60 min" value={stats?.last_hour ?? 0} />
|
||||
<Stat label={t('ctp.qsos')} value={stats?.qsos ?? 0} />
|
||||
<Stat label={stats?.mult_label || t('ctp.mult')} value={stats?.mult ?? 0} accent="#f59e0b" />
|
||||
<Stat label={t('ctp.scoreEst')} value={(stats?.score ?? 0).toLocaleString()} accent="#16a34a" />
|
||||
<Stat label={t('ctp.last60')} value={stats?.last_hour ?? 0} />
|
||||
</div>
|
||||
{stats && stats.by_band && stats.by_band.length > 0 && (
|
||||
<div className="rounded-lg border border-border overflow-hidden">
|
||||
<table className="w-full text-sm">
|
||||
<thead><tr className="bg-muted/40 text-[11px] uppercase tracking-wider text-muted-foreground">
|
||||
<th className="text-left px-3 py-1.5 font-bold">Band</th>
|
||||
<th className="text-right px-3 py-1.5 font-bold">QSOs</th>
|
||||
<th className="text-left px-3 py-1.5 font-bold">{t('ctp.band')}</th>
|
||||
<th className="text-right px-3 py-1.5 font-bold">{t('ctp.qsos')}</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
{stats.by_band.map((r) => (
|
||||
|
||||
Reference in New Issue
Block a user