fix: Handling page 0 on reader with localstorage cache

This commit is contained in:
Julien Froidefond
2025-03-02 07:24:18 +01:00
parent 2e9b191f98
commit c0a13abf4a
2 changed files with 5 additions and 4 deletions

View File

@@ -17,7 +17,8 @@ export const usePageNavigation = ({
onClose,
direction,
}: UsePageNavigationProps) => {
const [currentPage, setCurrentPage] = useState(ClientOfflineBookService.getCurrentPage(book));
const cPage = ClientOfflineBookService.getCurrentPage(book);
const [currentPage, setCurrentPage] = useState(cPage < 1 ? 1 : cPage);
const [isLoading, setIsLoading] = useState(true);
const [secondPageLoading, setSecondPageLoading] = useState(true);
const [zoomLevel, setZoomLevel] = useState(1);

View File

@@ -65,9 +65,9 @@ export function BookGrid({ books, onBookClick }: BookGridProps) {
key={book.id}
className="group relative aspect-[2/3] overflow-hidden rounded-lg bg-muted"
>
<button
<div
onClick={() => onBookClick(book)}
className="w-full h-full hover:opacity-100 transition-all"
className="w-full h-full hover:opacity-100 transition-all cursor-pointer"
>
<BookCover
book={book}
@@ -76,7 +76,7 @@ export function BookGrid({ books, onBookClick }: BookGridProps) {
})}
onSuccess={(book, action) => handleOnSuccess(book, action)}
/>
</button>
</div>
</div>
);
})}