From 74282f50d061711deb7c50b508b6f72a5bfb5a0b Mon Sep 17 00:00:00 2001 From: elpatron Date: Sun, 31 May 2026 21:17:51 +0200 Subject: [PATCH] Add SOG and STW live-log actions and capitalize motor labels. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SOG prefills from GPS speed when available; STW is entered manually. Motor journal entries now read “Motor Start” / “Motor Stop”. Co-authored-by: Cursor --- client/src/App.css | 7 +++ client/src/components/LiveLogView.tsx | 58 ++++++++++++++++++++- client/src/i18n/locales/da.json | 11 +++- client/src/i18n/locales/de.json | 11 +++- client/src/i18n/locales/en.json | 11 +++- client/src/i18n/locales/nb.json | 11 +++- client/src/i18n/locales/sv.json | 11 +++- client/src/utils/formatEventSummary.test.ts | 25 +++++++-- client/src/utils/formatEventSummary.ts | 8 +++ client/src/utils/geolocation.ts | 10 +++- client/src/utils/liveEventCodes.ts | 18 +++++++ 11 files changed, 165 insertions(+), 16 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 14a4f21..6144852 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -3311,6 +3311,13 @@ html.theme-cupertino .events-scroll-container { font-size: 17px; } +.live-log-modal-hint { + margin: -8px 0 12px; + font-size: 13px; + color: var(--app-text-muted); + line-height: 1.4; +} + .live-log-sail-pills { margin-bottom: 16px; } diff --git a/client/src/components/LiveLogView.tsx b/client/src/components/LiveLogView.tsx index 7241fd7..8ab52a1 100644 --- a/client/src/components/LiveLogView.tsx +++ b/client/src/components/LiveLogView.tsx @@ -10,6 +10,7 @@ import { Droplets, FileText, Fuel, + Gauge, MapPin, MessageSquare, Radio, @@ -38,6 +39,8 @@ import { liveFuelRemark, livePrecipRemark, liveSailsRemark, + liveSogRemark, + liveStwRemark, liveTempRemark, liveWaterRemark } from '../utils/liveEventCodes.js' @@ -63,6 +66,8 @@ type LiveModal = | 'course' | 'fuel' | 'water' + | 'sog' + | 'stw' const AUTO_POSITION_INTERVAL_MS = 3 * 60 * 60 * 1000 const AUTO_POSITION_CHECK_MS = 60_000 @@ -235,6 +240,17 @@ export default function LiveLogView({ setModal(type) } + const openSogModal = async () => { + let prefill = '' + try { + const pos = await getCurrentPosition() + if (pos.speedKn != null) prefill = String(pos.speedKn) + } catch { + // Manual entry when GPS speed unavailable + } + openValueModal('sog', prefill) + } + const handleMotorToggle = () => { hapticPulse() void runQuickAction(async () => { @@ -405,6 +421,28 @@ export default function LiveLogView({ }, 'live_water') break } + case 'sog': { + const speedKn = parseFloat(primary.replace(',', '.')) + if (!Number.isFinite(speedKn) || speedKn < 0) return + setModal('none') + void runQuickAction(async () => { + await appendQuickEvent(logbookId, entryId, { + remarks: liveSogRemark(String(speedKn)) + }) + }, 'live_sog') + break + } + case 'stw': { + const speedKn = parseFloat(primary.replace(',', '.')) + if (!Number.isFinite(speedKn) || speedKn < 0) return + setModal('none') + void runQuickAction(async () => { + await appendQuickEvent(logbookId, entryId, { + remarks: liveStwRemark(String(speedKn)) + }) + }, 'live_stw') + break + } default: break } @@ -479,6 +517,14 @@ export default function LiveLogView({ {t('logs.live_course_btn')} + +