Change manga in library state on long press in list mode (#715)

Was forgotten in 29860482a6
This commit is contained in:
schroda
2024-04-07 21:19:12 +02:00
committed by GitHub
parent 29860482a6
commit ca8daab0da
2 changed files with 47 additions and 5 deletions

View File

@@ -392,8 +392,22 @@ export const MangaCard = (props: MangaCardProps) => {
component={RouterLink} component={RouterLink}
to={mangaLinkTo} to={mangaLinkTo}
onClick={handleClick} onClick={handleClick}
{...longPressBind()} {...longPressBind(() => popupState.open(optionButtonRef.current))}
sx={{ touchCallout: 'none' }} sx={{
touchCallout: 'none',
'@media (hover: hover) and (pointer: fine)': {
'&:hover .manga-option-button': {
visibility: 'visible',
pointerEvents: 'all',
},
},
'&:hover .source-manga-library-state-button': {
display: isMobile ? 'none' : 'inline-flex',
},
'&:hover .source-manga-library-state-indicator': {
display: 'none',
},
}}
> >
<CardContent <CardContent
sx={{ sx={{
@@ -441,17 +455,44 @@ export const MangaCard = (props: MangaCardProps) => {
</Box> </Box>
<Stack direction="row" alignItems="center" gap="5px"> <Stack direction="row" alignItems="center" gap="5px">
<BadgeContainer> <BadgeContainer>
{inLibraryIndicator && (
<Button
className="source-manga-library-state-button"
component="div"
variant="contained"
size="small"
onMouseDown={(e) => e.stopPropagation()}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
updateLibraryState();
}}
sx={{
display: 'none',
}}
color={isInLibrary ? 'error' : 'primary'}
>
{t(
isInLibrary
? 'manga.action.library.remove.label.action'
: 'manga.button.add_to_library',
)}
</Button>
)}
{inLibraryIndicator && isInLibrary && ( {inLibraryIndicator && isInLibrary && (
<Typography sx={{ backgroundColor: 'primary.dark' }}> <Typography
className="source-manga-library-state-indicator"
sx={{ backgroundColor: 'primary.dark' }}
>
{t('manga.button.in_library')} {t('manga.button.in_library')}
</Typography> </Typography>
)} )}
{showUnreadBadge && unread! > 0 && ( {showUnreadBadge && (unread ?? 0) > 0 && (
<Typography sx={{ backgroundColor: 'primary.dark' }}> <Typography sx={{ backgroundColor: 'primary.dark' }}>
{unread} {unread}
</Typography> </Typography>
)} )}
{showDownloadBadge && downloadCount! > 0 && ( {showDownloadBadge && (downloadCount ?? 0) > 0 && (
<Typography <Typography
sx={{ sx={{
backgroundColor: 'success.dark', backgroundColor: 'success.dark',

View File

@@ -78,6 +78,7 @@ export const MangaOptionButton = forwardRef(
return ( return (
<Tooltip title={t('global.button.options')}> <Tooltip title={t('global.button.options')}>
<IconButton <IconButton
ref={ref}
{...bindTriggerProps} {...bindTriggerProps}
onClick={handleClick} onClick={handleClick}
onTouchStart={handleClick} onTouchStart={handleClick}