From bf270fa01cd3c9aa140ac92071b4f62adfa8d3f5 Mon Sep 17 00:00:00 2001 From: Arpit Srivastava Date: Fri, 11 Aug 2023 08:08:54 +0530 Subject: [PATCH] feat: modify share content Signed-off-by: Arpit Srivastava --- src/components/Share/Share.tsx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/Share/Share.tsx b/src/components/Share/Share.tsx index 80691739..ed37d7b6 100644 --- a/src/components/Share/Share.tsx +++ b/src/components/Share/Share.tsx @@ -1,10 +1,14 @@ -import { FC } from 'react' +import { FC, useMemo } from 'react' import Link from 'next/link' +import { Address } from 'wagmi' import { TwitterIcon } from '@/components/icons/Twitter' import { useMintDialogContext } from '@/components/MintDialog/Context/useMintDialogContext' +import { website } from '@/config/website' import { WarpCast } from '@/components/icons/Warpcast' import { Lens } from '@/components/icons/Lens' +import { useEns } from '@/utils/useEns' +import { schedule } from "@/config/schedule"; const twitterURL: string = 'https://twitter.com/intent/tweet' const warpCastURL: string = 'https://warpcast.com' @@ -12,14 +16,17 @@ const lensURL: string = 'https://lenster.xyz' type ShareComponentProps = {} export const Share: FC = () => { - const { dropName } = useMintDialogContext() - const { - location: { href }, - } = window + const { dropName, partnerName, creatorAddress } = useMintDialogContext() + const { name } = useEns(creatorAddress as Address) + const partnerSlug = useMemo(() => { + return Object.values(schedule).find((partner) => partner.name === partnerName)?.slug + }, [partnerName]) + + const href = `${website.url}/${partnerSlug ?? ''}` const shareText = { - twitter: `I just minted ${dropName}, celebrating the start of @BuildOnBase bringing billions of people onchain.%0a%0aIt’s Onchain Summer.`, - lens: `I just minted ${dropName}, celebrating the start of @BuildOnBase bringing billions of people onchain.%0a%0aIt’s Onchain Summer.`, - warpCast: `I just minted ${dropName}, celebrating the start of @base bringing billions of people onchain.%0a%0aIt’s Onchain Summer.`, + twitter: `I just minted ${dropName} by ${name}, celebrating Onchain Summer with ${partnerName} on @BuildOnBase.`, + lens: `I just minted ${dropName} by ${name}, celebrating Onchain Summer with ${partnerName} on @base.`, + warpCast: `I just minted ${dropName} by ${name}, celebrating Onchain Summer with ${partnerName} on @base.`, } const tweetUrl = `${twitterURL}?url=${href}&text=${shareText['twitter']}`