feat(entry): normalise Name/QTH/Comment/Note case, upper-case the Recent QSOs search
One station reaches the log SHOUTED by QRZ, lower-cased by a hurried
operator and in whatever case an imported ADIF carried, so the same name
appears three ways across a log. Name and QTH are now title-cased word by
word; Comment and Note only get a capital first letter, because the rest
routinely holds callsigns and modes ("TNX QSO F5ABC, FT8 59") that
lower-casing would destroy.
Normalised on blur, never per keystroke — rewriting the value mid-word
fights the typist (the controlled-input trap in CLAUDE.md). Applied in
both entry layouts and in the QSO editor, since leaving the editor alone
would just reintroduce the mess on the first correction.
The Recent QSOs box only ever searches callsigns, so it upper-cases as
you type and carries an inline clear button.
This commit is contained in:
+10
-2
@@ -10,7 +10,11 @@
|
|||||||
"UDP outbound: a QSO logged from WSJT-X / JTDX / MSHV (via the inbound UDP listener) is now forwarded to the outbound ADIF integrations too — previously only QSOs typed directly into OpsLog were re-emitted.",
|
"UDP outbound: a QSO logged from WSJT-X / JTDX / MSHV (via the inbound UDP listener) is now forwarded to the outbound ADIF integrations too — previously only QSOs typed directly into OpsLog were re-emitted.",
|
||||||
"Backup: with \"back up on every exit\", a new \"Keep every backup\" sub-option writes a distinct time-stamped file per exit (opslog-YYYY-MM-DD-HHMMSS.db) instead of overwriting the day's file. Rotation still keeps the newest N — raise it for more history.",
|
"Backup: with \"back up on every exit\", a new \"Keep every backup\" sub-option writes a distinct time-stamped file per exit (opslog-YYYY-MM-DD-HHMMSS.db) instead of overwriting the day's file. Rotation still keeps the newest N — raise it for more history.",
|
||||||
"Awards editor: the PRIMARY QSOFIELDS search now has a Prefix field too (prepended to each found reference, e.g. captured 01 → D01) — previously only the OR fallback searches could add a prefix, so a DOK-style award couldn't match on its main rule.",
|
"Awards editor: the PRIMARY QSOFIELDS search now has a Prefix field too (prepended to each found reference, e.g. captured 01 → D01) — previously only the OR fallback searches could add a prefix, so a DOK-style award couldn't match on its main rule.",
|
||||||
"CAT: new Elecraft K3/K4 backend in the rig list. Select it (it reuses the Kenwood USB/network settings) and digital modes automatically use DATA A (MD6+DT0) — the sub-mode FT8 audio needs, so the K3 no longer keys the transmitter without modulating."
|
"CAT: new Elecraft K3/K4 backend in the rig list. Select it (it reuses the Kenwood USB/network settings) and digital modes automatically use DATA A (MD6+DT0) — the sub-mode FT8 audio needs, so the K3 no longer keys the transmitter without modulating.",
|
||||||
|
"Settings database: the New / Open existing / Save a copy / Rename / Reset buttons are back (Settings → Database). Only \"Open folder\" was left, which opens Windows Explorer — where a .db can't be selected, it just asks which program should open it. Picking a database now uses a proper file dialog and offers a one-click restart.",
|
||||||
|
"Recent QSOs: a column dragged to sit AFTER an award column now stays there. Award columns were left out of the saved layout, so on reload they were pushed to the far right and jumped back in front of the column you had placed after them.",
|
||||||
|
"Entry form and QSO editor: Name and QTH are capitalised word by word (\"JEAN-PIERRE\" → \"Jean-Pierre\"), Comment and Note get a capital first letter. Applied when you leave the field, so typing is never interrupted; the rest of a comment is left alone, since it usually holds callsigns and modes.",
|
||||||
|
"Recent QSOs: the search box only ever takes callsigns, so it now upper-cases as you type and carries a small clear button."
|
||||||
],
|
],
|
||||||
"fr": [
|
"fr": [
|
||||||
"Sauvegarde : nouvelle option \"Sauvegarder à chaque fermeture\" (Réglages → Sauvegarde). Activée, OpsLog sauvegarde la base à chaque fois que tu quittes au lieu d'une seule fois par jour — les QSO d'une seconde session sont ainsi toujours pris.",
|
"Sauvegarde : nouvelle option \"Sauvegarder à chaque fermeture\" (Réglages → Sauvegarde). Activée, OpsLog sauvegarde la base à chaque fois que tu quittes au lieu d'une seule fois par jour — les QSO d'une seconde session sont ainsi toujours pris.",
|
||||||
@@ -20,7 +24,11 @@
|
|||||||
"UDP sortant : un QSO enregistré depuis WSJT-X / JTDX / MSHV (via l'écouteur UDP entrant) est désormais aussi transmis aux intégrations ADIF sortantes — avant, seuls les QSO saisis directement dans OpsLog étaient réémis.",
|
"UDP sortant : un QSO enregistré depuis WSJT-X / JTDX / MSHV (via l'écouteur UDP entrant) est désormais aussi transmis aux intégrations ADIF sortantes — avant, seuls les QSO saisis directement dans OpsLog étaient réémis.",
|
||||||
"Sauvegarde : avec \"sauvegarder à chaque fermeture\", une nouvelle sous-option \"Garder chaque sauvegarde\" écrit un fichier horodaté distinct par fermeture (opslog-AAAA-MM-JJ-HHMMSS.db) au lieu d'écraser le fichier du jour. La rotation garde les N plus récents — augmente-la pour plus d'historique.",
|
"Sauvegarde : avec \"sauvegarder à chaque fermeture\", une nouvelle sous-option \"Garder chaque sauvegarde\" écrit un fichier horodaté distinct par fermeture (opslog-AAAA-MM-JJ-HHMMSS.db) au lieu d'écraser le fichier du jour. La rotation garde les N plus récents — augmente-la pour plus d'historique.",
|
||||||
"Éditeur de diplômes : la recherche PRINCIPALE QSOFIELDS a aussi un champ Préfixe (ajouté devant chaque référence trouvée, ex. 01 capturé → D01) — avant, seules les recherches OR de repli pouvaient ajouter un préfixe, empêchant un diplôme type DOK de matcher sur sa règle principale.",
|
"Éditeur de diplômes : la recherche PRINCIPALE QSOFIELDS a aussi un champ Préfixe (ajouté devant chaque référence trouvée, ex. 01 capturé → D01) — avant, seules les recherches OR de repli pouvaient ajouter un préfixe, empêchant un diplôme type DOK de matcher sur sa règle principale.",
|
||||||
"CAT : nouveau backend Elecraft K3/K4 dans la liste des rigs. Sélectionne-le (il réutilise les réglages USB/réseau Kenwood) et les modes numériques passent automatiquement en DATA A (MD6+DT0) — le sous-mode dont l'audio FT8 a besoin, donc le K3 ne passe plus en émission sans moduler."
|
"CAT : nouveau backend Elecraft K3/K4 dans la liste des rigs. Sélectionne-le (il réutilise les réglages USB/réseau Kenwood) et les modes numériques passent automatiquement en DATA A (MD6+DT0) — le sous-mode dont l'audio FT8 a besoin, donc le K3 ne passe plus en émission sans moduler.",
|
||||||
|
"Base de réglages : les boutons Nouvelle base / Ouvrir existante / Enregistrer une copie / Renommer / Réinitialiser sont de retour (Réglages → Base de données). Il ne restait que \"Ouvrir le dossier\", qui lance l'Explorateur Windows — où un .db n'est pas sélectionnable, il demande juste avec quel logiciel l'ouvrir. Choisir une base passe désormais par un vrai sélecteur de fichier, avec redémarrage en un clic.",
|
||||||
|
"QSO récents : une colonne déplacée APRÈS une colonne de diplôme y reste. Les colonnes de diplômes étaient exclues de la disposition enregistrée, donc au rechargement elles étaient repoussées tout à droite et repassaient devant la colonne que tu avais placée après elles.",
|
||||||
|
"Saisie et éditeur de QSO : Name et QTH sont capitalisés mot par mot (« JEAN-PIERRE » → « Jean-Pierre »), Comment et Note prennent une majuscule en première lettre. Appliqué quand tu quittes le champ, donc la frappe n'est jamais perturbée ; la suite d'un commentaire est laissée telle quelle, puisqu'elle contient souvent des indicatifs et des modes.",
|
||||||
|
"QSO récents : le champ de recherche ne prend que des indicatifs — il passe donc en majuscules à la frappe et reçoit un petit bouton d'effacement."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+29
-8
@@ -103,6 +103,7 @@ import { WinkeyerPanel, type WKStatus, type WKMacro } from '@/components/Winkeye
|
|||||||
import { RotorCompass } from '@/components/RotorCompass';
|
import { RotorCompass } from '@/components/RotorCompass';
|
||||||
import { writeUiPref } from '@/lib/uiPref';
|
import { writeUiPref } from '@/lib/uiPref';
|
||||||
import { formatDateTimeUTC } from '@/lib/dateFormat';
|
import { formatDateTimeUTC } from '@/lib/dateFormat';
|
||||||
|
import { titleCase, sentenceCase } from '@/lib/textCase';
|
||||||
import { setGridPrefsProfile, flushGridPrefs } from '@/lib/gridPrefs';
|
import { setGridPrefsProfile, flushGridPrefs } from '@/lib/gridPrefs';
|
||||||
import { DvkPanel, type DVKMsg, type DVKStat } from '@/components/DvkPanel';
|
import { DvkPanel, type DVKMsg, type DVKStat } from '@/components/DvkPanel';
|
||||||
|
|
||||||
@@ -4222,7 +4223,8 @@ export default function App() {
|
|||||||
);
|
);
|
||||||
const nameBlock = (
|
const nameBlock = (
|
||||||
<div className="flex flex-col flex-1 min-w-[110px]"><Label className="mb-1 h-3.5">{t('field.name')}</Label>
|
<div className="flex flex-col flex-1 min-w-[110px]"><Label className="mb-1 h-3.5">{t('field.name')}</Label>
|
||||||
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }} />
|
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }}
|
||||||
|
onBlur={() => setName(titleCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
// In contest mode QTH is replaced by the sent (read-only, auto) and received
|
// In contest mode QTH is replaced by the sent (read-only, auto) and received
|
||||||
@@ -4242,7 +4244,8 @@ export default function App() {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col flex-1 min-w-[80px]"><Label className="mb-1 h-3.5">{t('field.qth')}</Label>
|
<div className="flex flex-col flex-1 min-w-[80px]"><Label className="mb-1 h-3.5">{t('field.qth')}</Label>
|
||||||
<Input value={qth} onChange={(e) => { setQth(e.target.value); markEdited('qth'); }} />
|
<Input value={qth} onChange={(e) => { setQth(e.target.value); markEdited('qth'); }}
|
||||||
|
onBlur={() => setQth(titleCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
const gridBlock = (
|
const gridBlock = (
|
||||||
@@ -4387,7 +4390,7 @@ export default function App() {
|
|||||||
);
|
);
|
||||||
const commentSm = (
|
const commentSm = (
|
||||||
<div className="flex flex-col w-40"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
<div className="flex flex-col w-40"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
||||||
<Input value={comment} onChange={(e) => setComment(e.target.value)} />
|
<Input value={comment} onChange={(e) => setComment(e.target.value)} onBlur={() => setComment(sentenceCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
// Inline-label variants (label to the LEFT of the control, Log4OM-style) —
|
// Inline-label variants (label to the LEFT of the control, Log4OM-style) —
|
||||||
@@ -4503,12 +4506,12 @@ export default function App() {
|
|||||||
// column). No flex-1 so they stay one row tall.
|
// column). No flex-1 so they stay one row tall.
|
||||||
const commentLine = (
|
const commentLine = (
|
||||||
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
||||||
<Input value={comment} onChange={(e) => setComment(e.target.value)} />
|
<Input value={comment} onChange={(e) => setComment(e.target.value)} onBlur={() => setComment(sentenceCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
const noteLine = (
|
const noteLine = (
|
||||||
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.note')}</Label>
|
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.note')}</Label>
|
||||||
<Input value={note} onChange={(e) => setNote(e.target.value)} />
|
<Input value={note} onChange={(e) => setNote(e.target.value)} onBlur={() => setNote(sentenceCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
const logButtons = (
|
const logButtons = (
|
||||||
@@ -5605,7 +5608,8 @@ export default function App() {
|
|||||||
it to its own line instead, which stays readable. */}
|
it to its own line instead, which stays readable. */}
|
||||||
<div className="flex gap-4 items-end flex-wrap">
|
<div className="flex gap-4 items-end flex-wrap">
|
||||||
<div className="flex flex-col w-[300px] shrink-0"><Label className="mb-1 h-3.5">Name</Label>
|
<div className="flex flex-col w-[300px] shrink-0"><Label className="mb-1 h-3.5">Name</Label>
|
||||||
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }} />
|
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }}
|
||||||
|
onBlur={() => setName(titleCase)} />
|
||||||
</div>
|
</div>
|
||||||
{qthBlock}
|
{qthBlock}
|
||||||
{gridBlock}
|
{gridBlock}
|
||||||
@@ -6045,12 +6049,29 @@ export default function App() {
|
|||||||
|
|
||||||
<TabsContent value="recent" className="mt-0 flex flex-col min-h-0 flex-1">
|
<TabsContent value="recent" className="mt-0 flex flex-col min-h-0 flex-1">
|
||||||
<div className="flex gap-2 p-2.5 border-b border-border/60">
|
<div className="flex gap-2 p-2.5 border-b border-border/60">
|
||||||
|
{/* Callsign-only search: forced upper-case (a call is never
|
||||||
|
lower-case, and the operator shouldn't have to hold shift)
|
||||||
|
with an inline clear so wiping the filter is one click
|
||||||
|
instead of a select-all + delete. */}
|
||||||
|
<div className="relative flex-1">
|
||||||
<Input
|
<Input
|
||||||
className="flex-1"
|
className="w-full pr-8 font-mono"
|
||||||
placeholder="Search callsign…"
|
placeholder="Search callsign…"
|
||||||
value={filterCallsign}
|
value={filterCallsign}
|
||||||
onChange={(e) => setFilterCallsign(e.target.value)}
|
onChange={(e) => setFilterCallsign(e.target.value.toUpperCase())}
|
||||||
/>
|
/>
|
||||||
|
{filterCallsign && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label={t('btn.clear')}
|
||||||
|
title={t('btn.clear')}
|
||||||
|
className="absolute right-1.5 top-1/2 -translate-y-1/2 inline-flex items-center justify-center size-5 rounded text-muted-foreground hover:text-foreground hover:bg-foreground/10"
|
||||||
|
onClick={() => setFilterCallsign('')}
|
||||||
|
>
|
||||||
|
<X className="size-3.5" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<Button variant="outline" size="sm" onClick={() => refresh()}>
|
<Button variant="outline" size="sm" onClick={() => refresh()}>
|
||||||
<RefreshCw className="size-3.5" /> Refresh
|
<RefreshCw className="size-3.5" /> Refresh
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { Combobox } from '@/components/ui/combobox';
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { flagURL } from '@/lib/flags';
|
import { flagURL } from '@/lib/flags';
|
||||||
import { useI18n } from '@/lib/i18n';
|
import { useI18n } from '@/lib/i18n';
|
||||||
|
import { titleCase, sentenceCase } from '@/lib/textCase';
|
||||||
import type { QSOForm } from '@/types';
|
import type { QSOForm } from '@/types';
|
||||||
|
|
||||||
type QSO = QSOForm;
|
type QSO = QSOForm;
|
||||||
@@ -514,7 +515,8 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
<div className="grid grid-cols-2 gap-x-6 gap-y-2.5">
|
<div className="grid grid-cols-2 gap-x-6 gap-y-2.5">
|
||||||
{/* ── Left column ── */}
|
{/* ── Left column ── */}
|
||||||
<div className="flex flex-col gap-2.5">
|
<div className="flex flex-col gap-2.5">
|
||||||
<div><Label>{t('qedit.name')}</Label><Input value={draft.name ?? ''} onChange={(e) => set('name', e.target.value)} /></div>
|
<div><Label>{t('qedit.name')}</Label><Input value={draft.name ?? ''} onChange={(e) => set('name', e.target.value)}
|
||||||
|
onBlur={() => set('name', titleCase(draft.name ?? '') as any)} /></div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-20 shrink-0">{t('qedit.band')}</Label>
|
<Label className="w-20 shrink-0">{t('qedit.band')}</Label>
|
||||||
<Select value={draft.band || ''} onValueChange={(v) => set('band', v)}>
|
<Select value={draft.band || ''} onValueChange={(v) => set('band', v)}>
|
||||||
@@ -580,8 +582,10 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
<div className="flex flex-col flex-1"><Label>{t('qedit.grid')}</Label><Input value={draft.grid ?? ''} onChange={(e) => set('grid', e.target.value)} className="font-mono uppercase" /></div>
|
<div className="flex flex-col flex-1"><Label>{t('qedit.grid')}</Label><Input value={draft.grid ?? ''} onChange={(e) => set('grid', e.target.value)} className="font-mono uppercase" /></div>
|
||||||
<div className="flex flex-col w-24"><Label>PFX</Label><Input readOnly value={pfxOf(draft.callsign ?? '')} className="font-mono bg-muted/40" /></div>
|
<div className="flex flex-col w-24"><Label>PFX</Label><Input readOnly value={pfxOf(draft.callsign ?? '')} className="font-mono bg-muted/40" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div><Label>{t('qedit.comment')}</Label><Input value={draft.comment ?? ''} onChange={(e) => set('comment', e.target.value)} /></div>
|
<div><Label>{t('qedit.comment')}</Label><Input value={draft.comment ?? ''} onChange={(e) => set('comment', e.target.value)}
|
||||||
<div><Label>{t('qedit.note')}</Label><Textarea rows={3} value={draft.notes ?? ''} onChange={(e) => set('notes', e.target.value)} /></div>
|
onBlur={() => set('comment', sentenceCase(draft.comment ?? '') as any)} /></div>
|
||||||
|
<div><Label>{t('qedit.note')}</Label><Textarea rows={3} value={draft.notes ?? ''} onChange={(e) => set('notes', e.target.value)}
|
||||||
|
onBlur={() => set('notes', sentenceCase(draft.notes ?? '') as any)} /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
@@ -602,7 +606,8 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div><Label>QTH</Label><Input value={draft.qth ?? ''} onChange={(e) => set('qth', e.target.value)} /></div>
|
<div><Label>QTH</Label><Input value={draft.qth ?? ''} onChange={(e) => set('qth', e.target.value)}
|
||||||
|
onBlur={() => set('qth', titleCase(draft.qth ?? '') as any)} /></div>
|
||||||
<div><Label>{t('qedit.address')}</Label><Textarea rows={4} value={draft.address ?? ''} onChange={(e) => set('address', e.target.value)} /></div>
|
<div><Label>{t('qedit.address')}</Label><Textarea rows={4} value={draft.address ?? ''} onChange={(e) => set('address', e.target.value)} /></div>
|
||||||
</div>
|
</div>
|
||||||
{/* Right column */}
|
{/* Right column */}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Capitalisation helpers for the free-text QSO fields (Name / QTH / Comment /
|
||||||
|
// Note).
|
||||||
|
//
|
||||||
|
// The same station reaches the log SHOUTED by QRZ, lower-cased by a hurried
|
||||||
|
// operator, and in whatever case the other logger stored it in an imported
|
||||||
|
// ADIF — so one callsign ends up as "JEAN", "jean" and "Jean" across a log,
|
||||||
|
// and sorting or reading a QTH column becomes a mess.
|
||||||
|
//
|
||||||
|
// Both helpers are meant to run on BLUR, never per keystroke: rewriting the
|
||||||
|
// value while the operator is still typing a word fights them mid-word (see
|
||||||
|
// the controlled-input note in CLAUDE.md).
|
||||||
|
|
||||||
|
// titleCase upper-cases the first letter of every word and lower-cases the
|
||||||
|
// rest. Separators are kept, so "SAINT-JULIEN" → "Saint-Julien" and
|
||||||
|
// "o'brien" → "O'Brien".
|
||||||
|
export function titleCase(s: string): string {
|
||||||
|
return s
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/(^|[\s\-'’/.])(\p{L})/gu, (_m, sep: string, ch: string) => sep + ch.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// sentenceCase upper-cases the first letter and leaves everything after it as
|
||||||
|
// typed. A comment routinely carries callsigns, modes and abbreviations
|
||||||
|
// ("TNX QSO F5ABC, FT8 59") that lower-casing would quietly destroy — which is
|
||||||
|
// why this is NOT titleCase.
|
||||||
|
export function sentenceCase(s: string): string {
|
||||||
|
return s.replace(/^(\s*)(\p{L})/u, (_m, sp: string, ch: string) => sp + ch.toUpperCase());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user