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/. */
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import { Fab } from '@mui/material';
|
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
import { PlayArrow } from '@mui/icons-material';
|
2022-11-21 01:33:45 +01:00
|
|
|
import { BACK } from 'util/useBackTo';
|
2022-01-24 15:09:28 +05:30
|
|
|
|
2023-02-06 10:06:33 +01:00
|
|
|
interface ResumeFABProps {
|
|
|
|
|
chapter: IChapter;
|
|
|
|
|
mangaId: string;
|
2022-01-24 15:09:28 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function ResumeFab(props: ResumeFABProps) {
|
2023-02-06 10:06:33 +01:00
|
|
|
const {
|
|
|
|
|
chapter: { index, lastPageRead },
|
|
|
|
|
mangaId,
|
|
|
|
|
} = props;
|
2022-01-24 15:09:28 +05:30
|
|
|
return (
|
|
|
|
|
<Fab
|
|
|
|
|
sx={{ position: 'fixed', bottom: '2em', right: '3em' }}
|
|
|
|
|
component={Link}
|
|
|
|
|
variant="extended"
|
|
|
|
|
color="primary"
|
2023-02-06 10:06:33 +01:00
|
|
|
to={{
|
|
|
|
|
pathname: `/manga/${mangaId}/chapter/${index}/page/${lastPageRead}`,
|
|
|
|
|
state: { backLink: BACK },
|
|
|
|
|
}}
|
2022-01-24 15:09:28 +05:30
|
|
|
>
|
|
|
|
|
<PlayArrow />
|
2023-02-06 10:06:33 +01:00
|
|
|
{index === 1 ? 'Start' : 'Resume'}
|
2022-01-24 15:09:28 +05:30
|
|
|
</Fab>
|
|
|
|
|
);
|
|
|
|
|
}
|