|
1 | 1 | import fs from "fs/promises"; |
2 | 2 | import path from "path"; |
3 | | -import { useEffect, useState, useMemo, useCallback, Suspense } from "react"; |
| 3 | +import { useEffect, useState, useMemo, useCallback } from "react"; |
4 | 4 | import { useRouter } from "next/router"; |
5 | 5 | import Head from "next/head"; |
6 | 6 | import Link from "next/link"; |
| 7 | +import dynamic from "next/dynamic"; |
7 | 8 | import { Filter, Grid, List } from "lucide-react"; |
8 | 9 | import Breadcrumb from "@/components/Navigation/Breadcrumb"; |
9 | 10 | import CardFilter from "@/components/Yugioh/CardFilter"; |
10 | 11 | import FilterPanel from "@/components/Yugioh/FilterPanel"; |
11 | 12 | import YugiohSearchBar from "@/components/Yugioh/YugiohSearchBar"; |
12 | | -import YugiohCardDataTable from "@/components/Yugioh/YugiohCardDataTable"; |
13 | 13 | import YugiohPagination from "@/components/Yugioh/YugiohPagination"; |
14 | 14 | import Notification from "@/components/Notification"; |
15 | 15 | import { fetchCardData as fetchAllCardData } from "@/utils/api"; |
16 | 16 | import { SpeedInsights } from "@vercel/speed-insights/next"; |
17 | 17 | import { buildCollectionKey, buildCollectionMap } from "@/utils/collectionUtils.js"; |
18 | 18 | import { readAuthStateFromCookie, subscribeToAuthState, dispatchAuthStateChange } from "@/utils/authState"; |
19 | 19 |
|
| 20 | +const YugiohCardDataTable = dynamic( |
| 21 | + () => import( "@/components/Yugioh/YugiohCardDataTable" ), |
| 22 | + { |
| 23 | + ssr: false, |
| 24 | + loading: () => ( |
| 25 | + <div className="py-10 text-center text-white/70">Loading...</div> |
| 26 | + ), |
| 27 | + } |
| 28 | +); |
| 29 | + |
20 | 30 | const CARD_SETS_FILE_PATH = path.join( |
21 | 31 | process.cwd(), |
22 | 32 | "public", |
@@ -1526,7 +1536,7 @@ const CardsInSetPage = ( { initialSetName = "", setNameId = null, letter = "" } |
1526 | 1536 | const activeVariant = cardItem.activeVariant || null; |
1527 | 1537 | const overlayLabel = activeVariant ? buildVariantLabel( activeVariant ) : currentRarityLabel; |
1528 | 1538 | const cardContainerClasses = [ |
1529 | | - "relative min-h-[24rem] w-full max-w-[350px] mx-auto object-cover overflow-hidden rounded-xl border border-white/10 bg-black/40 shadow-lg transition duration-200 group-hover:border-indigo-400/60 dark:border-white/20 dark:bg-gray-900/60", |
| 1539 | + "relative min-h-[24rem] w-full max-w-[350px] mx-auto object-cover overflow-hidden rounded-sm border border-white/10 bg-black/40 shadow-lg transition duration-200 group-hover:border-indigo-400/60 dark:border-white/20 dark:bg-gray-900/60", |
1530 | 1540 | isSelected ? "ring-2 ring-indigo-400/70" : "", |
1531 | 1541 | ].filter( Boolean ).join( " " ); |
1532 | 1542 | const isFlipped = Boolean( flippedGridCards[ selectionKey ] ); |
@@ -1613,7 +1623,7 @@ const CardsInSetPage = ( { initialSetName = "", setNameId = null, letter = "" } |
1613 | 1623 | <div className="size-full max-w-fit mx-auto -inset-1"> |
1614 | 1624 | { hasImage ? ( |
1615 | 1625 | <img |
1616 | | - className="object-scale-down sm:object-cover object-center w-full mx-auto aspect-square h-full" |
| 1626 | + className="object-scale-down sm:object-cover object-center w-full mx-auto aspect-1 h-full" |
1617 | 1627 | src={ imageSrc } |
1618 | 1628 | alt={ `Card Image - ${ cardItem.productName }` } |
1619 | 1629 | loading="lazy" |
@@ -2065,17 +2075,15 @@ const CardsInSetPage = ( { initialSetName = "", setNameId = null, letter = "" } |
2065 | 2075 | </> |
2066 | 2076 | ) : ( |
2067 | 2077 | <div className="overflow-hidden rounded-sm border border-white/10 bg-black/40 p-4 shadow-2xl"> |
2068 | | - <Suspense fallback={ <div className="py-10 text-center text-white/70">Loading...</div> }> |
2069 | | - <YugiohCardDataTable |
2070 | | - matchedCardData={ matchedCardData } |
2071 | | - selectedRowIds={ selectedRowIds } |
2072 | | - setSelectedRowIds={ setSelectedRowIds } |
2073 | | - collectionMap={ collectionLookup } |
2074 | | - onRarityChange={ handleRarityOverrideChange } |
2075 | | - autoRarityOptionValue={ AUTO_RARITY_OPTION } |
2076 | | - isAuthenticated={ isAuthenticated } |
2077 | | - /> |
2078 | | - </Suspense> |
| 2078 | + <YugiohCardDataTable |
| 2079 | + matchedCardData={ matchedCardData } |
| 2080 | + selectedRowIds={ selectedRowIds } |
| 2081 | + setSelectedRowIds={ setSelectedRowIds } |
| 2082 | + collectionMap={ collectionLookup } |
| 2083 | + onRarityChange={ handleRarityOverrideChange } |
| 2084 | + autoRarityOptionValue={ AUTO_RARITY_OPTION } |
| 2085 | + isAuthenticated={ isAuthenticated } |
| 2086 | + /> |
2079 | 2087 | </div> |
2080 | 2088 | ) } |
2081 | 2089 | { isAuthenticated && |
|
0 commit comments