-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(home): add ignored flag to recent videos view
- Loading branch information
Showing
21 changed files
with
401 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/ui/components/pages/Home/ChannelRenderer/ChannelVideos/VideoCard/Badges/IgnoredBadge.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import { Box, Tooltip } from '@mui/material'; | ||
import DoDisturbOnIcon from '@mui/icons-material/DoDisturbOn'; | ||
import { HomeView, Video } from 'types'; | ||
import { useAppSelector } from 'store'; | ||
import { selectVideoMeta } from 'store/selectors/videos'; | ||
|
||
interface IgnoredBadgeProps { | ||
video: Video; | ||
view: HomeView; | ||
} | ||
|
||
function IgnoredBadge(props: IgnoredBadgeProps) { | ||
const { video, view } = props; | ||
const { isIgnored } = useAppSelector(selectVideoMeta(video)); | ||
|
||
return view === HomeView.Recent && isIgnored ? ( | ||
<Tooltip title="Ignored" aria-label="ignored"> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
color: '#eee', | ||
backgroundColor: 'rgba(0, 0, 0, 0.8)', | ||
padding: '3px 5px', | ||
borderRadius: '2px', | ||
'&:hover': { | ||
color: '#fff', | ||
}, | ||
}} | ||
> | ||
<DoDisturbOnIcon sx={{ fontSize: '1rem' }} /> | ||
</Box> | ||
</Tooltip> | ||
) : null; | ||
} | ||
|
||
export default IgnoredBadge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...omponents/pages/Home/ChannelRenderer/ChannelVideos/VideoCard/TopActions/IgnoredAction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react'; | ||
import { IconButton, Tooltip } from '@mui/material'; | ||
import DoDisturbOnIcon from '@mui/icons-material/DoDisturbOn'; | ||
import DoNotDisturbOffIcon from '@mui/icons-material/DoNotDisturbOff'; | ||
import { HomeView, Video } from 'types'; | ||
import { useAppDispatch, useAppSelector } from 'store'; | ||
import { addVideoFlag, removeVideoFlag } from 'store/reducers/videos'; | ||
import { selectVideoMeta } from 'store/selectors/videos'; | ||
|
||
interface IgnoredActionProps { | ||
video: Video; | ||
view: HomeView; | ||
} | ||
|
||
function IgnoredAction(props: IgnoredActionProps) { | ||
const { video, view } = props; | ||
const { isIgnored } = useAppSelector(selectVideoMeta(video)); | ||
const dispatch = useAppDispatch(); | ||
|
||
return view === HomeView.Recent ? ( | ||
isIgnored ? ( | ||
<Tooltip title="Unignore" aria-label="unignore"> | ||
<IconButton | ||
sx={{ | ||
display: 'flex', | ||
color: '#eee', | ||
backgroundColor: 'rgba(0, 0, 0, 0.8)', | ||
padding: '4px', | ||
borderRadius: '2px', | ||
'&:hover': { | ||
color: '#fff', | ||
}, | ||
}} | ||
size="small" | ||
onClick={() => { | ||
dispatch( | ||
removeVideoFlag({ | ||
video, | ||
flag: 'ignored', | ||
}), | ||
); | ||
}} | ||
> | ||
<DoNotDisturbOffIcon sx={{ fontSize: '1.125rem' }} /> | ||
</IconButton> | ||
</Tooltip> | ||
) : ( | ||
<Tooltip title="Ignore" aria-label="ignore"> | ||
<IconButton | ||
sx={{ | ||
color: '#eee', | ||
backgroundColor: 'rgba(0, 0, 0, 0.8)', | ||
padding: '4px', | ||
borderRadius: '2px', | ||
'&:hover': { | ||
color: '#fff', | ||
}, | ||
}} | ||
size="small" | ||
onClick={() => { | ||
dispatch( | ||
addVideoFlag({ | ||
video, | ||
flag: 'ignored', | ||
}), | ||
); | ||
}} | ||
> | ||
<DoDisturbOnIcon sx={{ fontSize: '1.125rem' }} /> | ||
</IconButton> | ||
</Tooltip> | ||
) | ||
) : null; | ||
} | ||
|
||
export default IgnoredAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.