diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2024-10-12 14:56:04 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2024-10-15 14:16:46 -0400 |
| commit | 9b1bae653d96fd276bbebde7c9dab3adf6236a77 (patch) | |
| tree | 1d14baddc225c3c4a82ff46f964db67c6ac1a931 /packages/frontend | |
| parent | revert accidental change to postgres.ts (diff) | |
| download | sharkey-9b1bae653d96fd276bbebde7c9dab3adf6236a77.tar.gz sharkey-9b1bae653d96fd276bbebde7c9dab3adf6236a77.tar.bz2 sharkey-9b1bae653d96fd276bbebde7c9dab3adf6236a77.zip | |
add "show bots" toggle to following feed
Diffstat (limited to 'packages/frontend')
| -rw-r--r-- | packages/frontend/src/components/SkUserRecentNotes.vue | 1 | ||||
| -rw-r--r-- | packages/frontend/src/pages/following-feed.vue | 21 | ||||
| -rw-r--r-- | packages/frontend/src/store.ts | 1 |
3 files changed, 16 insertions, 7 deletions
diff --git a/packages/frontend/src/components/SkUserRecentNotes.vue b/packages/frontend/src/components/SkUserRecentNotes.vue index 31580075ef..2cdb4b6586 100644 --- a/packages/frontend/src/components/SkUserRecentNotes.vue +++ b/packages/frontend/src/components/SkUserRecentNotes.vue @@ -29,6 +29,7 @@ const props = defineProps<{ withNonPublic: boolean; withQuotes: boolean; withReplies: boolean; + withBots: boolean; onlyFiles: boolean; }>(); diff --git a/packages/frontend/src/pages/following-feed.vue b/packages/frontend/src/pages/following-feed.vue index 1b3f303dfe..7b90b563e6 100644 --- a/packages/frontend/src/pages/following-feed.vue +++ b/packages/frontend/src/pages/following-feed.vue @@ -30,18 +30,12 @@ SPDX-License-Identifier: AGPL-3.0-only <div v-if="isWideViewport" ref="userScroll" :class="$style.user"> <MkHorizontalSwipe v-if="selectedUserId" v-model:tab="currentTab" :tabs="headerTabs"> - <SkUserRecentNotes ref="userRecentNotes" :userId="selectedUserId" :withNonPublic="withNonPublic" :withQuotes="withQuotes" :withReplies="withReplies" :onlyFiles="onlyFiles"/> + <SkUserRecentNotes ref="userRecentNotes" :userId="selectedUserId" :withNonPublic="withNonPublic" :withQuotes="withQuotes" :withBots="withBots" :withReplies="withReplies" :onlyFiles="onlyFiles"/> </MkHorizontalSwipe> </div> </div> </template> -<script lang="ts"> -export type FollowingFeedTab = typeof followingTab | typeof mutualsTab; -export const followingTab = 'following' as const; -export const mutualsTab = 'mutuals' as const; -</script> - <script lang="ts" setup> import { computed, Ref, ref, shallowRef } from 'vue'; import * as Misskey from 'misskey-js'; @@ -74,6 +68,10 @@ const withQuotes = computed({ get: () => defaultStore.reactiveState.followingFeed.value.withQuotes, set: value => saveFollowingFilter('withQuotes', value), }); +const withBots = computed({ + get: () => defaultStore.reactiveState.followingFeed.value.withBots, + set: value => saveFollowingFilter('withBots', value), +}); const withReplies = computed({ get: () => defaultStore.reactiveState.followingFeed.value.withReplies, set: value => saveFollowingFilter('withReplies', value), @@ -95,10 +93,13 @@ function saveFollowingFilter(key: keyof typeof defaultStore.state.followingFeed, const router = useRouter(); +const followingTab = 'following' as const; +const mutualsTab = 'mutuals' as const; const currentTab = computed({ get: () => onlyMutuals.value ? mutualsTab : followingTab, set: value => onlyMutuals.value = (value === mutualsTab), }); + const userRecentNotes = shallowRef<InstanceType<typeof SkUserRecentNotes>>(); const userScroll = shallowRef<HTMLElement>(); const noteScroll = shallowRef<HTMLElement>(); @@ -188,6 +189,7 @@ const latestNotesPagination: Paging<'notes/following'> = { includeNonPublic: withNonPublic.value, includeReplies: withReplies.value, includeQuotes: withQuotes.value, + includeBots: withBots.value, })), }; @@ -214,6 +216,11 @@ const headerActions: PageHeaderItem[] = [ }, { type: 'switch', + text: i18n.ts.showBots, + ref: withBots, + }, + { + type: 'switch', text: i18n.ts.showReplies, ref: withReplies, disabled: onlyFiles, diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 5f78330147..9f4003f88e 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -244,6 +244,7 @@ export const defaultStore = markRaw(new Storage('base', { default: { withNonPublic: false, withQuotes: false, + withBots: true, withReplies: false, onlyFiles: false, onlyMutuals: false, |