Skip to content

Commit

Permalink
💄 Only show checkbox for polygon sharing when needed and remove hint
Browse files Browse the repository at this point in the history
  • Loading branch information
ENT8R committed Feb 26, 2024
1 parent 22cbef1 commit 990f9bc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions app/js/modals/share.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/js/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const COMMENTED = {
ONLY: 'only'
};

const AREA = {
export const AREA = {
GLOBAL: 'global',
VIEW: 'view',
CUSTOM: 'custom'
Expand Down
2 changes: 1 addition & 1 deletion app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions app/templates/modals/share.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<span data-i18n="description.shareView">Share current view of the map</span>
</label>

<label class="form-checkbox">
<input type="checkbox" class="update-permalink" id="share-polygon">
<label class="form-checkbox" id="share-polygon-checkbox">
<input type="checkbox" class="update-permalink" id="share-polygon" checked=>
<i class="form-icon"></i>
<span data-i18n="description.sharePolygon">Share shape for custom area selection (may be unreadable)</span>
<span data-i18n="description.sharePolygon">Share shape for custom area selection</span>
</label>
</div>
</div>
Expand Down

0 comments on commit 990f9bc

Please sign in to comment.