Gate note-writing UI behind login

Adding a note (either tool) always ended in a 401 for a logged-out
viewer — the write-only affordance just wasn't hidden yet, unlike
GpxPanelControl's own upload/new-folder buttons, which already are.

NotesControl isn't added to the map at all when logged out (its whole
purpose is writing); MeasureControl's "Save as note" button is hidden
but the tool itself stays usable for plain measuring either way.
This commit is contained in:
randy committed 2026-09-09 12:44:52 +02:00
1 parent aafb4cb4a0
commit b5b91d0df5
3 files changed
+17 -1

No files matched your search

+5
View File
@@ -1,5 +1,6 @@
import { RULER_ICON } from "/js/icons.js";
import { NoteSaveForm } from "/js/notes.js";
import { isLoggedIn } from "/js/auth.js";
const SOURCE_ID = "measure";
const LINE_LAYER_ID = "measure-line";
@@ -44,6 +45,10 @@ export class MeasureControl {
this._controls = this._container.querySelector(".measure-panel__controls");
this._result = this._container.querySelector(".measure-panel__result");
this._saveButton = this._container.querySelector(".measure-panel__save");
// Same "hide the write-only affordance for a logged-out viewer" story
// as notes.js's own button not being added at all — Measure itself
// stays available either way, only saving needs a login.
if (!isLoggedIn()) this._saveButton.hidden = true;
this._noteForm = new NoteSaveForm(this._panel, {
onSaved: () => {