From 96e6dc124fe9f3dca8023bfd16873b8182d17028 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Sat, 24 Feb 2024 12:43:21 +0100 Subject: [PATCH] Show message about how to support OSM after a successful save, closes #10054 for example in form of a donation this can be disabled by setting an env variable (`ID_SHOW_DONATION_MESSAGE=false`) the icon is from https://uxwing.com/charity-donation-hand-love-icon/ --- CHANGELOG.md | 2 ++ config/envs.mjs | 2 ++ config/id.js | 4 +++ css/80_app.css | 3 ++ data/core.yaml | 6 ++++ modules/ui/success.js | 51 +++++++++++++++++++++++++++++ svg/iD-sprite/graphics/donation.svg | 3 ++ 7 files changed, 71 insertions(+) create mode 100644 svg/iD-sprite/graphics/donation.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ebd9da15..57824203d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :earth_asia: Localization #### :hourglass: Performance #### :mortar_board: Walkthrough / Help +* Show message about how to support OSM (e.g. in form of a donation) after a successful save ([#10054]) #### :rocket: Presets * Don't consider traffic_calming features as areas ([id-tagging-schema#1076]) * Add rendering style for roller coaster tracks and supports ([#9891], thanks [@mangerlahn]) @@ -69,6 +70,7 @@ _Breaking developer changes, which may affect downstream projects or sites that [#9891]: https://github.com/openstreetmap/iD/pull/9891 [#9983]: https://github.com/openstreetmap/iD/issues/9983 [#9992]: https://github.com/openstreetmap/iD/issues/9992 +[#10054]: https://github.com/openstreetmap/iD/issues/10054 [#10062]: https://github.com/openstreetmap/iD/pull/10062 [#10066]: https://github.com/openstreetmap/iD/pull/10066 [#10074]: https://github.com/openstreetmap/iD/issues/10074 diff --git a/config/envs.mjs b/config/envs.mjs index a1c5cdc74..fba016e66 100644 --- a/config/envs.mjs +++ b/config/envs.mjs @@ -16,6 +16,8 @@ const envs = { ENV__ID_TAGINFO_API_URL: JSON.stringify(process.env.ENV__ID_TAGINFO_API_URL || null), ENV__ID_NOMINATIM_API_URL: JSON.stringify(process.env.ENV__ID_NOMINATIM_API_URL || null), + + ENV__ID_SHOW_DONATION_MESSAGE: JSON.stringify(process.env.ENV__ID_SHOW_DONATION_MESSAGE || null), }; export default envs; diff --git a/config/id.js b/config/id.js index bc51d89ec..6bf65dd4b 100644 --- a/config/id.js +++ b/config/id.js @@ -53,6 +53,9 @@ const taginfoApiUrl = ENV__ID_TAGINFO_API_URL const nominatimApiUrl = ENV__ID_NOMINATIM_API_URL || 'https://nominatim.openstreetmap.org/'; +// support/donation message on upload success screen +const showDonationMessage = ENV__ID_SHOW_DONATION_MESSAGE !== 'false'; + export { presetsCdnUrl, ociCdnUrl, @@ -61,4 +64,5 @@ export { osmApiConnections, taginfoApiUrl, nominatimApiUrl, + showDonationMessage }; diff --git a/css/80_app.css b/css/80_app.css index 16eb06aca..b0ab5c7ff 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -5078,10 +5078,12 @@ img.tile-debug { } .save-summary, +.save-supporting, .save-communityLinks { padding: 0px 20px 15px 20px; } +.save-supporting, .save-communityLinks { border-top: 1px solid #ccc; } @@ -5113,6 +5115,7 @@ img.tile-debug { } .summary-view-on-osm, +.support-the-map, .community-name { font-size: 14px; font-weight: bold; diff --git a/data/core.yaml b/data/core.yaml index 864efd53d..f1736102d 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1034,6 +1034,12 @@ en: help_link_url: "https://wiki.openstreetmap.org/wiki/FAQ#I_have_just_made_some_changes_to_the_map._How_do_I_get_to_see_my_changes.3F" view_on_osm: "View Changes on OSM" changeset_id: "Your changeset #: {changeset_id}" + supporting: + title: "OpenStreetMap is free to use, but not free to run" + details: "Its stability, quality, independence, and strength depend on donations from people like you." + donation: + title: "Support the map" + details: "Any donation will go directly towards keeping OpenStreetMap running." like_osm: "Like OpenStreetMap? Connect with others:" more: More events: Events diff --git a/modules/ui/success.js b/modules/ui/success.js index 91369fbdd..c933ac236 100644 --- a/modules/ui/success.js +++ b/modules/ui/success.js @@ -3,6 +3,8 @@ import { select as d3_select } from 'd3-selection'; import { resolveStrings } from 'osm-community-index'; +import { showDonationMessage } from '../../config/id.js'; + import { fileFetcher } from '../core/file_fetcher'; import { locationManager } from '../core/LocationManager'; import { t, localizer } from '../core/localizer'; @@ -155,6 +157,55 @@ export function uiSuccess(context) { changeset_id: { html: `${_changeset.id}` } })); + if (showDonationMessage !== false) { + // support ask + const donationUrl = 'https://supporting.openstreetmap.org/'; + let supporting = body + .append('div') + .attr('class', 'save-supporting'); + + supporting + .append('h3') + .call(t.append('success.supporting.title')); + + supporting + .append('p') + .call(t.append('success.supporting.details')); + + table = supporting + .append('table') + .attr('class', 'supporting-table'); + + row = table + .append('tr') + .attr('class', 'supporting-row'); + + row + .append('td') + .attr('class', 'cell-icon supporting-icon') + .append('a') + .attr('target', '_blank') + .attr('href', donationUrl) + .append('svg') + .attr('class', 'logo-small') + .append('use') + .attr('xlink:href', '#iD-donation'); + + let supportingDetail = row + .append('td') + .attr('class', 'cell-detail supporting-detail'); + + supportingDetail + .append('a') + .attr('class', 'cell-detail support-the-map') + .attr('target', '_blank') + .attr('href', donationUrl) + .call(t.append('success.supporting.donation.title')); + + supportingDetail + .append('div') + .call(t.append('success.supporting.donation.details')); + } // Get OSM community index features intersecting the map.. ensureOSMCommunityIndex() diff --git a/svg/iD-sprite/graphics/donation.svg b/svg/iD-sprite/graphics/donation.svg new file mode 100644 index 000000000..e524a3b76 --- /dev/null +++ b/svg/iD-sprite/graphics/donation.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file