Skip to content

Commit

Permalink
fix: og metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
MartianGreed committed Dec 5, 2024
1 parent 12fc740 commit 38f8b6f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
52 changes: 51 additions & 1 deletion apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
import { notFound } from "next/navigation";
import { ChainId, CollectionAddresses } from "~/config/homepage";
import { ChainId, CollectionAddresses, Collections } from "~/config/homepage";
import TokenPage from "~/app/token/[contractAddress]/[tokenId]/page";
import type { Metadata } from "next";
import getCollection from "~/lib/getCollection";

Check failure on line 5 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

'getCollection' is defined but never used. Allowed unused vars must match /^_/u
import { env } from "~/env";

interface GenerateMetadataProps {
params: Promise<{ collectionAddress: string }>;
}

export async function generateMetadata({

Check failure on line 12 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

Async function 'generateMetadata' has no 'await' expression
params,
}: GenerateMetadataProps): Promise<Metadata> {
const collection = CollectionAddresses[params.collectionAddress];

Check failure on line 15 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

Unsafe assignment of an error typed value

Check failure on line 15 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

Computed name [params.collectionAddress] resolves to an `error` typed value
const collectionAddress = collection[ChainId.SN_MAIN];

Check failure on line 16 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

Unsafe assignment of an error typed value

Check failure on line 16 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

Unsafe member access [ChainId.SN_MAIN] on an `error` typed value
if (collectionAddress === CollectionAddresses[Collections.ETERNUMSEASONPASS][ChainId.SN_MAIN]) {
return {
title: `Eternum Season 0 Pass`,
description: 'Conquer the Realms',
openGraph: {
images: [
{
url: `https://market.realms.world/og/eternum-season-pass.png`,
width: 1200,
height: 630,
},
],
},
twitter: {
images: [
{
url: `https://market.realms.world/og/eternum-season-pass.png`,
width: 1200,
height: 630,
},
],
},
}
}
const platform =
env.NEXT_PUBLIC_THEME === "unframed" ? "Unframed" : "Ark Market";
const name = collection?.name ?? "Collection";

Check failure on line 43 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

Unsafe assignment of an error typed value

Check failure on line 43 in apps/arkmarket/src/app/[collectionAddress]/[tokenId]/page.tsx

View workflow job for this annotation

GitHub Actions / lint

Unsafe member access .name on an `error` typed value

return {
title: `${name} | ${platform}`,
openGraph: {
images: [
`https://ark-market-unframed.vercel.app/api/og/collection?collection_address=${collectionAddress}`,
],
},
};
}

export default function TokenPageRoute({ params }) {
const collection = CollectionAddresses[params.collectionAddress];
Expand Down
12 changes: 10 additions & 2 deletions apps/arkmarket/src/app/collection/[collectionAddress]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ export async function generateMetadata({
description: 'Conquer the Realms',
openGraph: {
images: [
`https://market.realms.world/og/eternum-season-pass.png`,
{
url: `https://market.realms.world/og/eternum-season-pass.png`,
width: 1200,
height: 630,
},
],
},
twitter: {
images: [
`https://market.realms.world/og/eternum-season-pass.png`,
{
url: `https://market.realms.world/og/eternum-season-pass.png`,
width: 1200,
height: 630,
},
],
},
}
Expand Down

0 comments on commit 38f8b6f

Please sign in to comment.