2022-01-24 15:09:28 +05:30
|
|
|
/*
|
|
|
|
|
* 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
|
2023-05-18 13:17:41 +02:00
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
2022-01-24 15:09:28 +05:30
|
|
|
|
|
|
|
|
import { Link } from 'react-router-dom';
|
2024-04-14 15:50:12 +02:00
|
|
|
import PlayArrow from '@mui/icons-material/PlayArrow';
|
2023-03-23 13:59:32 +01:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2024-10-05 16:09:34 +02:00
|
|
|
import { StyledFab } from '@/modules/core/components/buttons/StyledFab.tsx';
|
2024-12-06 23:59:39 +01:00
|
|
|
import {
|
|
|
|
|
ChapterMangaInfo,
|
|
|
|
|
ChapterReadInfo,
|
|
|
|
|
Chapters,
|
|
|
|
|
ChapterSourceOrderInfo,
|
|
|
|
|
} from '@/modules/chapter/services/Chapters.ts';
|
2022-01-24 15:09:28 +05:30
|
|
|
|
2024-12-06 23:59:39 +01:00
|
|
|
export function ResumeFab({ chapter }: { chapter: ChapterMangaInfo & ChapterSourceOrderInfo & ChapterReadInfo }) {
|
2023-03-23 13:59:32 +01:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
2024-12-06 23:59:39 +01:00
|
|
|
const { sourceOrder } = chapter;
|
2022-01-24 15:09:28 +05:30
|
|
|
return (
|
2024-12-06 23:59:39 +01:00
|
|
|
<StyledFab
|
|
|
|
|
component={Link}
|
|
|
|
|
variant="extended"
|
|
|
|
|
color="primary"
|
|
|
|
|
to={Chapters.getReaderUrl(chapter)}
|
|
|
|
|
state={{ resumeMode: Chapters.getReaderResumeMode(chapter) }}
|
|
|
|
|
>
|
2022-01-24 15:09:28 +05:30
|
|
|
<PlayArrow />
|
2024-12-06 23:59:39 +01:00
|
|
|
{sourceOrder === 1 ? t('global.button.start') : t('global.button.resume')}
|
2023-05-15 18:23:26 +02:00
|
|
|
</StyledFab>
|
2022-01-24 15:09:28 +05:30
|
|
|
);
|
|
|
|
|
}
|