fix link fields

This commit is contained in:
vcoppe committed 2026-10-08 21:13:44 +02:00
1 parent 42a55e6759
commit 83b76bb838
14 files changed
+345 -79

No files matched your search

+13 -7
View File
@@ -143,13 +143,19 @@ pub fn waypoint(file_id: &str, waypoint_id: &str) -> WaypointDetails {
set(&object, key, value.as_str());
}
}
if let Some(link) = &wpt.link {
let link_object = Object::new();
set(&link_object, "href", link.href.as_str());
if let Some(text) = &link.text {
set(&link_object, "text", text.as_str());
}
set(&object, "link", link_object);
if !wpt.links.is_empty() {
set(
&object,
"links",
array(&wpt.links, |link| {
let link_object = Object::new();
set(&link_object, "href", link.href.as_str());
if let Some(text) = &link.text {
set(&link_object, "text", text.as_str());
}
link_object.into()
}),
);
}
JsValue::from(object)
})
+2 -1
View File
@@ -52,7 +52,8 @@ export interface WaypointDetails {
name?: string;
desc?: string;
cmt?: string;
link?: { href: string; text?: string };
/** The links of the waypoint, absent when it has none. */
links?: { href: string; text?: string }[];
sym?: string;
}
/** The position, elevation and time of a trackpoint. */