From fde33a24122a4b77d917ff5288cd347bf77bab1d Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 20 May 2025 23:30:19 +0200 Subject: [PATCH] Hide chapter list action menu during active selection Handling changing filters during selection is too cumbersome --- .../chapter/components/ChapterList.tsx | 57 +++-------------- .../components/ChaptersToolbarMenu.tsx | 61 ++++++++++++++++++- 2 files changed, 69 insertions(+), 49 deletions(-) diff --git a/src/modules/chapter/components/ChapterList.tsx b/src/modules/chapter/components/ChapterList.tsx index a7b602a9..a75b05c6 100644 --- a/src/modules/chapter/components/ChapterList.tsx +++ b/src/modules/chapter/components/ChapterList.tsx @@ -13,12 +13,6 @@ import Typography from '@mui/material/Typography'; import { ComponentProps, useCallback, useMemo, useState } from 'react'; import { Virtuoso } from 'react-virtuoso'; import { useTranslation } from 'react-i18next'; -import IconButton from '@mui/material/IconButton'; -import DownloadIcon from '@mui/icons-material/Download'; -import DoneAllIcon from '@mui/icons-material/DoneAll'; -import PopupState, { bindMenu, bindTrigger } from 'material-ui-popup-state'; -import Menu from '@mui/material/Menu'; -import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { ChapterCard } from '@/modules/chapter/components/cards/ChapterCard.tsx'; import { ResumeFab } from '@/modules/manga/components/ResumeFAB.tsx'; @@ -41,7 +35,6 @@ import { useSelectableCollection } from '@/modules/collection/hooks/useSelectabl import { SelectableCollectionSelectAll } from '@/modules/collection/components/SelectableCollectionSelectAll.tsx'; import { Chapters } from '@/modules/chapter/services/Chapters.ts'; import { ChapterActionMenuItems } from '@/modules/chapter/components/actions/ChapterActionMenuItems.tsx'; -import { ChaptersDownloadActionMenuItems } from '@/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { LoadingPlaceholder } from '@/modules/core/components/feedback/LoadingPlaceholder.tsx'; import { GET_CHAPTERS_MANGA } from '@/lib/graphql/queries/ChapterQuery.ts'; @@ -191,46 +184,16 @@ export const ChapterList = ({ - - Chapters.markAsRead(Chapters.getNonRead(chapters), true, manga.id)} - color="inherit" - > - - - - - {(popupState) => ( - <> - - - - - - {popupState.isOpen && ( - - - - )} - - )} - - - + {areNoItemsSelected && ( + + )} ; + unreadChapters: (ChapterIdInfo & ChapterDownloadInfo & ChapterBookmarkInfo)[]; } -export const ChaptersToolbarMenu = ({ options, updateOption }: IProps) => { +export const ChaptersToolbarMenu = ({ + mangaId, + areAllChaptersRead, + areAllChaptersDownloaded, + options, + updateOption, + unreadChapters, +}: IProps) => { const { t } = useTranslation(); const [open, setOpen] = React.useState(false); @@ -28,6 +50,41 @@ export const ChaptersToolbarMenu = ({ options, updateOption }: IProps) => { return ( <> + + Chapters.markAsRead(unreadChapters, true, mangaId)} + color="inherit" + > + + + + + {(popupState) => ( + <> + + + + + + {popupState.isOpen && ( + + + + )} + + )} + setOpen(true)} color="inherit">