Delete file 'filterMenuMixin.js' and move all from there to the files where it's used

This commit is contained in:
Wolfgang Huß 2023-06-01 20:42:51 +02:00
parent 419ec5384f
commit 5863eed59a
5 changed files with 33 additions and 31 deletions

View File

@ -18,7 +18,7 @@
</template>
<script>
import FilterMenuMixin from '~/mixins/filterMenuMixin.js'
import { mapGetters } from 'vuex'
import EventsByFilter from './EventsByFilter'
import PostTypeFilter from './PostTypeFilter'
import FollowingFilter from './FollowingFilter'
@ -33,12 +33,16 @@ export default {
CategoriesFilter,
PostTypeFilter,
},
mixins: [FilterMenuMixin],
data() {
return {
categoriesActive: this.$env.CATEGORIES_ACTIVE,
}
},
computed: {
...mapGetters({
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
}),
},
}
</script>

View File

@ -26,7 +26,7 @@
</template>
<script>
import FilterMenuMixin from '~/mixins/filterMenuMixin.js'
import { mapGetters, mapMutations } from 'vuex'
import FilterMenuSection from '~/components/FilterMenu/FilterMenuSection'
import LabeledButton from '~/components/_new/generic/LabeledButton/LabeledButton'
@ -36,8 +36,11 @@ export default {
FilterMenuSection,
LabeledButton,
},
mixins: [FilterMenuMixin],
computed: {
...mapGetters({
orderedByCreationDate: 'posts/orderedByCreationDate',
orderBy: 'posts/orderBy',
}),
orderedAsc() {
return this.orderedByCreationDate ? 'createdAt_asc' : 'eventStart_desc'
},
@ -51,6 +54,9 @@ export default {
},
},
methods: {
...mapMutations({
toggleOrder: 'posts/TOGGLE_ORDER',
}),
buttonLabel(buttonType) {
switch (buttonType) {
case 'asc':

View File

@ -37,7 +37,7 @@
</template>
<script>
import FilterMenuMixin from '~/mixins/filterMenuMixin.js'
import { mapGetters, mapMutations } from 'vuex'
import FilterMenuSection from '~/components/FilterMenu/FilterMenuSection'
import LabeledButton from '~/components/_new/generic/LabeledButton/LabeledButton'
@ -47,6 +47,17 @@ export default {
FilterMenuSection,
LabeledButton,
},
mixins: [FilterMenuMixin],
computed: {
...mapGetters({
noneSetInPostTypeFilter: 'posts/noneSetInPostTypeFilter',
articleSetInPostTypeFilter: 'posts/articleSetInPostTypeFilter',
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
}),
},
methods: {
...mapMutations({
toggleSetUnsetPostTypeFilter: 'posts/TOGGLE_SET_UNSET_POST_TYPE_FILTER',
}),
},
}
</script>

View File

@ -1,23 +0,0 @@
import { mapGetters, mapMutations } from 'vuex'
export default {
computed: {
...mapGetters({
currentUser: 'auth/user',
filteredPostTypes: 'posts/filteredPostTypes',
noneSetInPostTypeFilter: 'posts/noneSetInPostTypeFilter',
articleSetInPostTypeFilter: 'posts/articleSetInPostTypeFilter',
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
orderedByCreationDate: 'posts/orderedByCreationDate',
orderBy: 'posts/orderBy',
}),
},
methods: {
...mapMutations({
toggleFilterPostType: 'posts/TOGGLE_POST_TYPE',
toggleUnsetAllPostTypeFilters: 'posts/TOGGLE_UNSET_ALL_POST_TYPES_FILTERS',
toggleSetUnsetPostTypeFilter: 'posts/TOGGLE_SET_UNSET_POST_TYPE_FILTER',
toggleOrder: 'posts/TOGGLE_ORDER',
}),
},
}

View File

@ -138,7 +138,6 @@
<script>
import postListActions from '~/mixins/postListActions'
import FilterMenuMixin from '~/mixins/filterMenuMixin.js'
import mobile from '~/mixins/mobile'
import DonationInfo from '~/components/DonationInfo/DonationInfo.vue'
import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter.vue'
@ -166,7 +165,7 @@ export default {
FilterMenuComponent,
HeaderButton,
},
mixins: [postListActions, FilterMenuMixin, mobile()],
mixins: [postListActions, mobile()],
data() {
const { hashtag = null } = this.$route.query
return {
@ -191,7 +190,10 @@ export default {
computed: {
...mapGetters({
postsFilter: 'posts/filter',
articleSetInPostTypeFilter: 'posts/articleSetInPostTypeFilter',
eventSetInPostTypeFilter: 'posts/eventSetInPostTypeFilter',
eventsEnded: 'posts/eventsEnded',
orderBy: 'posts/orderBy',
}),
filterButtonIcon() {
return this.showFilter ? 'angle-up' : 'angle-down'
@ -223,6 +225,8 @@ export default {
},
methods: {
...mapMutations({
toggleUnsetAllPostTypeFilters: 'posts/TOGGLE_UNSET_ALL_POST_TYPES_FILTERS',
toggleSetUnsetPostTypeFilter: 'posts/TOGGLE_SET_UNSET_POST_TYPE_FILTER',
resetByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED',
resetByGroups: 'posts/TOGGLE_FILTER_BY_MY_GROUPS',
resetCategories: 'posts/RESET_CATEGORIES',