From 51a78e8b8a89065062d5b4c1b72d5bdd457d9663 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 25 Feb 2021 10:56:16 +0200 Subject: add a quick settings menu for timeline headers --- src/components/timeline/timeline_quick_settings.js | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/components/timeline/timeline_quick_settings.js (limited to 'src/components/timeline/timeline_quick_settings.js') diff --git a/src/components/timeline/timeline_quick_settings.js b/src/components/timeline/timeline_quick_settings.js new file mode 100644 index 00000000..eb1eb8fb --- /dev/null +++ b/src/components/timeline/timeline_quick_settings.js @@ -0,0 +1,60 @@ +import Popover from '../popover/popover.vue' +import BooleanSetting from '../settings_modal/helpers/boolean_setting.vue' +import { mapGetters } from 'vuex' +import { library } from '@fortawesome/fontawesome-svg-core' +import { faFilter, faWrench } from '@fortawesome/free-solid-svg-icons' + +library.add( + faFilter, + faWrench +) + +const TimelineQuickSettings = { + components: { + Popover, + BooleanSetting + }, + methods: { + setReplyVisibility (visibility) { + console.log('set reply visibility', visibility) + this.$store.dispatch('setOption', { name: 'replyVisibility', value: visibility }) + this.$store.dispatch('queueFlushAll') + }, + openTab (tab) { + this.$store.dispatch('openSettingsModalTab', tab) + } + }, + computed: { + ...mapGetters(['mergedConfig']), + replyVisibilitySelf: { + get () { return this.mergedConfig.replyVisibility === 'self' }, + set () { this.setReplyVisibility('self') } + }, + replyVisibilityFollowing: { + get () { return this.mergedConfig.replyVisibility === 'following' }, + set () { this.setReplyVisibility('following') } + }, + replyVisibilityAll: { + get () { return this.mergedConfig.replyVisibility === 'all' }, + set () { this.setReplyVisibility('all') } + }, + hideMedia: { + get () { return this.mergedConfig.hideAttachments || this.mergedConfig.hideAttachmentsInConv }, + set () { + const value = !this.hideMedia + this.$store.dispatch('setOption', { name: 'hideAttachments', value }) + this.$store.dispatch('setOption', { name: 'hideAttachmentsInConv', value }) + } + }, + hideMutedPosts: { + get () { return this.mergedConfig.hideMutedPosts || this.mergedConfig.hideFilteredStatuses }, + set () { + const value = !this.hideMutedPosts + this.$store.dispatch('setOption', { name: 'hideMutedPosts', value }) + this.$store.dispatch('setOption', { name: 'hideFilteredStatuses', value }) + } + } + } +} + +export default TimelineQuickSettings -- cgit v1.2.3-70-g09d2 From 93785634a72420338911d8a8a7fc7eef3eb478e4 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 25 Feb 2021 11:01:11 +0200 Subject: basic loggedin check for reply filtering --- src/components/timeline/timeline_quick_settings.js | 3 + .../timeline/timeline_quick_settings.vue | 64 +++++++++++----------- 2 files changed, 36 insertions(+), 31 deletions(-) (limited to 'src/components/timeline/timeline_quick_settings.js') diff --git a/src/components/timeline/timeline_quick_settings.js b/src/components/timeline/timeline_quick_settings.js index eb1eb8fb..ecac06e9 100644 --- a/src/components/timeline/timeline_quick_settings.js +++ b/src/components/timeline/timeline_quick_settings.js @@ -26,6 +26,9 @@ const TimelineQuickSettings = { }, computed: { ...mapGetters(['mergedConfig']), + loggedIn () { + return !!this.$store.state.users.currentUser + }, replyVisibilitySelf: { get () { return this.mergedConfig.replyVisibility === 'self' }, set () { this.setReplyVisibility('self') } diff --git a/src/components/timeline/timeline_quick_settings.vue b/src/components/timeline/timeline_quick_settings.vue index 51edff71..67f6be53 100644 --- a/src/components/timeline/timeline_quick_settings.vue +++ b/src/components/timeline/timeline_quick_settings.vue @@ -8,37 +8,39 @@ slot="content" class="timeline-settings-menu dropdown-menu" > - - - -