diff --git a/src/components/ChapterCard.tsx b/src/components/ChapterCard.tsx index 62fe3377..0d755a05 100644 --- a/src/components/ChapterCard.tsx +++ b/src/components/ChapterCard.tsx @@ -7,15 +7,16 @@ import React from 'react'; import { useTheme } from '@mui/material/styles'; +import { Link } from 'react-router-dom'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import IconButton from '@mui/material/IconButton'; import MoreVertIcon from '@mui/icons-material/MoreVert'; import Typography from '@mui/material/Typography'; -import { Link } from 'react-router-dom'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import BookmarkIcon from '@mui/icons-material/Bookmark'; + import client from 'util/client'; interface IProps{ @@ -26,6 +27,7 @@ interface IProps{ export default function ChapterCard(props: IProps) { const theme = useTheme(); + const { chapter, triggerChaptersUpdate, downloadStatusString } = props; const dateStr = chapter.uploadDate && new Date(chapter.uploadDate).toISOString().slice(0, 10); @@ -33,6 +35,10 @@ export default function ChapterCard(props: IProps) { const [anchorEl, setAnchorEl] = React.useState(null); const handleClick = (event: React.MouseEvent) => { + // prevent parent tags from getting the event + event.stopPropagation(); + event.preventDefault(); + setAnchorEl(event.currentTarget); }; @@ -63,33 +69,37 @@ export default function ChapterCard(props: IProps) { }; const readChapterColor = theme.palette.mode === 'dark' ? '#acacac' : '#b0b0b0'; + return ( <>
  • - - + -
    @@ -108,33 +118,33 @@ export default function ChapterCard(props: IProps) {
    - - - - - - {downloadStatusString.endsWith('Downloaded') + + + + + + + {downloadStatusString.endsWith('Downloaded') && Delete} - {downloadStatusString.length === 0 + {downloadStatusString.length === 0 && Download } - sendChange('bookmarked', !chapter.bookmarked)}> - {chapter.bookmarked && 'Remove bookmark'} - {!chapter.bookmarked && 'Bookmark'} - - sendChange('read', !chapter.read)}> - {`Mark as ${chapter.read ? 'unread' : 'read'}`} - - sendChange('markPrevRead', true)}> - Mark previous as Read - - - + sendChange('bookmarked', !chapter.bookmarked)}> + {chapter.bookmarked && 'Remove bookmark'} + {!chapter.bookmarked && 'Bookmark'} + + sendChange('read', !chapter.read)}> + {`Mark as ${chapter.read ? 'unread' : 'read'}`} + + sendChange('markPrevRead', true)}> + Mark previous as Read + +