diff --git a/apps/readest-app/src/app/library/components/Bookshelf.tsx b/apps/readest-app/src/app/library/components/Bookshelf.tsx index cc4192e0..49173b6a 100644 --- a/apps/readest-app/src/app/library/components/Bookshelf.tsx +++ b/apps/readest-app/src/app/library/components/Bookshelf.tsx @@ -23,6 +23,7 @@ import ModalPortal from '@/components/ModalPortal'; import BookshelfItem, { generateBookshelfItems } from './BookshelfItem'; import SelectModeActions from './SelectModeActions'; import GroupingModal from './GroupingModal'; +import SetStatusAlert from './SetStatusAlert'; interface BookshelfProps { libraryBooks: Book[]; @@ -442,88 +443,15 @@ const Bookshelf: React.FC = ({ )} {showStatusAlert && ( -
{ + setShowStatusAlert(false); + setShowSelectModeActions(true); }} - > -
-
- {_('Set status for {{count}} book(s)', { count: getSelectedBooks().length })} -
-
- - - - -
-
-
+ onUpdateStatus={updateBooksStatus} + /> )} ); diff --git a/apps/readest-app/src/app/library/components/SetStatusAlert.tsx b/apps/readest-app/src/app/library/components/SetStatusAlert.tsx new file mode 100644 index 00000000..ae9091f1 --- /dev/null +++ b/apps/readest-app/src/app/library/components/SetStatusAlert.tsx @@ -0,0 +1,107 @@ +import clsx from 'clsx'; +import * as React from 'react'; +import { PiX } from 'react-icons/pi'; +import { ReadingStatus } from '@/types/book'; +import { useTranslation } from '@/hooks/useTranslation'; +import { useKeyDownActions } from '@/hooks/useKeyDownActions'; + +interface SetStatusAlertProps { + selectedCount: number; + safeAreaBottom: number; + onCancel: () => void; + onUpdateStatus: (status: ReadingStatus | undefined) => void; +} + +const SetStatusAlert: React.FC = ({ + selectedCount, + safeAreaBottom, + onCancel, + onUpdateStatus, +}) => { + const _ = useTranslation(); + const divRef = useKeyDownActions({ onCancel }); + + const statusButtons = [ + { + label: _('Mark as Unread'), + status: 'unread' as ReadingStatus, + className: + 'bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 border-amber-500/20', + }, + { + label: _('Mark as Finished'), + status: 'finished' as ReadingStatus, + className: 'bg-success/15 text-success hover:bg-success/25 border-success/20', + }, + { + label: _('Clear Status'), + status: undefined, + className: 'bg-base-300 text-base-content hover:bg-base-content/10 border-base-content/10', + }, + ]; + + return ( +
+
+ {/* Header with close button for small screens */} +
+
+ {_('Set status for {{count}} book(s)', { count: selectedCount })} +
+ +
+
+ {statusButtons.map(({ label, status, className }) => ( + + ))} + +
+
+
+ ); +}; + +export default SetStatusAlert;