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