From f3ea2a9c2bc64626b8ad06f859595e51ad706997 Mon Sep 17 00:00:00 2001 From: andreicristian97 <46008622+andreicristian97@users.noreply.github.com> Date: Wed, 17 Apr 2024 13:13:41 +0000 Subject: [PATCH 1/3] Remove Blossoms from Frontend --- doc/changelog.md | 2 +- frontend/src/config/i18n/de/guidedTour.json | 2 +- frontend/src/config/i18n/en/guidedTour.json | 2 +- .../src/features/map_planning/components/EditorMap.tsx | 9 ++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/doc/changelog.md b/doc/changelog.md index fabb8de44..0e1066b95 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -9,7 +9,7 @@ Syntax: `- short text describing the change _(Your Name)_` ## UNRELEASED - _()_ -- _()_ +- Removed Blossoms from Frontend (Text from guided tour, awarding Blossoms at the end of the tour) _(Andrei Dinu)_ - _()_ - _()_ - _()_ diff --git a/frontend/src/config/i18n/de/guidedTour.json b/frontend/src/config/i18n/de/guidedTour.json index 18551762d..35aa8987f 100644 --- a/frontend/src/config/i18n/de/guidedTour.json +++ b/frontend/src/config/i18n/de/guidedTour.json @@ -18,7 +18,7 @@ "base_layer_title": "Basis-Ebene", "plants_layer_title": "Pflanzen-Ebene", "congratulations_title": "Einführungstour abgeschlossen", - "welcome_text": "
Herzlich willkommen, PermaplanTer*in!
Das ist der Map Editor, wo du deine Karte planen und verwalten wirst. PermaplanT belohnt nachhaltiges Gärtnern mit Blossoms.
Mit Abschluss dieser Einführungstour kannst du dir dein erstes Blossom verdienen.
", + "welcome_text": "Herzlich willkommen, PermaplanTer*in!
Das ist der Map Editor, wo du deine Karte planen und verwalten wirst.
", "toolbox_intro_text": "Die Toolbox bietet dir eine Reihe von nützlichen Werkzeugen für die Arbeit an deiner Karte.", "layers_intro_text": "Hier kannst du deine aktive Ebene auswählen, eine Ebene verstecken oder ihre Transparenz anpassen.", "timeline_intro_text": "Nutze die Zeitleiste, um dir für einen bestimmten Tag die Planung der Karte anzeigen zu lassen.Alle Änderungen, die du vornimmst, bekommen ihre Gültigkeit mit dem gewählten Tag.
", diff --git a/frontend/src/config/i18n/en/guidedTour.json b/frontend/src/config/i18n/en/guidedTour.json index 31aa5a185..7d4d90ffc 100644 --- a/frontend/src/config/i18n/en/guidedTour.json +++ b/frontend/src/config/i18n/en/guidedTour.json @@ -18,7 +18,7 @@ "base_layer_title": "Base Layer", "plants_layer_title": "Plants Layer", "congratulations_title": "Congratulations", - "welcome_text": "Welcome to your first map, PermaplanTer. This is the Map Editor, where you will design and manage your map. PermaplanT rewards sustainable gardening with blossoms. With completion of this tour you will gain your first blossom.", + "welcome_text": "Welcome to your first map, PermaplanTer. This is the Map Editor, where you will design and manage your map.", "toolbox_intro_text": "The toolbox provides you with a variety of handy tools for your work on your map. Here you can undo and redo your actions. You can also toggle the grid from here.", "layers_intro_text": "The layers panel in the top right corner of the Map Editor lets you select your active layer, hide a specific layer or change its opacity with the blue slider.", "timeline_intro_text": "Use the timeline to change the current map date. It allows you to see the map at a certain date. Actions will refer to this date.", diff --git a/frontend/src/features/map_planning/components/EditorMap.tsx b/frontend/src/features/map_planning/components/EditorMap.tsx index 24c761440..bde8a1ab4 100644 --- a/frontend/src/features/map_planning/components/EditorMap.tsx +++ b/frontend/src/features/map_planning/components/EditorMap.tsx @@ -3,8 +3,7 @@ import Konva from 'konva'; import { useCallback, useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ShepherdTourContext } from 'react-shepherd'; -import { toast } from 'react-toastify'; -import { GainedBlossomsDto, LayerDto, LayerType } from '@/api_types/definitions'; +import { LayerDto, LayerType } from '@/api_types/definitions'; import IconButton from '@/components/Button/IconButton'; import CancelConfirmationModal from '@/components/Modals/ExtendedModal'; import { @@ -23,7 +22,6 @@ import GridIcon from '@/svg/icons/grid-dots.svg?react'; import RedoIcon from '@/svg/icons/redo.svg?react'; import TagsIcon from '@/svg/icons/tags.svg?react'; import UndoIcon from '@/svg/icons/undo.svg?react'; -import { gainBlossom } from '../api/gainBlossom'; import { useCompleteTour, useReenableTour } from '../hooks/tourHookApi'; import BaseLayer from '../layers/base/BaseLayer'; import BaseLayerRightToolbar from '../layers/base/components/BaseLayerRightToolbar'; @@ -167,6 +165,7 @@ export const EditorMap = ({ layers }: MapProps) => { } useEffect(() => { + /* Blossoms are removed temporarily and will be added back later const _tourCompletionBlossom = async () => { const blossom: GainedBlossomsDto = { blossom: 'graduation_day', @@ -177,7 +176,7 @@ export const EditorMap = ({ layers }: MapProps) => { toast.success(`${t('blossoms:blossom_gained')} ${t('blossoms:types.graduation_day')}`, { icon: '\u{1F338}', }); - }; + };*/ tour?.start(); if (tour && tour.steps.length > 0) { @@ -185,7 +184,7 @@ export const EditorMap = ({ layers }: MapProps) => { setShow(true); }); tour?.on('complete', () => { - _tourCompletionBlossom(); + // _tourCompletionBlossom(); Blossoms are removed temporarily and will be added back later completeTour(); }); } From c62037cc39e79d099acf6fbc8ae9ee8f3478abc3 Mon Sep 17 00:00:00 2001 From: andreicristian97 <46008622+andreicristian97@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:35:30 +0000 Subject: [PATCH 2/3] 1078 Remove Commented out code --- .../features/map_planning/components/EditorMap.tsx | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/frontend/src/features/map_planning/components/EditorMap.tsx b/frontend/src/features/map_planning/components/EditorMap.tsx index bde8a1ab4..296044e74 100644 --- a/frontend/src/features/map_planning/components/EditorMap.tsx +++ b/frontend/src/features/map_planning/components/EditorMap.tsx @@ -165,26 +165,12 @@ export const EditorMap = ({ layers }: MapProps) => { } useEffect(() => { - /* Blossoms are removed temporarily and will be added back later - const _tourCompletionBlossom = async () => { - const blossom: GainedBlossomsDto = { - blossom: 'graduation_day', - times_gained: 1, - gained_date: new Date().toISOString().split('T')[0], - }; - await gainBlossom(blossom); - toast.success(`${t('blossoms:blossom_gained')} ${t('blossoms:types.graduation_day')}`, { - icon: '\u{1F338}', - }); - };*/ - tour?.start(); if (tour && tour.steps.length > 0) { tour?.on('cancel', () => { setShow(true); }); tour?.on('complete', () => { - // _tourCompletionBlossom(); Blossoms are removed temporarily and will be added back later completeTour(); }); } From 66038c9cf73014aa221b06a511da59732edf40e1 Mon Sep 17 00:00:00 2001 From: andreicristian97 <46008622+andreicristian97@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:42:11 +0000 Subject: [PATCH 3/3] Remove other blossom-related files and references from Frontend --- frontend/src/config/i18n/de/blossoms.json | 6 ------ frontend/src/config/i18n/de/index.ts | 2 -- frontend/src/config/i18n/en/blossoms.json | 6 ------ frontend/src/config/i18n/en/index.ts | 2 -- .../src/features/map_planning/api/gainBlossom.ts | 13 ------------- .../features/map_planning/components/EditorMap.tsx | 2 +- 6 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 frontend/src/config/i18n/de/blossoms.json delete mode 100644 frontend/src/config/i18n/en/blossoms.json delete mode 100644 frontend/src/features/map_planning/api/gainBlossom.ts diff --git a/frontend/src/config/i18n/de/blossoms.json b/frontend/src/config/i18n/de/blossoms.json deleted file mode 100644 index 2a105c410..000000000 --- a/frontend/src/config/i18n/de/blossoms.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "blossom_gained": "Glückwunsch, du hast ein neues Blossom verdient:", - "types": { - "graduation_day": "Willkommenszeremonie" - } -} diff --git a/frontend/src/config/i18n/de/index.ts b/frontend/src/config/i18n/de/index.ts index ff1d962d0..04683803e 100644 --- a/frontend/src/config/i18n/de/index.ts +++ b/frontend/src/config/i18n/de/index.ts @@ -3,7 +3,6 @@ import auth from './auth.json'; import baseLayer from './baseLayer.json'; import baseLayerForm from './baseLayerForm.json'; import blog from './blog.json'; -import blossoms from './blossoms.json'; import common from './common.json'; import contact from './contact.json'; import drawings from './drawings.json'; @@ -70,7 +69,6 @@ export default { plantings, drawings, guidedTour, - blossoms, readOnly, toolboxTooltips, polygon, diff --git a/frontend/src/config/i18n/en/blossoms.json b/frontend/src/config/i18n/en/blossoms.json deleted file mode 100644 index b8cc3d93b..000000000 --- a/frontend/src/config/i18n/en/blossoms.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "blossom_gained": "Congratulations, you earned a new Blossom:", - "types": { - "graduation_day": "Graduation Day" - } -} diff --git a/frontend/src/config/i18n/en/index.ts b/frontend/src/config/i18n/en/index.ts index 38b17fb79..5b5626935 100644 --- a/frontend/src/config/i18n/en/index.ts +++ b/frontend/src/config/i18n/en/index.ts @@ -3,7 +3,6 @@ import auth from './auth.json'; import baseLayer from './baseLayer.json'; import baseLayerForm from './baseLayerForm.json'; import blog from './blog.json'; -import blossoms from './blossoms.json'; import common from './common.json'; import contact from './contact.json'; import drawings from './drawings.json'; @@ -70,7 +69,6 @@ export default { plantings, drawings, guidedTour, - blossoms, readOnly, toolboxTooltips, polygon, diff --git a/frontend/src/features/map_planning/api/gainBlossom.ts b/frontend/src/features/map_planning/api/gainBlossom.ts deleted file mode 100644 index 61e299f1b..000000000 --- a/frontend/src/features/map_planning/api/gainBlossom.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { GainedBlossomsDto } from '@/api_types/definitions'; -import { createAPI } from '@/config/axios'; - -export async function gainBlossom(gained_blossom: GainedBlossomsDto) { - const http = createAPI(); - - try { - const response = await http.post