Show the tree's file names without the .geojson suffix
The suffix ("ride.gpx" -> "ride.gpx.geojson" once cached) explained
what the name would download back when it doubled as a GeoJSON-only
download link. Now that downloading is the download button's job
(previous commit), it was just confusing -- the file itself is still
named "ride.gpx".
This commit is contained in:
1 parent
1b4463a3c1
commit
ca224e95c1
2 files changed
+19
-23
No files matched your search
+7
-11
@@ -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 "<path>.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 "<path>.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());
|
||||
|
||||
Reference in new issue
Block a user