diff --git a/docs/architecture.adoc b/docs/architecture.adoc index 84d190b..07d82c2 100644 --- a/docs/architecture.adoc +++ b/docs/architecture.adoc @@ -338,18 +338,18 @@ app, and not yet opened. Badging the common case would just be noise, so the file tree's icon (`PENDING_ICON`, `public/js/icons.js`) marks that exception instead of the (near-universal) ready state. + -Once a `.gpx`/`.fit` is cached, the tree shows it under its converted -name instead — `"ride.gpx"` reads as `"ride.gpx.geojson"`, matching -the real cache file sitting next to it on disk — since the GeoJSON, -not the original, is what's actually rendered on the map from that -point on. Plain text now, not a link — see below. The original is -never deleted or re-parsed once cached, just not re-shown as itself, -so both forms need a way out of the app as an actual file: one -download button, next to delete, opens a small menu ("Original file" / -"GeoJSON", `_downloadButton`/`_downloadMenuItem`) rather than the name -doubling as a GeoJSON-only download link the way it briefly did — that -was easy to miss as a link at all, and only ever covered half of -what's downloadable. Only one menu open at a time +The tree always shows a `.gpx`/`.fit` file under its real, as-uploaded +name, even once cached — it briefly grew a `.geojson` suffix there +(matching the real cache file's name on disk) back when the name +doubled as a GeoJSON-only download link and the suffix explained what +clicking it would get you; now that downloading is the download +button's job (below), the suffix was just confusing; the file itself +is still named `"ride.gpx"`. The original is never deleted or +re-parsed once cached, just not re-shown as itself once the GeoJSON +becomes what's actually rendered on the map, so both forms need a way +out of the app as an actual file: one download button, next to +delete, opens a small menu ("Original file" / "GeoJSON", +`_downloadButton`/`_downloadMenuItem`). Only one menu open at a time (`_toggleDownloadMenu`/`_closeDownloadMenu`), closed by a document-level click listener the same way an outside click closes a `sidebar-flyout` dropdown, just scoped to this one control rather than diff --git a/public/js/gpx.js b/public/js/gpx.js index 7f4ad2f..b29f7bb 100644 --- a/public/js/gpx.js +++ b/public/js/gpx.js @@ -296,20 +296,16 @@ export class GpxPanelControl { checkbox.type = "checkbox"; checkbox.checked = this._visible.has(file.path); checkbox.addEventListener("change", () => this._toggleFile(file.path, checkbox.checked, checkbox)); - // Once a .gpx/.fit is cached, its converted GeoJSON is the thing that's - // actually shown on the map from here on (see GpxStore#geojson) — the - // name reflects that (matching the real ".geojson" cache file on - // disk) rather than still reading as a plain, un-converted .gpx/.fit. - // A direct .geojson upload already ends in .geojson, so it's left - // alone. Plain text, not a link — downloading is the download button's - // job now (see below), one obvious place instead of two differently- - // shaped ones (the name used to double as a GeoJSON-only download - // link, easy to miss and only half the story). - const displayName = file.cached && !file.name.toLowerCase().endsWith(".geojson") ? `${file.name}.geojson` : file.name; + // Just the real, as-uploaded name — it used to grow a ".geojson" suffix + // once cached (matching the real ".geojson" cache file on disk), + // back when the name doubled as a GeoJSON-only download link and the + // suffix explained what clicking it would get you. Now that downloading + // is the download button's job (see below), that suffix was just + // confusing: the file is still named "ride.gpx", not "ride.gpx.geojson". const loggedIn = isLoggedIn(); const name = document.createElement("span"); name.className = "gpx-tree__file-name"; - name.textContent = displayName; + name.textContent = file.name; label.appendChild(checkbox); (file.kinds || []).forEach((kind) => label.appendChild(this._kindIcon(kind))); if (!file.cached) label.appendChild(this._pendingIcon());