chore: release v0.12

This commit is contained in:
2026-06-20 20:18:28 +02:00
parent 260172cd6d
commit a9f2e515e1
9 changed files with 445 additions and 4 deletions
+82 -2
View File
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {
AlertCircle, Antenna, CheckCircle2, Clock, Compass, Database, Ear, Eraser, Hash, Loader2, Lock,
Maximize2, Minimize2, Mic, Pencil, RadioTower, RefreshCw, Satellite, Send, Settings, SlidersHorizontal, Square, Trash2, Unlock, X, Zap,
Maximize2, Minimize2, Mic, MessageSquare, Pencil, RadioTower, RefreshCw, Satellite, Send, Settings, SlidersHorizontal, Square, Trash2, Unlock, X, Zap,
} from 'lucide-react';
import {
@@ -30,6 +30,7 @@ import {
WinkeyerConnect, WinkeyerDisconnect, WinkeyerSend, WinkeyerStop, WinkeyerSetSpeed, WinkeyerBackspace,
GetDVKMessages, GetDVKStatus, DVKPlay, DVKStop,
StartCWDecoder, StopCWDecoder, SetCWDecoderPitch,
ChatAvailable, GetChatHistory, SendChatMessage, GetOnlineOperators,
QSOAudioBegin, QSOAudioCancel, QSOAudioRestart,
GetAwardDefs,
GetUIPref,
@@ -63,6 +64,7 @@ import { ClusterGrid } from '@/components/ClusterGrid';
import { cleanSpotter, inferSpotMode, spotModeCategory, spotStatusKey } from '@/lib/spot';
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
import { BulkEditModal } from '@/components/BulkEditModal';
import { ChatPanel, type ChatMsg, type ChatPresence } from '@/components/ChatPopover';
import { DetailsPanel, type DetailsState } from '@/components/DetailsPanel';
import { SendSpotModal, type RecentSpotQSO } from '@/components/SendSpotModal';
import { WinkeyerPanel, type WKStatus, type WKMacro } from '@/components/WinkeyerPanel';
@@ -622,6 +624,61 @@ export default function App() {
setCwEnabled((v) => { const n = !v; localStorage.setItem('opslog.cwDecoder', n ? '1' : '0'); return n; });
}
// === Multi-op chat (shared MySQL logbook) — docked panel like rotor/DVK ===
const [chatAvailable, setChatAvailable] = useState(false);
const [chatOpen, setChatOpen] = useState(false);
const [chatMsgs, setChatMsgs] = useState<ChatMsg[]>([]);
const [chatOnline, setChatOnline] = useState<ChatPresence[]>([]);
const [chatUnread, setChatUnread] = useState(0);
const chatOpenRef = useRef(chatOpen); chatOpenRef.current = chatOpen;
const chatSeen = useRef<Set<number>>(new Set());
// Availability (only on a shared MySQL logbook; re-checked as profiles switch).
useEffect(() => {
let alive = true;
const chk = () => ChatAvailable().then((v) => alive && setChatAvailable(!!v)).catch(() => {});
chk();
const id = window.setInterval(chk, 10000);
return () => { alive = false; window.clearInterval(id); };
}, []);
// Incoming messages — append + bump unread when the panel is closed.
useEffect(() => {
const off = EventsOn('chat:message', (m: ChatMsg) => {
if (!m || chatSeen.current.has(m.id)) return;
chatSeen.current.add(m.id);
setChatMsgs((p) => [...p, m].slice(-300));
if (!chatOpenRef.current) setChatUnread((u) => u + 1);
});
return () => { off?.(); };
}, []);
// On open: clear unread, load history + the online list (refreshed).
useEffect(() => {
if (!chatOpen) return;
setChatUnread(0);
GetChatHistory(80).then((h: any) => {
const list = (h ?? []) as ChatMsg[];
list.forEach((m) => chatSeen.current.add(m.id));
setChatMsgs((prev) => {
const byId = new Map<number, ChatMsg>();
[...list, ...prev].forEach((m) => byId.set(m.id, m));
return Array.from(byId.values()).sort((a, b) => a.id - b.id).slice(-300);
});
}).catch(() => {});
const lo = () => GetOnlineOperators().then((o: any) => setChatOnline((o ?? []) as ChatPresence[])).catch(() => {});
lo();
const id = window.setInterval(lo, 15000);
return () => window.clearInterval(id);
}, [chatOpen]);
async function chatSend(t: string) {
try {
const m = (await SendChatMessage(t)) as any as ChatMsg;
if (m && m.id && !chatSeen.current.has(m.id)) {
chatSeen.current.add(m.id);
setChatMsgs((p) => [...p, m].slice(-300));
}
} catch (e: any) { setError(String(e?.message ?? e)); }
}
const chatShown = chatOpen && chatAvailable;
const [dvkEnabled, setDvkEnabled] = useState(false);
const [dvkMsgs, setDvkMsgs] = useState<DVKMsg[]>([]);
const [dvkStat, setDvkStat] = useState<DVKStat>({ recording: false, playing: false, rec_slot: 0 });
@@ -2856,6 +2913,23 @@ export default function App() {
>
<Compass className="size-4" />
</button>
{chatAvailable && (
<button
type="button"
onClick={() => setChatOpen((o) => !o)}
title={`Multi-op chat${chatUnread > 0 ? `${chatUnread} new` : ''}`}
className={cn('relative inline-flex items-center justify-center size-7 rounded-md border transition-colors',
chatShown ? 'border-sky-300 bg-sky-50 text-sky-700 hover:bg-sky-100'
: 'border-border text-muted-foreground hover:bg-muted')}
>
<MessageSquare className="size-4" />
{chatUnread > 0 && (
<span className="absolute -top-1 -right-1 min-w-3.5 h-3.5 px-0.5 rounded-full bg-rose-500 text-white text-[9px] font-bold leading-[14px] text-center">
{chatUnread > 9 ? '9+' : chatUnread}
</span>
)}
</button>
)}
</div>
<div className="flex items-center gap-1.5 font-mono text-xs text-muted-foreground px-2.5 py-1 bg-muted rounded-md border border-border/60">
@@ -3132,8 +3206,14 @@ export default function App() {
{/* Reserved free space to the right. The WinKeyer CW keyer and/or the
Digital Voice Keyer take this slot when enabled (Log4OM-style);
otherwise it shows the QRZ profile photo. */}
{!compact && (wkEnabled || dvkEnabled || lookupResult?.image_url || (showRotor && (rotatorHeading.enabled || dxPath))) && (
{!compact && (chatShown || wkEnabled || dvkEnabled || lookupResult?.image_url || (showRotor && (rotatorHeading.enabled || dxPath))) && (
<div className="flex-1 min-w-0 min-h-0 flex gap-2.5 items-stretch">
{chatShown && (
<div className="w-[280px] shrink-0 min-h-0">
<ChatPanel msgs={chatMsgs} online={chatOnline} myCall={station.callsign}
onSend={chatSend} onClose={() => setChatOpen(false)} />
</div>
)}
{/* Rotor compass: azimuth dial + needles + click-to-turn. Shows when a
rotator is configured or a DX bearing exists. */}
{showRotor && (rotatorHeading.enabled || dxPath) && (
+81
View File
@@ -0,0 +1,81 @@
import { useEffect, useRef, useState } from 'react';
import { MessageSquare, Send, Users, X } from 'lucide-react';
import { cn } from '@/lib/utils';
export type ChatMsg = { id: number; operator: string; station: string; message: string; created_at: string };
export type ChatPresence = { operator: string; station: string; ago_secs: number };
function hhmm(iso: string): string {
const d = new Date(iso);
if (isNaN(d.getTime())) return '';
const p = (n: number) => String(n).padStart(2, '0');
return `${p(d.getUTCHours())}:${p(d.getUTCMinutes())}`;
}
// ChatPanel — presentational multi-op chat panel, docked in the aside row next
// to the rotor / WinKeyer / DVK panels. All data + state lives in App.tsx.
export function ChatPanel({ msgs, online, myCall, onSend, onClose }: {
msgs: ChatMsg[]; online: ChatPresence[]; myCall?: string;
onSend: (text: string) => void; onClose: () => void;
}) {
const [text, setText] = useState('');
const listRef = useRef<HTMLDivElement>(null);
const me = (myCall || '').toUpperCase();
useEffect(() => { const el = listRef.current; if (el) el.scrollTop = el.scrollHeight; }, [msgs]);
function send() {
const t = text.trim();
if (!t) return;
setText('');
onSend(t);
}
return (
<div className="h-full flex flex-col rounded-xl border border-border bg-card shadow-sm overflow-hidden">
<div className="flex items-center gap-2 px-3 py-2 border-b border-border/60 bg-muted/30 shrink-0">
<MessageSquare className="size-4 text-sky-600" />
<span className="text-xs font-bold uppercase tracking-wider text-foreground/80">Chat</span>
<span className="flex-1" />
<Users className="size-3.5 text-muted-foreground" />
<span className="text-[11px] text-muted-foreground" title={online.map((o) => o.operator).join(', ')}>
{online.length}
</span>
<button type="button" onClick={onClose} className="ml-1 text-muted-foreground hover:text-foreground" title="Close">
<X className="size-3.5" />
</button>
</div>
<div ref={listRef} className="flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1.5 text-xs">
{msgs.length === 0 ? (
<div className="text-muted-foreground italic text-center py-6">No messages yet.</div>
) : msgs.map((m) => {
const mine = m.operator.toUpperCase() === me;
return (
<div key={m.id} className={cn('flex flex-col', mine && 'items-end')}>
<div className={cn('max-w-[85%] rounded-lg px-2 py-1', mine ? 'bg-sky-100 text-sky-900' : 'bg-muted')}>
{!mine && <span className="font-mono font-bold text-[10px] text-primary mr-1">{m.operator}</span>}
<span className="whitespace-pre-wrap break-words">{m.message}</span>
</div>
<span className="text-[9px] text-muted-foreground/70 px-1">{hhmm(m.created_at)}</span>
</div>
);
})}
</div>
<div className="flex items-center gap-1.5 p-2 border-t border-border/60 shrink-0">
<input
value={text}
onChange={(e) => setText(e.target.value)}
onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); send(); } }}
placeholder="Message…"
maxLength={1000}
className="flex-1 h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus:border-primary"
/>
<button type="button" onClick={send} disabled={!text.trim()}
className="inline-flex items-center justify-center size-8 rounded-md bg-primary text-primary-foreground disabled:opacity-40">
<Send className="size-3.5" />
</button>
</div>
</div>
);
}
+1 -1
View File
@@ -1,6 +1,6 @@
// Single source of truth for the app version shown in the UI (header + About).
// Bump this on a release (the release script updates it alongside telemetry.go).
export const APP_VERSION = '0.11.3';
export const APP_VERSION = '0.12';
// Author / credits, shown in Help -> About.
export const APP_AUTHOR = 'F4BPO';