From 3319a84f315f442b4e841cbc2c536bcb0cfaaa59 Mon Sep 17 00:00:00 2001 From: mvdegtyar Date: Mon, 1 Aug 2022 21:01:50 +0300 Subject: [PATCH 1/2] Add filter school tooltip --- frontend/components/FindAppropriateSchool.vue | 2 + frontend/components/Map.vue | 92 +++++++++++++++++++ frontend/locales/cz.json | 3 + frontend/locales/ua.json | 3 + frontend/store/map.js | 9 +- 5 files changed, 108 insertions(+), 1 deletion(-) diff --git a/frontend/components/FindAppropriateSchool.vue b/frontend/components/FindAppropriateSchool.vue index 5a993a1..526ad7a 100644 --- a/frontend/components/FindAppropriateSchool.vue +++ b/frontend/components/FindAppropriateSchool.vue @@ -123,9 +123,11 @@ export default { methods: { ...mapMutations({ mapSetAge: 'map/setAge', + mapSetAppropriateSchool: 'map/setAppropriateSchool', }), showSchool() { this.mapSetAge(this.studentAge); + this.mapSetAppropriateSchool(this.appropriateSchool); this.$store.dispatch('map/show'); }, }, diff --git a/frontend/components/Map.vue b/frontend/components/Map.vue index 08a627c..88ed909 100644 --- a/frontend/components/Map.vue +++ b/frontend/components/Map.vue @@ -7,6 +7,17 @@ frameborder="0" :src="mapUrl.toString()" /> +
+
+ + {{ $t('components.Map.filter_tooltip') }} + + + {{ appropriateSchool }} + +
+ +
@@ -14,11 +25,92 @@ import { mapGetters } from 'vuex'; export default { + data() { + return { + filterTooltipVisible: true, + }; + }, computed: { // mix the getters into computed with object spread operator ...mapGetters({ mapUrl: 'map/url', + appropriateSchool: 'map/appropriateSchool', }), }, + watch: { + appropriateSchool() { + this.filterTooltipVisible = true; + }, + }, + methods: { + setFilterTooltipVisible(visible) { + this.filterTooltipVisible = visible; + }, + }, }; + diff --git a/frontend/locales/cz.json b/frontend/locales/cz.json index 3a04320..e69f726 100644 --- a/frontend/locales/cz.json +++ b/frontend/locales/cz.json @@ -55,6 +55,9 @@ "how_the_Czech_education_system_works": "Jak funguje český vzdělávací systém", "how_to_enroll_a_child_in_school": "Jak přihlásit dítě do školy", "more_information": "Další informace" + }, + "Map": { + "filter_tooltip" : "Zafiltrovali jsme školy, které přijímají do" } }, "pages": { diff --git a/frontend/locales/ua.json b/frontend/locales/ua.json index f551e7c..a7a13de 100644 --- a/frontend/locales/ua.json +++ b/frontend/locales/ua.json @@ -55,6 +55,9 @@ "how_the_Czech_education_system_works": "Як працює чеська система освіти", "how_to_enroll_a_child_in_school": "Як записати дитину до школи", "more_information": "Більше інформації" + }, + "Map": { + "filter_tooltip" : "Ми відфільтрували школи, які приймають" } }, "pages": { diff --git a/frontend/store/map.js b/frontend/store/map.js index bbd0b78..9ee265a 100644 --- a/frontend/store/map.js +++ b/frontend/store/map.js @@ -41,6 +41,7 @@ export const state = () => ({ defaultSearchParams: [], fullTextSearch: null, age: null, + appropriateSchool: null, locale: 'uk', show: false, }); @@ -58,11 +59,13 @@ export const mutations = { setAge(state, newAge) { state.age = newAge; }, + setAppropriateSchool(state, newAppropriateSchool) { + state.appropriateSchool = newAppropriateSchool; + }, setLocale(state, newLocale) { state.locale = newLocale; }, setShow(state, show) { - console.log('setShow', show); state.show = show; }, }; @@ -72,6 +75,10 @@ export const getters = { return state.age; }, + appropriateSchool(state) { + return state.appropriateSchool; + }, + // convert current state to URL url(state) { const url = new URL(state.baseUrl); From 2708217233ba94de5ba38910fbbbf1c0d68c541e Mon Sep 17 00:00:00 2001 From: mvdegtyar Date: Thu, 4 Aug 2022 12:39:10 +0300 Subject: [PATCH 2/2] Add Change button to filter tooltip --- frontend/components/FindAppropriateSchool.vue | 3 +- frontend/components/Map.vue | 45 ++++++++++++++++--- frontend/locales/cz.json | 3 +- frontend/locales/ua.json | 3 +- frontend/pages/index.vue | 19 ++++---- frontend/store/map.js | 15 +++---- 6 files changed, 62 insertions(+), 26 deletions(-) diff --git a/frontend/components/FindAppropriateSchool.vue b/frontend/components/FindAppropriateSchool.vue index 526ad7a..bb1744f 100644 --- a/frontend/components/FindAppropriateSchool.vue +++ b/frontend/components/FindAppropriateSchool.vue @@ -124,11 +124,12 @@ export default { ...mapMutations({ mapSetAge: 'map/setAge', mapSetAppropriateSchool: 'map/setAppropriateSchool', + mapSetActiveTab: 'map/setActiveTab', }), showSchool() { this.mapSetAge(this.studentAge); this.mapSetAppropriateSchool(this.appropriateSchool); - this.$store.dispatch('map/show'); + this.mapSetActiveTab(1); }, }, }; diff --git a/frontend/components/Map.vue b/frontend/components/Map.vue index 88ed909..ce0ce86 100644 --- a/frontend/components/Map.vue +++ b/frontend/components/Map.vue @@ -12,17 +12,23 @@ {{ $t('components.Map.filter_tooltip') }} - +
{{ appropriateSchool }} - + + +
- +