Loading...
+ return
+
@@ -48,10 +70,10 @@ export function ContentInfoPage({ params }: ContentInfoPageProps) {
-
@@ -85,7 +107,7 @@ export function ContentInfoPage({ params }: ContentInfoPageProps) {
-
+
);
}
@@ -93,7 +115,7 @@ function SimilarContentCard({
id,
}: {
id: string;
-}){
+}) {
const { data, error, isLoading } = useGalleryDocSimilar(id);
if (isLoading) {
@@ -112,9 +134,9 @@ function SimilarContentCard({
Contents with Similar Tags
- {data.map((doc) => (
-
- ))}
+ {data.map((doc) => (
+
+ ))}
)
diff --git a/packages/client/src/page/galleryPage.tsx b/packages/client/src/page/galleryPage.tsx
index ceb52d2..007b28d 100644
--- a/packages/client/src/page/galleryPage.tsx
+++ b/packages/client/src/page/galleryPage.tsx
@@ -1,6 +1,6 @@
import { useLocation, useSearch } from "wouter";
import { Button } from "@/components/ui/button.tsx";
-import { GalleryCard } from "@/components/gallery/GalleryCard.tsx";
+import { GalleryCard, GalleryCardSkeleton } from "@/components/gallery/GalleryCard.tsx";
import TagBadge from "@/components/gallery/TagBadge.tsx";
import { useSearchGalleryInfinite } from "../hook/useSearchGallery.ts";
import { Spinner } from "../components/Spinner.tsx";
@@ -35,8 +35,6 @@ export default function Gallery() {
overscan: 1,
});
-
-
const virtualItems = virtualizer.getVirtualItems();
useEffect(() => {
const lastItems = virtualItems.slice(-1);
@@ -53,19 +51,56 @@ export default function Gallery() {
virtualizer.measure();
}, [virtualizer, data]);
- if (isLoading) {
- return
Loading...
- }
- if (error) {
- return
Error: {String(error)}
- }
- if (!data) {
- return
No data
+
+ const renderContent = () => {
+ if (!data) {
+ return null;
+ }
+ const isLoadingMore = data && size > 0 && (data[size - 1] === undefined);
+ const NoResult = data.reduce((acc, x) => acc + x.data.length, 0) === 0;
+
+ if (NoResult) {
+ return
No results
+ }
+ else {
+ return
+ {// TODO: date based grouping
+ virtualItems.map((item) => {
+ const isLoaderRow = item.index === size - 1 && isLoadingMore;
+ if (isLoaderRow) {
+ return
+
+
;
+ }
+ const docs = data[item.index];
+ if (!docs) return null;
+ return
+ {docs.startCursor &&
+
Start with {docs.startCursor}
+
+ }
+ {docs?.data?.map((x) => {
+ return (
+
+ );
+ })}
+
+ })
+ }
+
+ }
}
-
- const isLoadingMore = data && size > 0 && (data[size - 1] === undefined);
- return (
+ return (
{(word || tags) &&
@@ -75,41 +110,13 @@ export default function Gallery() {
}
}
- {data?.length === 0 &&
No results
}
-
- {// TODO: date based grouping
- virtualItems.map((item) => {
- const isLoaderRow = item.index === size - 1 && isLoadingMore;
- if (isLoaderRow) {
- return
-
-
;
- }
- const docs = data[item.index];
- if (!docs) return null;
- return
- {docs.startCursor &&
-
Start with {docs.startCursor}
-
- }
- {docs?.data?.map((x) => {
- return (
-
- );
- })}
-
- })
- }
-
+ {error &&
Error: {String(error)}
}
+ {isLoading && <>
+
+
+
+ >}
+ {renderContent()}
);
}
diff --git a/packages/client/src/page/reader/comicPage.tsx b/packages/client/src/page/reader/comicPage.tsx
index 3c9b0ad..f8a6c44 100644
--- a/packages/client/src/page/reader/comicPage.tsx
+++ b/packages/client/src/page/reader/comicPage.tsx
@@ -76,7 +76,7 @@ function ComicViewer({
}, [curPage, doc.id, totalPage]);
return (
-
+
PageDown(1)} />