Include chapter info in continue reading button tooltip
This commit is contained in:
@@ -6,14 +6,19 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import Button from '@mui/material/Button';
|
||||
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
|
||||
import { Chapters } from '@/features/chapter/services/Chapters.ts';
|
||||
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
||||
import { ChapterReadInfo, ChapterSourceOrderInfo } from '@/features/chapter/Chapter.types.ts';
|
||||
import {
|
||||
ChapterNameInfo,
|
||||
ChapterNumberInfo,
|
||||
ChapterReadInfo,
|
||||
ChapterScanlatorInfo,
|
||||
ChapterSourceOrderInfo,
|
||||
} from '@/features/chapter/Chapter.types.ts';
|
||||
import { ContinueReadingTooltip } from '@/features/manga/components/ContinueReadingTooltip.tsx';
|
||||
|
||||
export const ContinueReadingButton = ({
|
||||
showContinueReadingButton,
|
||||
@@ -21,32 +26,36 @@ export const ContinueReadingButton = ({
|
||||
mangaLinkTo,
|
||||
}: {
|
||||
showContinueReadingButton: boolean;
|
||||
chapter?: (ChapterSourceOrderInfo & ChapterReadInfo) | null;
|
||||
chapter?:
|
||||
| (ChapterSourceOrderInfo & ChapterReadInfo & ChapterNumberInfo & ChapterNameInfo & ChapterScanlatorInfo)
|
||||
| null;
|
||||
mangaLinkTo: string;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!showContinueReadingButton || !chapter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { sourceOrder } = chapter;
|
||||
const isFirstChapter = sourceOrder === 1;
|
||||
const { sourceOrder, chapterNumber, name, scanlator } = chapter;
|
||||
|
||||
return (
|
||||
<CustomTooltip title={t(isFirstChapter ? 'global.button.start' : 'global.button.resume')}>
|
||||
<ContinueReadingTooltip
|
||||
chapterNumber={chapterNumber}
|
||||
name={name}
|
||||
sourceOrder={sourceOrder}
|
||||
scanlator={scanlator}
|
||||
>
|
||||
<Button
|
||||
{...MUIUtil.preventRippleProp()}
|
||||
variant="contained"
|
||||
size="small"
|
||||
sx={{ minWidth: 'unset', py: 0.5, px: 0.75 }}
|
||||
component={Link}
|
||||
to={`${mangaLinkTo}/chapter/${chapter.sourceOrder}`}
|
||||
to={`${mangaLinkTo}/chapter/${sourceOrder}`}
|
||||
state={Chapters.getReaderOpenChapterLocationState(chapter)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<PlayArrowIcon />
|
||||
</Button>
|
||||
</CustomTooltip>
|
||||
</ContinueReadingTooltip>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user