2025-01-12 15:02:33 +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/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import Box from '@mui/material/Box';
|
|
|
|
|
import CardActionArea from '@mui/material/CardActionArea';
|
|
|
|
|
import Card from '@mui/material/Card';
|
|
|
|
|
import CardContent from '@mui/material/CardContent';
|
2025-03-10 23:10:28 +01:00
|
|
|
import { Link } from 'react-router-dom';
|
2025-01-12 19:41:59 +01:00
|
|
|
import { memo } from 'react';
|
2025-01-12 15:02:33 +01:00
|
|
|
import { DownloadStateIndicator } from '@/modules/core/components/DownloadStateIndicator.tsx';
|
2025-03-10 23:09:36 +01:00
|
|
|
import { ChapterUpdateListFieldsFragment } from '@/lib/graphql/generated/graphql.ts';
|
2025-01-12 15:02:33 +01:00
|
|
|
import { AppRoutes } from '@/modules/core/AppRoute.constants.ts';
|
2025-03-10 22:20:46 +01:00
|
|
|
import { ChapterCardThumbnail } from '@/modules/chapter/components/cards/ChapterCardThumbnail.tsx';
|
2025-03-10 22:59:21 +01:00
|
|
|
import { ChapterCardMetadata } from '@/modules/chapter/components/cards/ChapterCardMetadata.tsx';
|
2025-03-10 23:08:13 +01:00
|
|
|
import { ChapterDownloadButton } from '@/modules/chapter/components/buttons/ChapterDownloadButton.tsx';
|
2025-03-10 23:09:36 +01:00
|
|
|
import { ChapterDownloadRetryButton } from '@/modules/chapter/components/buttons/ChapterDownloadRetryButton.tsx';
|
2025-03-10 23:10:28 +01:00
|
|
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
2025-01-12 15:02:33 +01:00
|
|
|
|
2025-01-12 19:41:59 +01:00
|
|
|
export const ChapterUpdateCard = memo(({ chapter }: { chapter: ChapterUpdateListFieldsFragment }) => {
|
2025-01-12 15:02:33 +01:00
|
|
|
const { manga } = chapter;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Card>
|
|
|
|
|
<CardActionArea
|
|
|
|
|
component={Link}
|
|
|
|
|
to={AppRoutes.reader.path(chapter.manga.id, chapter.sourceOrder)}
|
2025-03-10 23:10:28 +01:00
|
|
|
state={Chapters.getReaderOpenChapterLocationState(chapter)}
|
2025-01-12 15:02:33 +01:00
|
|
|
sx={{
|
|
|
|
|
color: (theme) => theme.palette.text[chapter.isRead ? 'disabled' : 'primary'],
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<CardContent
|
|
|
|
|
sx={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
padding: 1.5,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box sx={{ display: 'flex', flexGrow: 1 }}>
|
2025-03-10 22:20:46 +01:00
|
|
|
<ChapterCardThumbnail
|
|
|
|
|
mangaId={manga.id}
|
|
|
|
|
mangaTitle={manga.title}
|
|
|
|
|
thumbnailUrl={manga.thumbnailUrl}
|
|
|
|
|
thumbnailUrlLastFetched={manga.thumbnailUrlLastFetched}
|
|
|
|
|
/>
|
2025-03-10 22:59:21 +01:00
|
|
|
<ChapterCardMetadata title={manga.title} secondaryText={chapter.name} />
|
2025-01-12 15:02:33 +01:00
|
|
|
</Box>
|
2025-01-12 15:05:09 +01:00
|
|
|
<DownloadStateIndicator chapterId={chapter.id} />
|
2025-03-10 23:09:36 +01:00
|
|
|
<ChapterDownloadRetryButton chapterId={chapter.id} />
|
2025-03-10 23:08:13 +01:00
|
|
|
<ChapterDownloadButton chapterId={chapter.id} isDownloaded={chapter.isDownloaded} />
|
2025-01-12 15:02:33 +01:00
|
|
|
</CardContent>
|
|
|
|
|
</CardActionArea>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
2025-01-12 19:41:59 +01:00
|
|
|
});
|