From 990f9bcf82a96728652c46627d7de30d56356f75 Mon Sep 17 00:00:00 2001 From: ENT8R Date: Mon, 26 Feb 2024 22:27:17 +0100 Subject: [PATCH] :lipstick: Only show checkbox for polygon sharing when needed and remove hint --- app/js/modals/share.js | 6 ++++++ app/js/query.js | 2 +- app/locales/en.json | 2 +- app/templates/modals/share.hbs | 6 +++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/js/modals/share.js b/app/js/modals/share.js index 4ff9548..2f0a0ef 100644 --- a/app/js/modals/share.js +++ b/app/js/modals/share.js @@ -1,5 +1,6 @@ import * as Localizer from '../localizer.js'; import Modal from './modal.js'; +import { AREA } from '../query.js'; import Toast from '../toast.js'; export default class Share extends Modal { @@ -21,6 +22,11 @@ export default class Share extends Modal { type: 'application/json', })); document.getElementById('download').download = `NotesReview-${query.history[query.history.length - 1].time.toISOString()}.json`; + + // Only show the checkbox for adding the polygon shape if it would have an effect + // (i.e. a custom area is used, no countries are selected but something was drawn on the map) + document.getElementById('share-polygon-checkbox').style.display = + (query.data.area === AREA.CUSTOM && query.data.countries === null && query.data.polygon !== null) ? 'block' : 'none'; }); // Update links if a parameter changed diff --git a/app/js/query.js b/app/js/query.js index ece3a12..b3b5092 100644 --- a/app/js/query.js +++ b/app/js/query.js @@ -25,7 +25,7 @@ const COMMENTED = { ONLY: 'only' }; -const AREA = { +export const AREA = { GLOBAL: 'global', VIEW: 'view', CUSTOM: 'custom' diff --git a/app/locales/en.json b/app/locales/en.json index c9c50fb..462574d 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -117,7 +117,7 @@ "author": "The author is the user who created the note", "user": "A user is any user who left a comment on the note\n(including the author)", "customArea": "Select countries by clicking on them or draw a custom shape using the toolbar on the left", - "sharePolygon": "Share shape for custom area selection (may be unreadable)" + "sharePolygon": "Share shape for custom area selection" }, "settings": { "choose": "Choose an option", diff --git a/app/templates/modals/share.hbs b/app/templates/modals/share.hbs index a7c031d..3827a0e 100644 --- a/app/templates/modals/share.hbs +++ b/app/templates/modals/share.hbs @@ -22,10 +22,10 @@ Share current view of the map -