Skip to content

Commit

Permalink
refactor: rename any filter to uncategorised
Browse files Browse the repository at this point in the history
the "any" keyword was a bit confusing
  • Loading branch information
AXeL-dev committed Apr 3, 2022
1 parent 665b3b6 commit 822d8c0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/store/reducers/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export const defaultSettings = {
autoPlayVideos: true,
recentVideosSeniority: VideosSeniority.OneDay,
recentViewFilters: {
any: true,
uncategorised: true,
viewed: true,
watchLater: true,
},
watchLaterViewFilters: {
any: true,
uncategorised: true,
viewed: true,
archived: true,
},
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 @@ -48,11 +48,11 @@ export const filterVideoByFlags = (flags: VideoFlags, filters: ViewFilters) => {
const filterKeys = Object.keys(filters) as ViewFilter[];
return filterKeys.some((key) => {
switch (key) {
case 'any':
case 'uncategorised':
return (
filters.any &&
filters.uncategorised &&
filterKeys
.filter((key) => key !== 'any')
.filter((key) => key !== 'uncategorised')
.every((key) => {
const flag = filter2Flag(key);
return !flags[flag];
Expand Down
4 changes: 2 additions & 2 deletions src/types/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export interface Settings {
}

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

export interface WatchLaterViewFilters {
any: boolean;
uncategorised: boolean;
viewed: boolean;
archived: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ function RecentViewRenderer(props: RecentViewRendererProps) {
);
const filterCallback = useCallback(
(video: Video) => {
if (filters.any) {
if (filters.uncategorised) {
return !exclusionList.includes(video.id);
} else {
return inclusionList.includes(video.id);
}
},
[filters.any, exclusionList, inclusionList]
[filters.uncategorised, exclusionList, inclusionList]
);
const publishedAfter = getDateBefore(
settings.recentVideosSeniority
Expand Down
10 changes: 5 additions & 5 deletions src/ui/components/pages/Home/TabActions/RecentViewActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ function RecentViewActions(props: RecentViewActionsProps) {
setAnchorEl(null);
};

const handleAnyFilterToggle = () => {
const handleUncategorisedFilterToggle = () => {
dispatch(
setViewFilters({
view: HomeView.Recent,
filters: {
any: !filters.any,
uncategorised: !filters.uncategorised,
},
})
);
Expand Down Expand Up @@ -83,10 +83,10 @@ function RecentViewActions(props: RecentViewActionsProps) {
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
>
<CheckableMenuItem
checked={filters.any}
onClick={handleAnyFilterToggle}
checked={filters.uncategorised}
onClick={handleUncategorisedFilterToggle}
>
Any
Uncategorised
</CheckableMenuItem>
<CheckableMenuItem
checked={filters.viewed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ function WatchLaterViewFilters(props: WatchLaterViewFiltersProps) {
setAnchorEl(null);
};

const handleAnyFilterToggle = () => {
const handleUncategorisedFilterToggle = () => {
dispatch(
setViewFilters({
view: HomeView.WatchLater,
filters: {
any: !filters.any,
uncategorised: !filters.uncategorised,
},
})
);
Expand Down Expand Up @@ -81,10 +81,10 @@ function WatchLaterViewFilters(props: WatchLaterViewFiltersProps) {
anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}
>
<CheckableMenuItem
checked={filters.any}
onClick={handleAnyFilterToggle}
checked={filters.uncategorised}
onClick={handleUncategorisedFilterToggle}
>
Any
Uncategorised
</CheckableMenuItem>
<CheckableMenuItem
checked={filters.viewed}
Expand Down

0 comments on commit 822d8c0

Please sign in to comment.