Sync notes through GPX, Journal, and Planner roundtrip
Full notes lifecycle: - GPX: description field in GpxData, <metadata><desc> in generate/parse - Export: Plan GPX and Save to Journal include notes as description - Journal: updateRoute extracts description from GPX, stores on route - Reimport: Edit in Planner passes notes via URL params → Yjs Y.Text - Drop import: GPX with <desc> restores notes in session Spec updated: session-notes gains GPX export, Journal sync, and reimport requirements. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b12b706b77
commit
08070cdd90
13 changed files with 62 additions and 9 deletions
|
|
@ -10,6 +10,7 @@ export interface NoGoArea {
|
|||
|
||||
export function generateGpx(options: {
|
||||
name?: string;
|
||||
description?: string;
|
||||
waypoints?: Waypoint[];
|
||||
tracks?: TrackPoint[][];
|
||||
noGoAreas?: NoGoArea[];
|
||||
|
|
@ -25,8 +26,11 @@ export function generateGpx(options: {
|
|||
">",
|
||||
];
|
||||
|
||||
if (options.name) {
|
||||
lines.push(" <metadata>", ` <name>${escapeXml(options.name)}</name>`, " </metadata>");
|
||||
if (options.name || options.description) {
|
||||
lines.push(" <metadata>");
|
||||
if (options.name) lines.push(` <name>${escapeXml(options.name)}</name>`);
|
||||
if (options.description) lines.push(` <desc>${escapeXml(options.description)}</desc>`);
|
||||
lines.push(" </metadata>");
|
||||
}
|
||||
|
||||
if (options.waypoints) {
|
||||
|
|
|
|||
|
|
@ -44,12 +44,13 @@ function parseGpxWithParser(parser: DOMParser, xml: string): GpxData {
|
|||
}
|
||||
|
||||
const name = doc.querySelector("metadata > name")?.textContent ?? undefined;
|
||||
const description = doc.querySelector("metadata > desc")?.textContent ?? undefined;
|
||||
const waypoints = parseWaypoints(doc);
|
||||
const tracks = parseTracks(doc);
|
||||
const noGoAreas = parseNoGoAreas(doc);
|
||||
const { totalDistance, ...elevation } = computeElevation(tracks);
|
||||
|
||||
return { name, waypoints, tracks, noGoAreas, distance: totalDistance, elevation };
|
||||
return { name, description, waypoints, tracks, noGoAreas, distance: totalDistance, elevation };
|
||||
}
|
||||
|
||||
function parseWaypoints(doc: Document): Waypoint[] {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export interface NoGoArea {
|
|||
|
||||
export interface GpxData {
|
||||
name?: string;
|
||||
description?: string;
|
||||
waypoints: Waypoint[];
|
||||
tracks: TrackPoint[][];
|
||||
noGoAreas: NoGoArea[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue