diff --git a/frontend/src/components/NFTGrid/NFTGrid.module.css b/frontend/src/components/NFTGrid/NFTGrid.module.css index df33d9c..f12c8a4 100644 --- a/frontend/src/components/NFTGrid/NFTGrid.module.css +++ b/frontend/src/components/NFTGrid/NFTGrid.module.css @@ -31,3 +31,13 @@ border-radius: 10px; width: fit-content; } + +.noNfts { + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; + background: var(--box-bg); + padding: 20px; + font-size: 12px; +} diff --git a/frontend/src/components/NFTGrid/index.tsx b/frontend/src/components/NFTGrid/index.tsx index 53a077c..08c3868 100644 --- a/frontend/src/components/NFTGrid/index.tsx +++ b/frontend/src/components/NFTGrid/index.tsx @@ -37,6 +37,14 @@ export const AccountNftGrid: React.FC = ({ address }) => { if (isLoading) return + if (nfts.length === 0) { + return ( +
+

No NFTs found

+
+ ) + } + return ( - +
= ({ nft, chainId }) => { ))}
+ + ) } diff --git a/frontend/src/hooks/useCollection.ts b/frontend/src/hooks/useCollection.ts index d1dd6cf..840e26c 100644 --- a/frontend/src/hooks/useCollection.ts +++ b/frontend/src/hooks/useCollection.ts @@ -4,13 +4,14 @@ import { MoralisApiListResponse, MoralisNFT } from "../types/Token" interface Props { tokenAddress: string chainId: number + page?: number } if (!process.env.REACT_APP_PROXY_URL) { throw new Error("REACT_APP_PROXY_URL not set") } -const useCollection = ({ tokenAddress, chainId }: Props) => { +const useCollection = ({ tokenAddress, chainId, page = 0 }: Props) => { return useQuery({ queryKey: ["collection", chainId, tokenAddress], queryFn: async () => { diff --git a/frontend/src/hooks/useDeployMech.tsx b/frontend/src/hooks/useDeployMech.tsx index 5e92db4..b9f2ef8 100644 --- a/frontend/src/hooks/useDeployMech.tsx +++ b/frontend/src/hooks/useDeployMech.tsx @@ -81,6 +81,7 @@ export const useDeployedMechs = (nfts: NFTContext[], chainId: number) => { }, ]) .catch((e) => { + console.error(e) /* when switching networks, this might throw an error (`Missing queryFn for queryKey`) */ }) }) diff --git a/frontend/src/routes/Mech/Mech.module.css b/frontend/src/routes/Mech/Mech.module.css index feda08f..b9f8d74 100644 --- a/frontend/src/routes/Mech/Mech.module.css +++ b/frontend/src/routes/Mech/Mech.module.css @@ -3,9 +3,7 @@ align-items: flex-start; justify-content: center; gap: 50px; - width: 72%; - max-width: 2000px; - margin: 0 auto; + width: 100%; } /* @media (max-width: 800px) { diff --git a/frontend/src/utils/shortenAddress.ts b/frontend/src/utils/shortenAddress.ts index 7b3a627..090bd65 100644 --- a/frontend/src/utils/shortenAddress.ts +++ b/frontend/src/utils/shortenAddress.ts @@ -1,11 +1,11 @@ import { validateAddress } from "./addressValidation" -const VISIBLE_END = 4 -const VISIBLE_START = 4 - -export const shortenAddress = (address: string): string => { +export const shortenAddress = ( + address: string, + visibleDigits: number = 4 +): string => { const checksumAddress = validateAddress(address) - const start = checksumAddress.substring(0, VISIBLE_START + 2) - const end = checksumAddress.substring(42 - VISIBLE_END, 42) + const start = checksumAddress.substring(0, visibleDigits + 2) + const end = checksumAddress.substring(42 - visibleDigits, 42) return `${start}...${end}` }