Files
suwayomi-material-you-webui/src/features/manga/components/ResumeFAB.tsx
T

59 lines
1.8 KiB
TypeScript
Raw Normal View History

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
* 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';
import { StyledFab } from '@/base/components/buttons/StyledFab.tsx';
2025-08-15 22:02:58 +02:00
import { Chapters } from '@/features/chapter/services/Chapters.ts';
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
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
const { sourceOrder, name, chapterNumber, scanlator } = chapter;
const isFirstChapter = sourceOrder === 1;
2022-01-24 15:09:28 +05:30
return (
<ContinueReadingTooltip
chapterNumber={chapterNumber}
name={name}
sourceOrder={sourceOrder}
scanlator={scanlator}
2024-12-06 23:59:39 +01: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`}
</StyledFab>
</ContinueReadingTooltip>
2022-01-24 15:09:28 +05:30
);
}