2021-03-23 00:20:55 +01:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2021-03-26 00:47:02 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
2021-01-26 21:02:12 +01:00
|
|
|
* 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/. */
|
|
|
|
|
2021-01-19 17:50:28 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { makeStyles } from '@material-ui/core/styles';
|
|
|
|
import Card from '@material-ui/core/Card';
|
|
|
|
import CardContent from '@material-ui/core/CardContent';
|
|
|
|
import Button from '@material-ui/core/Button';
|
|
|
|
import Typography from '@material-ui/core/Typography';
|
2021-03-23 00:20:55 +01:00
|
|
|
import { Link, useHistory } from 'react-router-dom';
|
2021-01-19 17:50:28 +01:00
|
|
|
|
|
|
|
const useStyles = makeStyles((theme) => ({
|
|
|
|
root: {
|
|
|
|
display: 'flex',
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
alignItems: 'center',
|
|
|
|
padding: 16,
|
|
|
|
},
|
|
|
|
bullet: {
|
|
|
|
display: 'inline-block',
|
|
|
|
margin: '0 2px',
|
|
|
|
transform: 'scale(0.8)',
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
fontSize: 14,
|
|
|
|
},
|
|
|
|
pos: {
|
|
|
|
marginBottom: 12,
|
|
|
|
},
|
|
|
|
icon: {
|
|
|
|
width: theme.spacing(7),
|
|
|
|
height: theme.spacing(7),
|
|
|
|
flex: '0 0 auto',
|
|
|
|
marginRight: 16,
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
2021-01-19 18:32:57 +01:00
|
|
|
interface IProps{
|
|
|
|
chapter: IChapter
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function ChapterCard(props: IProps) {
|
2021-01-19 17:50:28 +01:00
|
|
|
const classes = useStyles();
|
2021-03-18 19:16:24 +01:00
|
|
|
const history = useHistory();
|
2021-01-19 18:32:57 +01:00
|
|
|
const { chapter } = props;
|
2021-01-19 17:50:28 +01:00
|
|
|
|
2021-01-19 21:34:12 +01:00
|
|
|
const dateStr = chapter.date_upload && new Date(chapter.date_upload).toISOString().slice(0, 10);
|
|
|
|
|
2021-01-19 17:50:28 +01:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<li>
|
|
|
|
<Card>
|
|
|
|
<CardContent className={classes.root}>
|
|
|
|
<div style={{ display: 'flex' }}>
|
|
|
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
|
<Typography variant="h5" component="h2">
|
2021-01-19 18:32:57 +01:00
|
|
|
{chapter.name}
|
|
|
|
{chapter.chapter_number > 0 && ` : ${chapter.chapter_number}`}
|
2021-01-19 17:50:28 +01:00
|
|
|
</Typography>
|
|
|
|
<Typography variant="caption" display="block" gutterBottom>
|
2021-01-19 18:32:57 +01:00
|
|
|
{chapter.scanlator}
|
|
|
|
{chapter.scanlator && ' '}
|
2021-01-19 21:34:12 +01:00
|
|
|
{dateStr}
|
2021-01-19 17:50:28 +01:00
|
|
|
</Typography>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-03-23 00:20:55 +01:00
|
|
|
<Link
|
|
|
|
to={`/manga/${chapter.mangaId}/chapter/${chapter.chapterIndex}`}
|
|
|
|
style={{ textDecoration: 'none' }}
|
|
|
|
>
|
|
|
|
<Button
|
|
|
|
variant="outlined"
|
|
|
|
style={{ marginLeft: 20 }}
|
|
|
|
>
|
|
|
|
open
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
|
2021-01-19 17:50:28 +01:00
|
|
|
</CardContent>
|
|
|
|
</Card>
|
|
|
|
</li>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|