From ca27b01170a891720625ed3eb3b18628a3359038 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Tue, 24 Dec 2024 12:22:25 +0800 Subject: [PATCH] feat(settings): add followingTabShowLivestreamingVideos setting --- src/_locales/cmn-CN.yml | 7 ++- src/_locales/cmn-TW.yml | 9 ++-- src/_locales/en.yml | 7 ++- src/_locales/jyut.yml | 7 ++- .../Settings/BewlyPages/Home/Home.vue | 6 +++ .../views/Home/components/Following.vue | 54 +++++++++++-------- src/logic/storage.ts | 4 ++ 7 files changed, 62 insertions(+), 32 deletions(-) diff --git a/src/_locales/cmn-CN.yml b/src/_locales/cmn-CN.yml index 2d4cfea9..607cc20c 100644 --- a/src/_locales/cmn-CN.yml +++ b/src/_locales/cmn-CN.yml @@ -80,10 +80,11 @@ settings: group_wallpaper: 背景图片 group_logo: LOGO group_search_bar: 搜索栏 - group_recommendation_mode: 推荐模式 - group_recommendation_filters: 推荐过滤 + group_recommendation_mode: “个性推荐” 推荐模式 + group_recommendation_filters: “个性推荐” 过滤 group_recommendation_filters_desc: | 请勿将限制值设置得太大,不然可能会增加加载时间! + group_following: 正在关注 group_search_page_mode: 搜索页模式 group_home_tabs: 首页标签栏 @@ -242,6 +243,8 @@ settings: filter_by_user_table: username_or_mid: 用户名 / MID + following_tab_show_livestreaming_videos: 在 “正在关注” 中显示直播视频 + use_search_page_mode: 首页使用搜索页模式 settings_shared_with_the_search_page: 与搜索页共用的配置 settings_shared_with_the_search_page_desc: 这些设置都与搜索页共用。 diff --git a/src/_locales/cmn-TW.yml b/src/_locales/cmn-TW.yml index f4094340..283d0495 100644 --- a/src/_locales/cmn-TW.yml +++ b/src/_locales/cmn-TW.yml @@ -80,11 +80,12 @@ settings: group_wallpaper: 背景圖片 group_logo: LOGO group_search_bar: 搜尋欄 - group_recommendation_mode: 推薦模式 - group_search_page_mode: 搜尋頁模式 - group_recommendation_filters: 推薦過濾 + group_recommendation_mode: 「為你推薦」推薦模式 + group_recommendation_filters: 「為你推薦」過濾 group_recommendation_filters_desc: | 限制的數值不要設太大,不然載入時間可能會增加! + group_following: 正在跟隨 + group_search_page_mode: 搜尋頁模式 group_home_tabs: 首頁標籤欄 # Settings buttons @@ -243,6 +244,8 @@ settings: filter_by_user_table: username_or_mid: 使用者名稱 / MID + following_tab_show_livestreaming_videos: 在「正在跟隨」中顯示實況直播 + use_search_page_mode: 首頁使用搜尋頁模式 settings_shared_with_the_search_page: 與搜尋頁共用的設定 settings_shared_with_the_search_page_desc: 這些設定都與搜尋頁共用。 diff --git a/src/_locales/en.yml b/src/_locales/en.yml index 3c07bd57..ca1a34dc 100644 --- a/src/_locales/en.yml +++ b/src/_locales/en.yml @@ -80,10 +80,11 @@ settings: group_wallpaper: Wallpaper group_logo: LOGO group_search_bar: Search Bar - group_recommendation_mode: Recommendation Mode - group_recommendation_filters: Recommendation Filters + group_recommendation_mode: \"For you\" Recommendation Mode + group_recommendation_filters: \"For you\" Recommendation Filters group_recommendation_filters_desc: | Do not set the restricted value too large, as this may increase loading time! + group_following: Following group_search_page_mode: Search Page Mode group_home_tabs: Home Tabs @@ -245,6 +246,8 @@ settings: filter_by_user_table: username_or_mid: Username / MID + following_tab_show_livestreaming_videos: Show Live-streaming videos in the "Following" tab + use_search_page_mode: Use search page mode on homepage settings_shared_with_the_search_page: Settings shared with the search page settings_shared_with_the_search_page_desc: Those settings are used in common with the search page. diff --git a/src/_locales/jyut.yml b/src/_locales/jyut.yml index a860b840..5ed809a5 100644 --- a/src/_locales/jyut.yml +++ b/src/_locales/jyut.yml @@ -80,10 +80,11 @@ settings: group_wallpaper: 背景圖片 group_logo: LOGO group_search_bar: 搜尋欄 - group_recommendation_mode: 推介模式 - group_recommendation_filters: 推介篩選 + group_recommendation_mode: 「估你心水」推介模式 + group_recommendation_filters: 「估你心水」過濾 group_recommendation_filters_desc: | 限制嘅數值唔好設太大,唔係嘅話會影響載入時間! + group_following: 跟緊啲人 group_search_page_mode: 搵嘢頁模式 group_home_tabs: 主頁分頁欄 @@ -241,6 +242,8 @@ settings: filter_by_user_table: username_or_mid: 用戶名 / MID + following_tab_show_livestreaming_videos: 喺「跟緊啲人」入邊顯示實況直播 + use_search_page_mode: 主頁使用搵嘢頁模式 settings_shared_with_the_search_page: 同搵嘢頁共用嘅設定 settings_shared_with_the_search_page_desc: 呢啲設定同搵嘢頁嗰度共用。 diff --git a/src/components/Settings/BewlyPages/Home/Home.vue b/src/components/Settings/BewlyPages/Home/Home.vue index 339e6ef1..e545117a 100644 --- a/src/components/Settings/BewlyPages/Home/Home.vue +++ b/src/components/Settings/BewlyPages/Home/Home.vue @@ -370,6 +370,12 @@ function handleToggleHomeTab(tab: any) { + + + + + + diff --git a/src/contentScripts/views/Home/components/Following.vue b/src/contentScripts/views/Home/components/Following.vue index 7274a8da..eed8f59e 100644 --- a/src/contentScripts/views/Home/components/Following.vue +++ b/src/contentScripts/views/Home/components/Following.vue @@ -4,6 +4,7 @@ import type { Ref } from 'vue' import type { Author } from '~/components/VideoCard/types' import { useBewlyApp } from '~/composables/useAppProvider' import type { GridLayoutType } from '~/logic' +import { settings } from '~/logic' import type { FollowingLiveResult, List as FollowingLiveItem } from '~/models/live/getFollowingLiveList' import type { DataItem as MomentItem, MomentResult } from '~/models/moment/moment' import api from '~/utils/api' @@ -48,8 +49,13 @@ const updateBaseline = ref('') const noMoreContent = ref(false) const { handleReachBottom, handlePageRefresh, haveScrollbar } = useBewlyApp() +watch(() => settings.value.followingTabShowLivestreamingVideos, (newValue) => { + if (newValue) { + getLiveVideoList() + } +}, { immediate: true }) + onMounted(() => { - getLiveVideoList() initData() initPageAction() }) @@ -279,28 +285,30 @@ defineExpose({ initData }) m="b-0 t-0" relative w-full h-full :grid="gridValue" > - +