diff --git a/packages/grant-explorer/src/features/common/ShareButtons.tsx b/packages/grant-explorer/src/features/common/ShareButtons.tsx index e035ecf8f..41a086725 100755 --- a/packages/grant-explorer/src/features/common/ShareButtons.tsx +++ b/packages/grant-explorer/src/features/common/ShareButtons.tsx @@ -13,7 +13,10 @@ export const ShareButtons = ({ }): JSX.Element => { const twitterShareUrl = createTwitterAttestationShareUrl(attestationLink); - const farcasterShareUrl = createFarcasterShareUrl(attestationLink); + const farcasterShareText = getFarcasterAttestationShareText(); + const farcasterShareUrl = createFarcasterShareUrl(farcasterShareText, [ + attestationLink, + ]); return (
@@ -78,13 +81,21 @@ export function createTwitterAttestationShareUrl(attestationLink: string) { )}`; } -export function createFarcasterAttestationShareText(attestationLink: string) { - return `Certified public goods supporter 🫡\n\nMy contribution is now onchain—check out the visual that represents my impact.\n\nHat tip to @gitcoin 💚\n\n&embeds[${attestationLink}]=https://farcaster.xyz"}`; +export function getFarcasterAttestationShareText() { + const encodedText1 = encodeURIComponent( + `Certified public goods supporter 🫡\n\nMy contribution is now onchain—check out the visual that represents my impact.\n\nHat tip to ` + ); + const encodedText2 = encodeURIComponent(` 💚\n`); + // NB: mentions should not be encoded + return `${encodedText1}@gitcoin${encodedText2}`; } -export function createFarcasterShareUrl(attestationLink: string) { - const shareText = createFarcasterAttestationShareText(attestationLink); - return `https://warpcast.com/~/compose?text=${encodeURIComponent(shareText)}`; +export function createFarcasterShareUrl( + shareText: string, + embedLinks: string[] +) { + // NB: embed links should not be encoded + return `https://warpcast.com/~/compose?text=${shareText}${embedLinks.forEach((link) => `&embeds[]=${link}`)}`; } type TwitterButtonParams = { diff --git a/packages/grant-explorer/src/features/round/ViewRoundPage.tsx b/packages/grant-explorer/src/features/round/ViewRoundPage.tsx index 63fa4c14c..9a16e51ca 100644 --- a/packages/grant-explorer/src/features/round/ViewRoundPage.tsx +++ b/packages/grant-explorer/src/features/round/ViewRoundPage.tsx @@ -69,6 +69,7 @@ import { Box, Tab, Tabs } from "@chakra-ui/react"; import GenericModal from "../common/GenericModal"; import RoundStartCountdownBadge from "./RoundStartCountdownBadge"; import ApplicationsCountdownBanner from "./ApplicationsCountdownBanner"; +import { createFarcasterShareUrl } from "../common/ShareButtons"; export default function ViewRound() { datadogLogs.logger.info("====> Route: /round/:chainId/:roundId"); @@ -1164,15 +1165,15 @@ const ShareButton = ({ 📈 $${formatAmount(totalUSDCrowdfunded.toFixed(2))} funded so far 🤝 ${formatAmount(totalDonations, true)} donations 👀 Check out ${roundName}’s stats! -${window.location.href}`; +`; const twitterShareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent( - shareText + shareText + window.location.href )}`; - const farcasterShareUrl = `https://warpcast.com/~/compose?text=${encodeURIComponent( - shareText - )}`; + const farcasterShareUrl = createFarcasterShareUrl(shareText, [ + window.location.href, + ]); return ( <>