Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Add Change button to filter tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdegtyar committed Aug 4, 2022
1 parent 3319a84 commit 2708217
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 26 deletions.
3 changes: 2 additions & 1 deletion frontend/components/FindAppropriateSchool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
},
};
Expand Down
45 changes: 39 additions & 6 deletions frontend/components/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@
<span>
{{ $t('components.Map.filter_tooltip') }}
</span>
<span class="font-body-bold">
<div class="flex flex-row text-body-bold leading-body-bold font-body-bold font-body-bold">
{{ appropriateSchool }}
</span>
<button class="ml-s change lg:hidden" @click="changeFilter()">
{{ $t('components.Map.filter_change') }}
</button>
<span class="ml-s change change-animation hidden lg:block">
{{ $t('components.Map.filter_change') }}
</span>
</div>
</div>
<span class="close" @click="setFilterTooltipVisible(false)" />
<button class="close" @click="setFilterTooltipVisible(false)" />
</div>
</div>
</template>

<script>
import { mapGetters } from 'vuex';
import { mapGetters, mapMutations } from 'vuex';
export default {
data() {
Expand All @@ -43,9 +49,15 @@ export default {
},
},
methods: {
...mapMutations({
mapActiveTab: 'map/setActiveTab',
}),
setFilterTooltipVisible(visible) {
this.filterTooltipVisible = visible;
},
changeFilter() {
this.mapActiveTab(0);
},
},
};
</script>
Expand Down Expand Up @@ -76,8 +88,8 @@ export default {
/* At width 1380px umapa changes position of filters */
@media(max-width: 1380px) {
.filter-popover {
bottom: 120px;
right: 65px;
bottom: 90px;
right: 75px;
}
/*right arrow*/
.filter-popover::after {
Expand Down Expand Up @@ -113,4 +125,25 @@ export default {
.close:after {
transform: rotate(-45deg);
}
.change {
color: #0d99ff;
}
.change-animation {
animation: fadeInOut 5s;
opacity: 0;
}
@keyframes fadeInOut {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
3 changes: 2 additions & 1 deletion frontend/locales/cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"more_information": "Další informace"
},
"Map": {
"filter_tooltip" : "Zafiltrovali jsme školy, které přijímají do"
"filter_tooltip" : "Zafiltrovali jsme školy, které přijímají do",
"filter_change" : "Změnit"
}
},
"pages": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/locales/ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"more_information": "Більше інформації"
},
"Map": {
"filter_tooltip" : "Ми відфільтрували школи, які приймають"
"filter_tooltip": "Ми відфільтрували школи, які приймають",
"filter_change": "Змінити"
}
},
"pages": {
Expand Down
19 changes: 11 additions & 8 deletions frontend/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</template>

<script>
import { mapGetters } from 'vuex';
import { mapGetters, mapMutations } from 'vuex';
import { MatchMedia } from 'vue-component-media-queries';
import HomeIcon from '~/assets/images/icons/home.svg?inline';
Expand All @@ -93,22 +93,25 @@ export default {
};
},
computed: {
...mapGetters({ mapShow: 'map/show' }),
...mapGetters({
getActiveTab: 'map/activeTab',
}),
},
watch: {
mapShow(show, _) {
console.log('mapShow index', show);
if (show) {
this.selectTab(1);
}
getActiveTab(activeTab, _) {
console.log('activeTab index', activeTab);
this.activeTabIndex = activeTab;
},
},
mounted() {
this.isMounted = true;
},
methods: {
...mapMutations({
setActiveTab: 'map/setActiveTab',
}),
selectTab(i) {
this.activeTabIndex = i;
this.setActiveTab(i);
},
},
};
Expand Down
15 changes: 6 additions & 9 deletions frontend/store/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const state = () => ({
appropriateSchool: null,
locale: 'uk',
show: false,
activeTab: 0,
});

export const mutations = {
Expand All @@ -65,8 +66,9 @@ export const mutations = {
setLocale(state, newLocale) {
state.locale = newLocale;
},
setShow(state, show) {
state.show = show;

setActiveTab(state, activeTab) {
state.activeTab = activeTab;
},
};

Expand Down Expand Up @@ -107,8 +109,8 @@ export const getters = {
return url;
},

show(state) {
return state.show;
activeTab(state) {
return state.activeTab;
},
};

Expand All @@ -118,9 +120,4 @@ export const actions = {
context.commit('setDefaultSearchParams', [...(new URLSearchParams($config.umapaDefaultSearchParams).entries())]);
context.commit('setLocale', i18n.locale);
},

show(context) {
context.commit('setShow', true);
setTimeout(() => context.commit('setShow', false));
},
};

0 comments on commit 2708217

Please sign in to comment.