Propagate waypoint notes through session init, save-to-journal, and Journal display

- use-yjs: seed note from initialWaypoints on session open
- api.sessions: include note in initialWaypoints type
- SaveToJournalButton: include note in GPX waypoints on save
- Journal routes.: map and display waypoint notes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-05-18 20:50:52 +02:00
parent 353dcb2c13
commit 02f8a8be44
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
5 changed files with 14 additions and 6 deletions

View file

@ -47,6 +47,7 @@ export function SaveToJournalButton({ yjs, callbackUrl, callbackToken, returnUrl
lon: yMap.get("lon") as number,
name: yMap.get("name") as string | undefined,
isDayBreak: yMap.get("overnight") === true ? true : undefined,
note: yMap.get("note") as string | undefined,
osmId: yMap.get("osmId") as number | undefined,
poiTags: yMap.get("poiTags") as WaypointPoiTags | undefined,
}));

View file

@ -42,7 +42,7 @@ export interface YjsState {
export function useYjs(
sessionId: string,
initialWaypoints?: Array<{ lat: number; lon: number; name?: string; isDayBreak?: boolean }>,
initialWaypoints?: Array<{ lat: number; lon: number; name?: string; isDayBreak?: boolean; note?: string; osmId?: number; poiTags?: Record<string, string> }>,
initialNoGoAreas?: Array<{ points: Array<{ lat: number; lon: number }> }>,
initialNotes?: string,
): YjsState | null {
@ -108,6 +108,9 @@ export function useYjs(
yMap.set("lon", wp.lon);
if (wp.name) yMap.set("name", wp.name);
if (wp.isDayBreak) yMap.set("overnight", true);
if (wp.note) yMap.set("note", wp.note);
if (wp.osmId !== undefined) yMap.set("osmId", wp.osmId);
if (wp.poiTags) yMap.set("poiTags", wp.poiTags);
waypoints.push([yMap]);
}
if (initialNoGoAreas?.length && noGoAreas.length === 0) {

View file

@ -19,7 +19,7 @@ export async function action({ request }: Route.ActionArgs) {
return withDb(async () => {
const session = await createSession({ callbackUrl, callbackToken });
let initialWaypoints: Array<{ lat: number; lon: number; name?: string; isDayBreak?: boolean }> | undefined;
let initialWaypoints: Array<{ lat: number; lon: number; name?: string; isDayBreak?: boolean; note?: string; osmId?: number; poiTags?: Record<string, string> }> | undefined;
let initialNoGoAreas: Array<{ points: Array<{ lat: number; lon: number }> }> | undefined;
let initialNotes: string | undefined;
if (gpx) {