From a9264e348f6360297c1abc4a0d0f5cdf9d7e99d6 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 23 Aug 2025 12:17:55 +0700 Subject: [PATCH 1/3] watched filter split by channel and playlist --- backend/user/serializers.py | 2 ++ backend/user/src/user_config.py | 4 ++++ frontend/src/api/actions/updateUserConfig.ts | 2 ++ frontend/src/components/Filterbar.tsx | 14 +++++++++++--- .../src/configuration/constants/HideWatched.ts | 7 +++++++ frontend/src/pages/ChannelVideo.tsx | 12 ++++++++---- frontend/src/pages/Home.tsx | 7 ++++++- frontend/src/pages/Playlist.tsx | 8 +++++--- frontend/src/stores/UserConfigStore.ts | 4 +++- 9 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 frontend/src/configuration/constants/HideWatched.ts diff --git a/backend/user/serializers.py b/backend/user/serializers.py index dea69916..4a54aa4c 100644 --- a/backend/user/serializers.py +++ b/backend/user/serializers.py @@ -42,6 +42,8 @@ class UserMeConfigSerializer(serializers.Serializer): ) grid_items = serializers.IntegerField(max_value=7, min_value=3) hide_watched = serializers.BooleanField(allow_null=True) + hide_watched_channel = serializers.BooleanField(allow_null=True) + hide_watched_playlist = serializers.BooleanField(allow_null=True) file_size_unit = serializers.ChoiceField(choices=["binary", "metric"]) show_ignored_only = serializers.BooleanField() show_subed_only = serializers.BooleanField(allow_null=True) diff --git a/backend/user/src/user_config.py b/backend/user/src/user_config.py index 5037c390..8cd5c01d 100644 --- a/backend/user/src/user_config.py +++ b/backend/user/src/user_config.py @@ -23,6 +23,8 @@ class UserConfigType(TypedDict, total=False): vid_type_filter: str | None grid_items: int hide_watched: bool | None + hide_watched_channel: bool | None + hide_watched_playlist: bool | None file_size_unit: str show_ignored_only: bool show_subed_only: bool | None @@ -48,6 +50,8 @@ class UserConfig: vid_type_filter=None, grid_items=3, hide_watched=False, + hide_watched_channel=None, + hide_watched_playlist=None, file_size_unit="binary", show_ignored_only=False, show_subed_only=None, diff --git a/frontend/src/api/actions/updateUserConfig.ts b/frontend/src/api/actions/updateUserConfig.ts index d9a4b7f8..0fedd650 100644 --- a/frontend/src/api/actions/updateUserConfig.ts +++ b/frontend/src/api/actions/updateUserConfig.ts @@ -34,6 +34,8 @@ export type UserConfigType = { vid_type_filter: VideoTypes | null; grid_items: number; hide_watched: boolean | null; + hide_watched_channel: boolean | null; + hide_watched_playlist: boolean | null; file_size_unit: 'binary' | 'metric'; show_ignored_only: boolean; show_subed_only: boolean | null; diff --git a/frontend/src/components/Filterbar.tsx b/frontend/src/components/Filterbar.tsx index a03e5392..95f3c8f9 100644 --- a/frontend/src/components/Filterbar.tsx +++ b/frontend/src/components/Filterbar.tsx @@ -21,14 +21,21 @@ import { useFilterBarTempConf } from '../stores/FilterbarTempConf'; import { useVideoSelectionStore } from '../stores/VideoSelectionStore'; import Button from './Button'; import updateDownloadQueue from '../api/actions/updateDownloadQueue'; +import { HideWatchedType } from '../configuration/constants/HideWatched'; type FilterbarProps = { viewStyle: ViewStyleNamesType; + hideWatched: HideWatchedType; showSort?: boolean; showTypeFilter?: boolean; }; -const Filterbar = ({ viewStyle, showSort = true, showTypeFilter = false }: FilterbarProps) => { +const Filterbar = ({ + viewStyle, + hideWatched, + showSort = true, + showTypeFilter = false, +}: FilterbarProps) => { const { userConfig, setUserConfig } = useUserConfigStore(); const { selectedVideoIds, @@ -44,6 +51,7 @@ const Filterbar = ({ viewStyle, showSort = true, showTypeFilter = false }: Filte useFilterBarTempConf(); const currentViewStyle = userConfig[viewStyle]; + const currentHideWatched = userConfig[hideWatched]; const isGridView = currentViewStyle === ViewStylesEnum.Grid; useEffect(() => { @@ -114,10 +122,10 @@ const Filterbar = ({ viewStyle, showSort = true, showTypeFilter = false }: Filte
Filter: