fix: Handling page 0 on reader with localstorage cache
This commit is contained in:
@@ -17,7 +17,8 @@ export const usePageNavigation = ({
|
|||||||
onClose,
|
onClose,
|
||||||
direction,
|
direction,
|
||||||
}: UsePageNavigationProps) => {
|
}: 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 [isLoading, setIsLoading] = useState(true);
|
||||||
const [secondPageLoading, setSecondPageLoading] = useState(true);
|
const [secondPageLoading, setSecondPageLoading] = useState(true);
|
||||||
const [zoomLevel, setZoomLevel] = useState(1);
|
const [zoomLevel, setZoomLevel] = useState(1);
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ export function BookGrid({ books, onBookClick }: BookGridProps) {
|
|||||||
key={book.id}
|
key={book.id}
|
||||||
className="group relative aspect-[2/3] overflow-hidden rounded-lg bg-muted"
|
className="group relative aspect-[2/3] overflow-hidden rounded-lg bg-muted"
|
||||||
>
|
>
|
||||||
<button
|
<div
|
||||||
onClick={() => onBookClick(book)}
|
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
|
<BookCover
|
||||||
book={book}
|
book={book}
|
||||||
@@ -76,7 +76,7 @@ export function BookGrid({ books, onBookClick }: BookGridProps) {
|
|||||||
})}
|
})}
|
||||||
onSuccess={(book, action) => handleOnSuccess(book, action)}
|
onSuccess={(book, action) => handleOnSuccess(book, action)}
|
||||||
/>
|
/>
|
||||||
</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user