diff --git a/webapp/components/FilterMenu/FilterMenu.vue b/webapp/components/FilterMenu/FilterMenu.vue index 28cda6669..2d4d836d5 100644 --- a/webapp/components/FilterMenu/FilterMenu.vue +++ b/webapp/components/FilterMenu/FilterMenu.vue @@ -11,15 +11,7 @@ @@ -27,21 +19,12 @@ - - diff --git a/webapp/components/FilterMenu/FilterMenuComponent.vue b/webapp/components/FilterMenu/FilterMenuComponent.vue new file mode 100644 index 000000000..3f22aaed8 --- /dev/null +++ b/webapp/components/FilterMenu/FilterMenuComponent.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue index 06c3315cd..82cd2f598 100644 --- a/webapp/layouts/default.vue +++ b/webapp/layouts/default.vue @@ -5,7 +5,7 @@
- +
diff --git a/webapp/locales/de.json b/webapp/locales/de.json index d3062584a..46e18b8fd 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -267,8 +267,12 @@ "happy": "Glücklich", "surprised": "Erstaunt" }, - "filterALL": "Alle Beiträge anzeigen", "filterFollow": "Beiträge von Benutzern filtern, denen ich folge", + "filterMasonryGrid": { + "myFriends": "Beiträge von meinen Freunden", + "myTheme": "Meine Themen", + "noFilter": "Beiträge filtern" + }, "inappropriatePicture": "Dieses Bild kann für einige Menschen unangemessen sein.", "languageSelectLabel": "Sprache Deines Beitrags", "languageSelectText": "Sprache wählen", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index c4bb105cc..148303e89 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -267,8 +267,12 @@ "happy": "Happy", "surprised": "Surprised" }, - "filterALL": "View all contributions", "filterFollow": "Filter contributions from users I follow", + "filterMasonryGrid": { + "myFriends": "Posts From My Friends", + "myTheme": "My Themes", + "noFilter": "Filter Posts" + }, "inappropriatePicture": "This image may be inappropriate for some people.", "languageSelectLabel": "Language of your contribution", "languageSelectText": "Select Language", diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index aacdc4344..921724f85 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -4,6 +4,100 @@ + + + + + {{ $t('contribution.filterMasonryGrid.noFilter') }} +   + + + + + + + + {{ $t('contribution.filterMasonryGrid.myTheme') }} + + + + + + + + + {{ $t('contribution.filterMasonryGrid.myFriends') }} + + + + + + +
+ +
+
+ + @@ -65,7 +159,7 @@ import { mapGetters, mapMutations } from 'vuex' import { DonationsQuery } from '~/graphql/Donations' import { filterPosts } from '~/graphql/PostQuery.js' import UpdateQuery from '~/components/utils/UpdateQuery' - +import FilterMenuComponent from '~/components/FilterMenu/FilterMenuComponent' export default { components: { DonationInfo, @@ -74,11 +168,16 @@ export default { HcEmpty, MasonryGrid, MasonryGridItem, + FilterMenuComponent, }, mixins: [postListActions], + props: { + showMobileMenu: { type: Boolean, default: false }, + }, data() { const { hashtag = null } = this.$route.query return { + showFilter: false, showDonations: true, goal: 15000, progress: 7000, @@ -88,6 +187,7 @@ export default { offset: 0, pageSize: 12, hashtag, + categoriesActive: this.$env.CATEGORIES_ACTIVE, } }, computed: { @@ -95,6 +195,12 @@ export default { postsFilter: 'posts/filter', orderBy: 'posts/orderBy', }), + filterButtonIcon() { + if (Object.keys(this.postsFilter).length === 0) { + return this.showFilter ? 'angle-up' : 'angle-down' + } + return 'close' + }, finalFilters() { let filter = this.postsFilter if (this.hashtag) { @@ -118,12 +224,23 @@ export default { this.resetCategories() this.toggleCategory(this.categoryId) } + document.addEventListener('click', this.showFilterMenu) }, methods: { ...mapMutations({ + resetByFollowed: 'posts/TOGGLE_FILTER_BY_FOLLOWED', resetCategories: 'posts/RESET_CATEGORIES', toggleCategory: 'posts/TOGGLE_CATEGORY', }), + showFilterMenu(e) { + if (!e.target.closest('#my-filter') && !e.target.closest('.my-filter-button')) { + if (!this.showFilter) return + this.showFilter = false + } + }, + beforeDestroy() { + document.removeEventListener('click', this.showFilterMenu) + }, clearSearch() { this.$router.push({ path: '/' }) this.hashtag = null @@ -225,4 +342,12 @@ export default { display: flex; align-items: center; } +.filterButtonMenu { + position: fixed; + z-index: 6; + margin-top: -35px; + padding: 20px 10px 5px 10px; + border-radius: 7px; + background-color: #fff; +}