|
41 | 41 | <div class="select-container">
|
42 | 42 | <FtSelect
|
43 | 43 | v-if="showVideoSortBy"
|
44 |
| - v-show="currentTab === 'videos' && latestVideos.length > 0" |
| 44 | + v-show="currentTab === 'videos' && (showFetchMoreButton || filteredVideos.length > 1)" |
45 | 45 | :value="videoSortBy"
|
46 | 46 | :select-names="videoLiveShortSelectNames"
|
47 | 47 | :select-values="videoLiveShortSelectValues"
|
|
51 | 51 | />
|
52 | 52 | <FtSelect
|
53 | 53 | v-if="!hideChannelShorts && showShortSortBy"
|
54 |
| - v-show="currentTab === 'shorts' && latestShorts.length > 0" |
| 54 | + v-show="currentTab === 'shorts' && (showFetchMoreButton || filteredShorts.length > 1)" |
55 | 55 | :value="shortSortBy"
|
56 | 56 | :select-names="videoLiveShortSelectNames"
|
57 | 57 | :select-values="videoLiveShortSelectValues"
|
|
61 | 61 | />
|
62 | 62 | <FtSelect
|
63 | 63 | v-if="!hideLiveStreams && showLiveSortBy"
|
64 |
| - v-show="currentTab === 'live' && latestLive.length > 0" |
| 64 | + v-show="currentTab === 'live' && (showFetchMoreButton || filteredLive.length > 1)" |
65 | 65 | :value="liveSortBy"
|
66 | 66 | :select-names="videoLiveShortSelectNames"
|
67 | 67 | :select-values="videoLiveShortSelectValues"
|
|
97 | 97 | <FtElementList
|
98 | 98 | v-show="currentTab === 'videos'"
|
99 | 99 | id="videoPanel"
|
100 |
| - :data="latestVideos" |
| 100 | + :data="filteredVideos" |
101 | 101 | :use-channels-hidden-preference="false"
|
102 | 102 | role="tabpanel"
|
103 | 103 | aria-labelledby="videosTab"
|
|
112 | 112 | <FtElementList
|
113 | 113 | v-if="!hideChannelShorts && currentTab === 'shorts'"
|
114 | 114 | id="shortPanel"
|
115 |
| - :data="latestShorts" |
| 115 | + :data="filteredShorts" |
116 | 116 | :use-channels-hidden-preference="false"
|
117 | 117 | role="tabpanel"
|
118 | 118 | aria-labelledby="shortsTab"
|
|
128 | 128 | v-if="!hideLiveStreams"
|
129 | 129 | v-show="currentTab === 'live'"
|
130 | 130 | id="livePanel"
|
131 |
| - :data="latestLive" |
| 131 | + :data="filteredLive" |
132 | 132 | :use-channels-hidden-preference="false"
|
133 | 133 | role="tabpanel"
|
134 | 134 | aria-labelledby="liveTab"
|
@@ -469,6 +469,9 @@ const hideChannelPlaylists = computed(() => store.getters.getHideChannelPlaylist
|
469 | 469 | /** @type {import('vue').ComputedRef<boolean>} */
|
470 | 470 | const hideChannelCommunity = computed(() => store.getters.getHideChannelCommunity)
|
471 | 471 |
|
| 472 | +/** @type {import('vue').ComputedRef<boolean>} */ |
| 473 | +const hideWatchedSubs = computed(() => store.getters.getHideWatchedSubs) |
| 474 | +
|
472 | 475 | /**
|
473 | 476 | * @template T
|
474 | 477 | * @param {T[]} array
|
@@ -1048,6 +1051,30 @@ const videoContinuationData = shallowRef(null)
|
1048 | 1051 | const showVideoSortBy = ref(true)
|
1049 | 1052 | const videoSortBy = ref('newest')
|
1050 | 1053 |
|
| 1054 | +const filteredVideos = computed(() => { |
| 1055 | + if (hideWatchedSubs.value) { |
| 1056 | + return filterWatchedArray(latestVideos.value) |
| 1057 | + } else { |
| 1058 | + return latestVideos.value |
| 1059 | + } |
| 1060 | +}) |
| 1061 | +
|
| 1062 | +const filteredShorts = computed(() => { |
| 1063 | + if (hideWatchedSubs.value) { |
| 1064 | + return filterWatchedArray(latestShorts.value) |
| 1065 | + } else { |
| 1066 | + return latestShorts.value |
| 1067 | + } |
| 1068 | +}) |
| 1069 | +
|
| 1070 | +const filteredLive = computed(() => { |
| 1071 | + if (hideWatchedSubs.value) { |
| 1072 | + return filterWatchedArray(latestLive.value) |
| 1073 | + } else { |
| 1074 | + return latestLive.value |
| 1075 | + } |
| 1076 | +}) |
| 1077 | +
|
1051 | 1078 | watch(videoSortBy, () => {
|
1052 | 1079 | if (!autoRefreshOnSortByChangeEnabled) { return }
|
1053 | 1080 |
|
@@ -2315,6 +2342,11 @@ function handleSubscription() {
|
2315 | 2342 | posts: latestCommunityPosts.value
|
2316 | 2343 | })
|
2317 | 2344 | }
|
| 2345 | +
|
| 2346 | +function filterWatchedArray(videos) { |
| 2347 | + const historyCache = store.getters.getHistoryCacheById |
| 2348 | + return videos.filter(video => !Object.hasOwn(historyCache, video.videoId)) |
| 2349 | +} |
2318 | 2350 | </script>
|
2319 | 2351 |
|
2320 | 2352 | <style scoped src="./Channel.css" />
|
0 commit comments