From a0b8664e239a0142c8ca268fb72eeb7b47fa8d16 Mon Sep 17 00:00:00 2001 From: elpatron Date: Sun, 31 May 2026 21:20:19 +0200 Subject: [PATCH] Use course dials for live-log wind direction and course entry. Reuses CourseDialInput from the classic journal editor in the live modals, prefilled from the most recent wind or course values. Co-authored-by: Cursor --- client/src/App.css | 17 +++++++ client/src/components/LiveLogView.tsx | 70 ++++++++++++++++++++++----- 2 files changed, 76 insertions(+), 11 deletions(-) diff --git a/client/src/App.css b/client/src/App.css index 6144852..79542d6 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -3306,6 +3306,23 @@ html.theme-cupertino .events-scroll-container { border-radius: var(--app-radius-card, 12px); } +.live-log-modal--dial { + width: min(320px, 100%); +} + +.live-log-dial-field { + display: flex; + flex-direction: column; + gap: 8px; + margin-bottom: 16px; +} + +.live-log-dial-field label { + font-size: 13px; + font-weight: 600; + color: var(--app-text-muted); +} + .live-log-modal h3 { margin: 0 0 16px; font-size: 17px; diff --git a/client/src/components/LiveLogView.tsx b/client/src/components/LiveLogView.tsx index 8ab52a1..586a02d 100644 --- a/client/src/components/LiveLogView.tsx +++ b/client/src/components/LiveLogView.tsx @@ -47,6 +47,7 @@ import { import { getCurrentPosition } from '../utils/geolocation.js' import { sortLogEventsByTime, type LogEventPayload } from '../utils/logEntryPayload.js' import { useDialog } from './ModalDialog.tsx' +import CourseDialInput from './CourseDialInput.tsx' interface LiveLogViewProps { logbookId: string @@ -84,6 +85,13 @@ function lastCourseFromEvents(events: LogEventPayload[]): string { return '' } +function lastWindDirectionFromEvents(events: LogEventPayload[]): string { + for (let i = events.length - 1; i >= 0; i--) { + if (events[i].windDirection.trim()) return events[i].windDirection + } + return '' +} + export default function LiveLogView({ logbookId, onOpenEditor, @@ -548,7 +556,7 @@ export default function LiveLogView({ {weatherExpanded && (
- @@ -656,7 +684,29 @@ export default function LiveLogView({
)} - {['pressure', 'temp', 'precip', 'sea_state', 'course', 'fuel', 'water', 'sog', 'stw'].includes(modal) && ( + {modal === 'course' && ( +
setModal('none')}> +
e.stopPropagation()}> +

{t('logs.live_course_btn')}

+
+ + +
+
+ + +
+
+
+ )} + + {['pressure', 'temp', 'precip', 'sea_state', 'fuel', 'water', 'sog', 'stw'].includes(modal) && (
setModal('none')}>
e.stopPropagation()}>

@@ -664,7 +714,6 @@ export default function LiveLogView({ {modal === 'temp' && t('logs.live_temp_btn')} {modal === 'precip' && t('logs.live_precip_btn')} {modal === 'sea_state' && t('logs.live_sea_state_btn')} - {modal === 'course' && t('logs.live_course_btn')} {modal === 'fuel' && t('logs.live_fuel_btn')} {modal === 'water' && t('logs.live_water_btn')} {modal === 'sog' && t('logs.live_sog_btn')} @@ -684,11 +733,10 @@ export default function LiveLogView({ : modal === 'temp' ? t('logs.live_temp_placeholder') : modal === 'precip' ? t('logs.live_precip_placeholder') : modal === 'sea_state' ? t('logs.live_sea_state_placeholder') - : modal === 'course' ? t('logs.live_course_placeholder') - : modal === 'fuel' ? t('logs.live_fuel_placeholder') - : modal === 'water' ? t('logs.live_water_placeholder') - : modal === 'sog' ? t('logs.live_sog_placeholder') - : t('logs.live_stw_placeholder') + : modal === 'fuel' ? t('logs.live_fuel_placeholder') + : modal === 'water' ? t('logs.live_water_placeholder') + : modal === 'sog' ? t('logs.live_sog_placeholder') + : t('logs.live_stw_placeholder') } autoFocus onKeyDown={(e) => { if (e.key === 'Enter') confirmValueModal() }}