diff --git a/components/GalleryGrid.tsx b/components/GalleryGrid.tsx index 0ee1834..1a7374d 100644 --- a/components/GalleryGrid.tsx +++ b/components/GalleryGrid.tsx @@ -3,11 +3,11 @@ import Link from "next/link" import { getCacheUrl } from "../lib/api/other" import { Base64Placeholder } from "../lib/helpers" import placeholderCover from "../public/placeholder-fade.png" -import { GalleryMeta } from "../types/api" +import { GalleryMeta, OrderedMap } from "../types/api" import { LibraryLayout } from "./Filters/LayoutSelect" export interface GalleriesResult { - Data: GalleryMeta[] | Record + Data: GalleryMeta[] | OrderedMap Count: number TotalCount: number } @@ -63,19 +63,20 @@ const GalleryGrid = ({ galleries, layout, nativeTitles }: GalleryProps) => { )) } - const galleryMap = result.Data as Record - return Object.keys(galleryMap).map((k, i) => { - const g = galleryMap[k] + const galleryOrderedMap = result.Data + return galleryOrderedMap.Keys.map((k, i) => { + const g = galleryOrderedMap.Map[k] + const subGalleryCount = g.SubGalleryCount ?? 0 return (
1 ? `series/${g[0].Series}` : `g/${g[0].UUID}`} - key={g[0].UUID} + href={subGalleryCount > 0 ? `series/${g.Series}` : `g/${g.UUID}`} + key={g.UUID} className="grid place-content-center mb-3 mr-3 bg-gray-800 bg-clip-padding rounded" > cover image { blurDataURL={Base64Placeholder} /> - {g.length > 1 && ( + {subGalleryCount > 0 && (
- {g.length} + {subGalleryCount}
)}