Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add share sns cta #558

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { format } from "date-fns";
import Link from "next/link";
import { useMemo } from "react";
import { FaXTwitter, FaThreads } from "react-icons/fa6";
import { SiFarcaster } from "react-icons/si";
import { tv } from "tailwind-variants";
import { Hex } from "viem";
import { useAccount } from "wagmi";
Expand All @@ -26,7 +28,16 @@ const feedbackUrl = process.env.NEXT_PUBLIC_FEEDBACK_URL!;
const Card = createComponent(
"div",
tv({
base: "rounded-lg border border-blue-400 p-8 bg-blue-50 flex justify-between items-center gap-8 my-14",
base: "rounded-lg border p-8 justify-between items-center gap-8 my-14",
variants: {
variant: {
default: "border-blue-400 bg-blue-50 flex",
invert: "text-blue-700 bg-blue-400 border-blue-700",
},
},
defaultVariants: {
variant: "default",
},
}),
);

Expand Down Expand Up @@ -56,6 +67,8 @@ export const BallotConfirmation = ({ pollId }: IBallotConfirmationProps): JSX.El

const sum = useMemo(() => formatNumber(sumBallot(ballot.votes)), [ballot, sumBallot]);

const shareText = useMemo(() => `I+successfully+submit+my+vote+in+${round?.roundId}+round.`, [round]);

return (
<div className="flex w-full justify-center dark:text-white">
<section className="md:max-w-screen-sm lg:max-w-screen-md xl:max-w-screen-lg">
Expand Down Expand Up @@ -100,12 +113,60 @@ export const BallotConfirmation = ({ pollId }: IBallotConfirmationProps): JSX.El

<Notice
content={
round?.votingEndsAt ? format(round.votingEndsAt, "d MMM yyyy hh:mm") : "The date would be announced soon."
round?.votingEndsAt
? `Results will be available after tallying - ${format(round.votingEndsAt, "d MMM yyyy hh:mm")}`
: "The date will be announced soon."
}
title="Results will be available after tallying."
variant="block"
/>

<Card variant="invert">
<div className="text-center">
<b className="text-2xl uppercase">Share that you have voted in {round?.roundId} round.</b>
ctrlc03 marked this conversation as resolved.
Show resolved Hide resolved
</div>

<div className="mt-2 flex w-full flex-col items-center justify-center gap-2 sm:flex-row sm:gap-4">
<Button
as={Link}
href={`https://x.com/intent/tweet?text=${shareText}`}
size="auto"
target="_blank"
variant="tertiary"
>
<FaXTwitter />

<span className="ml-2">Twitter</span>
</Button>

<p>OR</p>

<Button
as={Link}
href={`https://www.threads.net/intent/post?text=${shareText}`}
size="auto"
target="_blank"
variant="tertiary"
>
<FaThreads />

<span className="ml-2">Threads</span>
</Button>

<p>OR</p>

<Button
as={Link}
href={`https://warpcast.com/~/compose?text=${shareText}`}
size="auto"
target="_blank"
variant="tertiary"
>
<SiFarcaster />

<span className="ml-2">Farcaster</span>
</Button>
</div>
</Card>

{roundState === ERoundState.VOTING && (
<Card className="flex-col sm:flex-row">
<div className="flex-3 flex flex-col gap-4">
Expand Down
Loading