Skip to content

Commit

Permalink
Add button to mark all chapters as read
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda committed Dec 18, 2023
1 parent 5010b70 commit 953ebbe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/manga/ChapterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useTranslation } from 'react-i18next';
import Checkbox from '@mui/material/Checkbox';
import IconButton from '@mui/material/IconButton';
import DownloadIcon from '@mui/icons-material/Download';
import DoneAllIcon from '@mui/icons-material/DoneAll';
import { TChapter, TManga, TranslationKey } from '@/typings';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { ChapterCard } from '@/components/manga/ChapterCard';
Expand Down Expand Up @@ -113,6 +114,7 @@ export const ChapterList: React.FC<IProps> = ({ manga, isRefreshing }) => {
const areAllChaptersSelected = selection?.length === chapters.length;
const areNoneChaptersSelected = !selection;

const areAllChaptersRead = manga.unreadCount === 0;
const areAllChaptersDownloaded = manga.downloadCount === manga.chapters.totalCount;

const handleSelection = (index: number) => {
Expand Down Expand Up @@ -268,6 +270,14 @@ export const ChapterList: React.FC<IProps> = ({ manga, isRefreshing }) => {
</Typography>

<Stack direction="row" sx={{ paddingRight: '24px' }}>
<Tooltip title={t('chapter.action.mark_as_read.add.label.action.current')}>
<IconButton
disabled={areAllChaptersRead}
onClick={() => handleFabAction('mark_as_read', chaptersWithMeta)}
>
<DoneAllIcon />
</IconButton>
</Tooltip>
<Tooltip title={t('chapter.action.download.add.label.action')}>
<IconButton
disabled={areAllChaptersDownloaded}
Expand Down

0 comments on commit 953ebbe

Please sign in to comment.