Thread through avatarUrl all the way

This commit is contained in:
Austin Chen 2022-04-29 17:22:46 -04:00
parent 5eaf9062d4
commit 2322225472

View File

@ -6,8 +6,7 @@ export type OgCardProps = {
metadata: string metadata: string
creatorName: string creatorName: string
creatorUsername: string creatorUsername: string
// TODO: Store creator avatar url in each contract, then enable this creatorAvatarUrl: string
// creatorAvatarUrl: string
} }
function buildCardUrl(props: OgCardProps) { function buildCardUrl(props: OgCardProps) {
@ -15,6 +14,10 @@ function buildCardUrl(props: OgCardProps) {
props.probability === undefined props.probability === undefined
? '' ? ''
: `&probability=${encodeURIComponent(props.probability ?? '')}` : `&probability=${encodeURIComponent(props.probability ?? '')}`
const creatorAvatarUrlParam =
props.creatorAvatarUrl === undefined
? ''
: `&creatorAvatarUrl=${encodeURIComponent(props.creatorAvatarUrl ?? '')}`
// URL encode each of the props, then add them as query params // URL encode each of the props, then add them as query params
return ( return (
@ -23,6 +26,7 @@ function buildCardUrl(props: OgCardProps) {
probabilityParam + probabilityParam +
`&metadata=${encodeURIComponent(props.metadata)}` + `&metadata=${encodeURIComponent(props.metadata)}` +
`&creatorName=${encodeURIComponent(props.creatorName)}` + `&creatorName=${encodeURIComponent(props.creatorName)}` +
creatorAvatarUrlParam +
`&creatorUsername=${encodeURIComponent(props.creatorUsername)}` `&creatorUsername=${encodeURIComponent(props.creatorUsername)}`
) )
} }