|
1 | 1 | import { notFound } from "next/navigation";
|
2 |
| -import { ChainId, CollectionAddresses } from "~/config/homepage"; |
| 2 | +import { ChainId, CollectionAddresses, Collections } from "~/config/homepage"; |
3 | 3 | import TokenPage from "~/app/token/[contractAddress]/[tokenId]/page";
|
| 4 | +import type { Metadata } from "next"; |
| 5 | +import getCollection from "~/lib/getCollection"; |
| 6 | +import { env } from "~/env"; |
| 7 | + |
| 8 | +interface GenerateMetadataProps { |
| 9 | + params: Promise<{ collectionAddress: string }>; |
| 10 | +} |
| 11 | + |
| 12 | +export async function generateMetadata({ |
| 13 | + params, |
| 14 | +}: GenerateMetadataProps): Promise<Metadata> { |
| 15 | + const collection = CollectionAddresses[params.collectionAddress]; |
| 16 | + const collectionAddress = collection[ChainId.SN_MAIN]; |
| 17 | + if (collectionAddress === CollectionAddresses[Collections.ETERNUMSEASONPASS][ChainId.SN_MAIN]) { |
| 18 | + return { |
| 19 | + title: `Eternum Season 0 Pass`, |
| 20 | + description: 'Conquer the Realms', |
| 21 | + openGraph: { |
| 22 | + images: [ |
| 23 | + { |
| 24 | + url: `https://market.realms.world/og/eternum-season-pass.png`, |
| 25 | + width: 1200, |
| 26 | + height: 630, |
| 27 | + }, |
| 28 | + ], |
| 29 | + }, |
| 30 | + twitter: { |
| 31 | + images: [ |
| 32 | + { |
| 33 | + url: `https://market.realms.world/og/eternum-season-pass.png`, |
| 34 | + width: 1200, |
| 35 | + height: 630, |
| 36 | + }, |
| 37 | + ], |
| 38 | + }, |
| 39 | + } |
| 40 | + } |
| 41 | + const platform = |
| 42 | + env.NEXT_PUBLIC_THEME === "unframed" ? "Unframed" : "Ark Market"; |
| 43 | + const name = collection?.name ?? "Collection"; |
| 44 | + |
| 45 | + return { |
| 46 | + title: `${name} | ${platform}`, |
| 47 | + openGraph: { |
| 48 | + images: [ |
| 49 | + `https://ark-market-unframed.vercel.app/api/og/collection?collection_address=${collectionAddress}`, |
| 50 | + ], |
| 51 | + }, |
| 52 | + }; |
| 53 | +} |
4 | 54 |
|
5 | 55 | export default function TokenPageRoute({ params }) {
|
6 | 56 | const collection = CollectionAddresses[params.collectionAddress];
|
|
0 commit comments