Skip to content

Commit

Permalink
refactor: rename uncategorised filter to others
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Aug 22, 2022
1 parent f8c9254 commit f228a80
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/store/reducers/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export const defaultSettings = {
autoPlayVideos: true,
recentVideosSeniority: VideosSeniority.OneDay,
recentViewFilters: {
uncategorised: true,
viewed: true,
watchLater: true,
others: true,
},
watchLaterViewFilters: {
uncategorised: true,
viewed: true,
archived: true,
others: true,
},
homeDisplayOptions: {
hiddenViews: [],
Expand Down
6 changes: 3 additions & 3 deletions src/store/selectors/videos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ const filterVideoByFlags = (video: VideoCache, filters: ViewFilters) => {
};
return filterKeys.some((key) => {
switch (key) {
case 'uncategorised':
case 'others':
return (
filters.uncategorised &&
filters.others &&
filterKeys
.filter((key) => !['uncategorised'].includes(key))
.filter((key) => !['others'].includes(key))
.every((key) => !hasFlag(key))
);
default:
Expand Down
4 changes: 2 additions & 2 deletions src/types/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export interface HomeDisplayOptions {
}

export interface RecentViewFilters {
uncategorised: boolean;
viewed: boolean;
watchLater: boolean;
others: boolean;
}

export interface WatchLaterViewFilters {
uncategorised: boolean;
viewed: boolean;
archived: boolean;
others: boolean;
}

export type ViewFilters = Either<RecentViewFilters, WatchLaterViewFilters>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ function RecentViewRenderer(props: RecentViewRendererProps) {
const videos = useAppSelector(selectRecentChannelVideos(channel));
const filterCallback = useCallback(
(video: Video) => {
if (settings.recentViewFilters.uncategorised) {
if (settings.recentViewFilters.others) {
return !videos.excluded.includes(video.id);
} else {
return videos.included.includes(video.id);
}
},
[settings.recentViewFilters.uncategorised, videos],
[settings.recentViewFilters.others, videos],
);
const publishedAfter = useMemo(
() => getDateBefore(settings.recentVideosSeniority).toISOString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ function RecentViewFilters(props: RecentViewFiltersProps) {
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
>
<CheckableMenuItem
checked={filters.uncategorised}
onClick={() => handleFilterToggle('uncategorised')}
>
Uncategorised
</CheckableMenuItem>
<CheckableMenuItem
checked={filters.viewed}
onClick={() => handleFilterToggle('viewed')}
Expand All @@ -76,6 +70,12 @@ function RecentViewFilters(props: RecentViewFiltersProps) {
>
Watch later
</CheckableMenuItem>
<CheckableMenuItem
checked={filters.others}
onClick={() => handleFilterToggle('others')}
>
Others
</CheckableMenuItem>
</StyledMenu>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ function WatchLaterViewFilters(props: WatchLaterViewFiltersProps) {
transformOrigin={{ horizontal: 'right', vertical: 'top' }}
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
>
<CheckableMenuItem
checked={filters.uncategorised}
onClick={() => handleFilterToggle('uncategorised')}
>
Uncategorised
</CheckableMenuItem>
<CheckableMenuItem
checked={filters.viewed}
onClick={() => handleFilterToggle('viewed')}
Expand All @@ -76,6 +70,12 @@ function WatchLaterViewFilters(props: WatchLaterViewFiltersProps) {
>
Archived
</CheckableMenuItem>
<CheckableMenuItem
checked={filters.others}
onClick={() => handleFilterToggle('others')}
>
Others
</CheckableMenuItem>
</StyledMenu>
</>
);
Expand Down

0 comments on commit f228a80

Please sign in to comment.