forked from Mirrors/elk
feat: add wellbeing preference hide news (#2026)
This commit is contained in:
parent
cbba846c4f
commit
5c3b8be055
6 changed files with 15 additions and 1 deletions
|
@ -7,6 +7,7 @@ export interface CommonRouteTabOption {
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
name?: string
|
name?: string
|
||||||
icon?: string
|
icon?: string
|
||||||
|
hide?: boolean
|
||||||
}
|
}
|
||||||
const { options, command, replace, preventScrollTop = false } = $defineProps<{
|
const { options, command, replace, preventScrollTop = false } = $defineProps<{
|
||||||
options: CommonRouteTabOption[]
|
options: CommonRouteTabOption[]
|
||||||
|
@ -31,7 +32,7 @@ useCommands(() => command
|
||||||
<template>
|
<template>
|
||||||
<div flex w-full items-center lg:text-lg of-x-auto scrollbar-hide border="b base">
|
<div flex w-full items-center lg:text-lg of-x-auto scrollbar-hide border="b base">
|
||||||
<template
|
<template
|
||||||
v-for="(option, index) in options"
|
v-for="(option, index) in options.filter(item => !item.hide)"
|
||||||
:key="option?.name || index"
|
:key="option?.name || index"
|
||||||
>
|
>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
|
|
|
@ -16,6 +16,7 @@ export interface PreferencesSettings {
|
||||||
hideTranslation: boolean
|
hideTranslation: boolean
|
||||||
hideUsernameEmojis: boolean
|
hideUsernameEmojis: boolean
|
||||||
hideAccountHoverCard: boolean
|
hideAccountHoverCard: boolean
|
||||||
|
hideNews: boolean
|
||||||
grayscaleMode: boolean
|
grayscaleMode: boolean
|
||||||
enableAutoplay: boolean
|
enableAutoplay: boolean
|
||||||
enableDataSaving: boolean
|
enableDataSaving: boolean
|
||||||
|
@ -66,6 +67,7 @@ export const DEFAULT__PREFERENCES_SETTINGS: PreferencesSettings = {
|
||||||
hideTranslation: false,
|
hideTranslation: false,
|
||||||
hideUsernameEmojis: false,
|
hideUsernameEmojis: false,
|
||||||
hideAccountHoverCard: false,
|
hideAccountHoverCard: false,
|
||||||
|
hideNews: false,
|
||||||
grayscaleMode: false,
|
grayscaleMode: false,
|
||||||
enableAutoplay: true,
|
enableAutoplay: true,
|
||||||
enableDataSaving: false,
|
enableDataSaving: false,
|
||||||
|
|
|
@ -444,6 +444,7 @@
|
||||||
"hide_boost_count": "Hide boost count",
|
"hide_boost_count": "Hide boost count",
|
||||||
"hide_favorite_count": "Hide favorite count",
|
"hide_favorite_count": "Hide favorite count",
|
||||||
"hide_follower_count": "Hide following/follower count",
|
"hide_follower_count": "Hide following/follower count",
|
||||||
|
"hide_news": "Hide news",
|
||||||
"hide_reply_count": "Hide reply count",
|
"hide_reply_count": "Hide reply count",
|
||||||
"hide_translation": "Hide translation",
|
"hide_translation": "Hide translation",
|
||||||
"hide_username_emojis": "Hide username emojis",
|
"hide_username_emojis": "Hide username emojis",
|
||||||
|
|
|
@ -442,6 +442,7 @@
|
||||||
"hide_boost_count": "隐藏转发数",
|
"hide_boost_count": "隐藏转发数",
|
||||||
"hide_favorite_count": "隐藏收藏数",
|
"hide_favorite_count": "隐藏收藏数",
|
||||||
"hide_follower_count": "隐藏关注者数",
|
"hide_follower_count": "隐藏关注者数",
|
||||||
|
"hide_news": "隐藏新闻页",
|
||||||
"hide_reply_count": "隐藏回复数",
|
"hide_reply_count": "隐藏回复数",
|
||||||
"hide_translation": "隐藏翻译",
|
"hide_translation": "隐藏翻译",
|
||||||
"hide_username_emojis": "隐藏用户昵称的表情符号",
|
"hide_username_emojis": "隐藏用户昵称的表情符号",
|
||||||
|
|
|
@ -14,6 +14,8 @@ onActivated(() =>
|
||||||
)
|
)
|
||||||
onDeactivated(() => search?.input?.blur())
|
onDeactivated(() => search?.input?.blur())
|
||||||
|
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
|
||||||
const tabs = $computed<CommonRouteTabOption[]>(() => [
|
const tabs = $computed<CommonRouteTabOption[]>(() => [
|
||||||
{
|
{
|
||||||
to: isHydrated.value ? `/${currentServer.value}/explore` : '/explore',
|
to: isHydrated.value ? `/${currentServer.value}/explore` : '/explore',
|
||||||
|
@ -26,6 +28,7 @@ const tabs = $computed<CommonRouteTabOption[]>(() => [
|
||||||
{
|
{
|
||||||
to: isHydrated.value ? `/${currentServer.value}/explore/links` : '/explore/links',
|
to: isHydrated.value ? `/${currentServer.value}/explore/links` : '/explore/links',
|
||||||
display: isHydrated.value ? t('tab.news') : '',
|
display: isHydrated.value ? t('tab.news') : '',
|
||||||
|
hide: userSettings.value.preferences.hideNews,
|
||||||
},
|
},
|
||||||
// This section can only be accessed after logging in
|
// This section can only be accessed after logging in
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,6 +92,12 @@ const userSettings = useUserSettings()
|
||||||
{{ $t('settings.preferences.hide_username_emojis_description') }}
|
{{ $t('settings.preferences.hide_username_emojis_description') }}
|
||||||
</template>
|
</template>
|
||||||
</SettingsToggleItem>
|
</SettingsToggleItem>
|
||||||
|
<SettingsToggleItem
|
||||||
|
:checked="getPreferences(userSettings, 'hideNews')"
|
||||||
|
@click="togglePreferences('hideNews')"
|
||||||
|
>
|
||||||
|
{{ $t("settings.preferences.hide_news") }}
|
||||||
|
</SettingsToggleItem>
|
||||||
<SettingsToggleItem
|
<SettingsToggleItem
|
||||||
:checked="getPreferences(userSettings, 'zenMode')"
|
:checked="getPreferences(userSettings, 'zenMode')"
|
||||||
@click="togglePreferences('zenMode')"
|
@click="togglePreferences('zenMode')"
|
||||||
|
|
Loading…
Reference in a new issue