Skip to content

Commit

Permalink
Merge branch 'armando/grwth-4132-add-frame-tags-to-collections-page' …
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
r3lays committed Feb 23, 2024
2 parents b7a374a + 0f097c0 commit 1bb349e
Showing 1 changed file with 39 additions and 10 deletions.
49 changes: 39 additions & 10 deletions pages/[chain]/asset/[assetId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,22 @@ const IndexPage: NextPage<Props> = ({ assetId, ssr }) => {

const base64EncodedToken = btoa(encodeURIComponent(JSON.stringify(token)))

const mintData = collection?.mintStages?.find(
(stage) => stage.kind === 'public'
)

const mintPriceDecimal = mintData?.price?.amount?.decimal
const mintCurrency = mintData?.price?.currency?.symbol?.toUpperCase()

const mintPrice =
typeof mintPriceDecimal === 'number' &&
mintPriceDecimal !== null &&
mintPriceDecimal !== undefined
? mintPriceDecimal === 0
? 'Free'
: `${mintPriceDecimal} ${mintCurrency}`
: undefined

return (
<Layout>
<Head
Expand All @@ -238,16 +254,23 @@ const IndexPage: NextPage<Props> = ({ assetId, ssr }) => {
description={collection?.description as string}
metatags={
<>
<meta
property="og:title"
content={`Farcaster: ${token?.token?.name}`}
/>
<meta property="fc:frame:button:1" content="Mint" />
<meta property="fc:frame:button:1:action" content="mint" />
<meta
property="fc:frame:button:1:target"
content={`eip155:${token?.token?.chainId}:${token?.token?.contract}:${token?.token?.tokenId}`}
/>
{collection?.isMinting && (
<>
<meta
property="og:title"
content={`Farcaster: ${token?.token?.name}`}
/>
<meta
property="fc:frame:button:1"
content={`Mint ${mintPrice}`}
/>
<meta property="fc:frame:button:1:action" content="mint" />
<meta
property="fc:frame:button:1:target"
content={`eip155:${token?.token?.chainId}:${token?.token?.contract}:${token?.token?.tokenId}`}
/>
</>
)}

{token?.market?.floorAsk?.price?.amount?.native && (
<>
Expand All @@ -264,6 +287,12 @@ const IndexPage: NextPage<Props> = ({ assetId, ssr }) => {
/>
</>
)}
<meta
name="twitter:image"
content={`/api/og/token?token=${encodeURIComponent(
base64EncodedToken
)}`}
/>
</>
}
/>
Expand Down

0 comments on commit 1bb349e

Please sign in to comment.