2023-12-19 15:17:00 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-04-14 15:50:12 +02:00
|
|
|
import Button from '@mui/material/Button';
|
2023-12-19 15:17:00 +01:00
|
|
|
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
2023-12-28 16:07:50 +01:00
|
|
|
import { Link } from 'react-router-dom';
|
2025-08-15 22:02:58 +02:00
|
|
|
import { Chapters } from '@/features/chapter/services/Chapters.ts';
|
2025-03-29 03:12:36 +01:00
|
|
|
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
2025-09-18 20:37:51 +02:00
|
|
|
import {
|
|
|
|
|
ChapterNameInfo,
|
|
|
|
|
ChapterNumberInfo,
|
|
|
|
|
ChapterReadInfo,
|
|
|
|
|
ChapterScanlatorInfo,
|
|
|
|
|
ChapterSourceOrderInfo,
|
|
|
|
|
} from '@/features/chapter/Chapter.types.ts';
|
|
|
|
|
import { ContinueReadingTooltip } from '@/features/manga/components/ContinueReadingTooltip.tsx';
|
2023-12-28 16:07:50 +01:00
|
|
|
|
2023-12-19 15:17:00 +01:00
|
|
|
export const ContinueReadingButton = ({
|
|
|
|
|
showContinueReadingButton,
|
2024-12-06 23:59:39 +01:00
|
|
|
chapter,
|
2023-12-19 15:17:00 +01:00
|
|
|
mangaLinkTo,
|
|
|
|
|
}: {
|
|
|
|
|
showContinueReadingButton: boolean;
|
2025-09-18 20:37:51 +02:00
|
|
|
chapter?:
|
|
|
|
|
| (ChapterSourceOrderInfo & ChapterReadInfo & ChapterNumberInfo & ChapterNameInfo & ChapterScanlatorInfo)
|
|
|
|
|
| null;
|
2023-12-19 15:17:00 +01:00
|
|
|
mangaLinkTo: string;
|
|
|
|
|
}) => {
|
2024-12-06 23:59:39 +01:00
|
|
|
if (!showContinueReadingButton || !chapter) {
|
2023-12-19 15:17:00 +01:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-18 20:37:51 +02:00
|
|
|
const { sourceOrder, chapterNumber, name, scanlator } = chapter;
|
2024-12-06 23:59:39 +01:00
|
|
|
|
2023-12-19 15:17:00 +01:00
|
|
|
return (
|
2025-09-18 20:37:51 +02:00
|
|
|
<ContinueReadingTooltip
|
|
|
|
|
chapterNumber={chapterNumber}
|
|
|
|
|
name={name}
|
|
|
|
|
sourceOrder={sourceOrder}
|
|
|
|
|
scanlator={scanlator}
|
|
|
|
|
>
|
2023-12-19 15:17:00 +01:00
|
|
|
<Button
|
2025-03-29 03:12:36 +01:00
|
|
|
{...MUIUtil.preventRippleProp()}
|
2023-12-19 15:17:00 +01:00
|
|
|
variant="contained"
|
|
|
|
|
size="small"
|
2024-08-30 21:19:40 +02:00
|
|
|
sx={{ minWidth: 'unset', py: 0.5, px: 0.75 }}
|
2023-12-28 16:07:50 +01:00
|
|
|
component={Link}
|
2025-09-18 20:37:51 +02:00
|
|
|
to={`${mangaLinkTo}/chapter/${sourceOrder}`}
|
2025-02-01 19:48:24 +01:00
|
|
|
state={Chapters.getReaderOpenChapterLocationState(chapter)}
|
2023-12-19 15:17:00 +01:00
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
|
>
|
|
|
|
|
<PlayArrowIcon />
|
|
|
|
|
</Button>
|
2025-09-18 20:37:51 +02:00
|
|
|
</ContinueReadingTooltip>
|
2023-12-19 15:17:00 +01:00
|
|
|
);
|
|
|
|
|
};
|