Badge the exception (not yet cached) instead of the near-universal case

GpxStore#save converts eagerly, so "cached" is true for nearly every
file in the tree already — badging that was just noise. Flipped to
PENDING_ICON, shown only for the rare case: a .gpx/.fit dropped
straight into data/gpx/ on the filesystem, bypassing the app, and not
yet opened.

Also add an explicit download button next to delete (DOWNLOAD_ICON) —
the file name itself has been a download link since the last commit,
but isn't obviously clickable at a glance.
This commit is contained in:
randy committed 2026-09-07 22:59:02 +02:00
1 parent cd92dadf6a
commit 12635a48c3
4 files changed
+73 -26

No files matched your search

+19 -5
View File
@@ -6,7 +6,8 @@ import {
WAYPOINT_ICON,
TRACK_ICON,
ROUTE_ICON,
GEOJSON_ICON,
PENDING_ICON,
DOWNLOAD_ICON,
MAP_MARKER_ICON,
POI_ICONS,
PARK4NIGHT_TAGS,
@@ -290,9 +291,10 @@ export class GpxPanelControl {
name.title = `Download ${displayName}`;
label.appendChild(checkbox);
(file.kinds || []).forEach((kind) => label.appendChild(this._kindIcon(kind)));
if (file.cached) label.appendChild(this._cachedIcon());
if (!file.cached) label.appendChild(this._pendingIcon());
label.appendChild(name);
row.appendChild(label);
row.appendChild(this._downloadButton(file));
row.appendChild(this._deleteButton(() => this._deleteFile(file.path)));
return row;
@@ -314,14 +316,26 @@ export class GpxPanelControl {
return icon;
}
_cachedIcon() {
_pendingIcon() {
const icon = document.createElement("span");
icon.className = "gpx-tree__kind-icon";
icon.innerHTML = GEOJSON_ICON;
icon.title = "Ready to view instantly (GeoJSON cached)";
icon.innerHTML = PENDING_ICON;
icon.title = "Not yet converted — dropped straight into data/gpx/, not uploaded through the app";
return icon;
}
// Same destination as clicking the file's name (gpxFileUrl + ?download=1)
// — a second, more obviously clickable entry point for the same action.
_downloadButton(file) {
const link = document.createElement("a");
link.className = "gpx-tree__download";
link.href = `${gpxFileUrl(file.path)}?download=1`;
link.title = "Download GeoJSON";
link.setAttribute("aria-label", "Download GeoJSON");
link.innerHTML = DOWNLOAD_ICON;
return link;
}
_deleteButton(onClick) {
const button = document.createElement("button");
button.type = "button";