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';
|
2026-01-10 19:45:02 +01:00
|
|
|
import { useLingui } from '@lingui/react/macro';
|
2025-08-16 02:48:46 +02:00
|
|
|
import { StyledFab } from '@/base/components/buttons/StyledFab.tsx';
|
2025-08-15 22:02:58 +02:00
|
|
|
import { Chapters } from '@/features/chapter/services/Chapters.ts';
|
2025-09-18 20:37:51 +02:00
|
|
|
import {
|
|
|
|
|
ChapterMangaInfo,
|
|
|
|
|
ChapterNameInfo,
|
|
|
|
|
ChapterNumberInfo,
|
|
|
|
|
ChapterReadInfo,
|
|
|
|
|
ChapterScanlatorInfo,
|
|
|
|
|
ChapterSourceOrderInfo,
|
|
|
|
|
} from '@/features/chapter/Chapter.types.ts';
|
|
|
|
|
import { ContinueReadingTooltip } from '@/features/manga/components/ContinueReadingTooltip.tsx';
|
2022-01-24 15:09:28 +05:30
|
|
|
|
2025-09-18 20:37:51 +02:00
|
|
|
export function ResumeFab({
|
|
|
|
|
chapter,
|
|
|
|
|
}: {
|
|
|
|
|
chapter: ChapterMangaInfo &
|
|
|
|
|
ChapterSourceOrderInfo &
|
|
|
|
|
ChapterReadInfo &
|
|
|
|
|
ChapterNumberInfo &
|
|
|
|
|
ChapterNameInfo &
|
|
|
|
|
ChapterScanlatorInfo;
|
|
|
|
|
}) {
|
2026-01-10 19:45:02 +01:00
|
|
|
const { t } = useLingui();
|
2023-03-23 13:59:32 +01:00
|
|
|
|
2025-09-18 20:37:51 +02:00
|
|
|
const { sourceOrder, name, chapterNumber, scanlator } = chapter;
|
|
|
|
|
const isFirstChapter = sourceOrder === 1;
|
|
|
|
|
|
2022-01-24 15:09:28 +05:30
|
|
|
return (
|
2025-09-18 20:37:51 +02:00
|
|
|
<ContinueReadingTooltip
|
|
|
|
|
chapterNumber={chapterNumber}
|
|
|
|
|
name={name}
|
|
|
|
|
sourceOrder={sourceOrder}
|
|
|
|
|
scanlator={scanlator}
|
2024-12-06 23:59:39 +01:00
|
|
|
>
|
2025-09-18 20:37:51 +02:00
|
|
|
<StyledFab
|
|
|
|
|
component={Link}
|
|
|
|
|
variant="extended"
|
|
|
|
|
color="primary"
|
|
|
|
|
to={Chapters.getReaderUrl(chapter)}
|
|
|
|
|
state={Chapters.getReaderOpenChapterLocationState(chapter)}
|
|
|
|
|
>
|
|
|
|
|
<PlayArrow />
|
2026-01-10 19:45:02 +01:00
|
|
|
{isFirstChapter ? t`Start` : t`Resume`}
|
2025-09-18 20:37:51 +02:00
|
|
|
</StyledFab>
|
|
|
|
|
</ContinueReadingTooltip>
|
2022-01-24 15:09:28 +05:30
|
|
|
);
|
|
|
|
|
}
|