Skip to content

Commit

Permalink
Merge pull request #177 from privacy-scaling-explorations/fix/poll-in…
Browse files Browse the repository at this point in the history
…formation

fix: poll information
  • Loading branch information
ctrlc03 authored Jun 24, 2024
2 parents 21a6e04 + 712eeea commit defe62d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ NEXT_PUBLIC_SIGN_STATEMENT="Sign in to MACI-RPGF"

# Unique identifier for your applications and lists - your app will group attestations by this id
NEXT_PUBLIC_ROUND_ID="open-rpgf-1"
# Event title for the round, just for display
NEXT_PUBLIC_ROUND_ORGANIZER="PSE"

# Name of the token you want to allocate (only updates UI)
NEXT_PUBLIC_TOKEN_NAME="Votes"
Expand All @@ -45,6 +47,7 @@ NEXT_PUBLIC_MAX_VOTES_TOTAL=150
# How many votes each project can receive
NEXT_PUBLIC_MAX_VOTES_PROJECT=50


# Voting periods
# Determine when users can register applications, admins review them, voters vote, and results are published
NEXT_PUBLIC_START_DATE=2024-01-01T00:00:00.000Z
Expand Down
7 changes: 4 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as wagmiChains from "wagmi/chains";

export const metadata = {
title: "EasyRetroPGF",
description: "Open-source Retro Public Goods Funding platform",
url: "https://easy-retro-pgf.vercel.app",
title: "MACI RPGF",
description: "Open-source Retro Public Goods Funding platform with MACI for private on chain voting/",
url: "https://maci-rpgf.vercel.app",
image: "/api/og",
};

Expand All @@ -26,6 +26,7 @@ export const config = {
maciStartBlock: Number(process.env.NEXT_PUBLIC_MACI_START_BLOCK ?? 0),
maciSubgraphUrl: process.env.NEXT_PUBLIC_MACI_SUBGRAPH_URL ?? "",
tallyUrl: process.env.NEXT_PUBLIC_TALLY_URL,
roundOrganizer: process.env.NEXT_PUBLIC_ROUND_ORGANIZER ?? "Optimism",
};

export const theme = {
Expand Down
10 changes: 6 additions & 4 deletions src/features/ballot/components/BallotConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ export const BallotConfirmation = ({ votes }: IBallotConfirmationProps): JSX.Ele
</h3>

<p className="mb-10 text-gray-700 dark:text-gray-300">
Thank you for participating in RetroPGF 3. Please help us improve the process by providing feedback on
your experience as a badgeholder!
Thank you for participating in this round. If you have 5 minutes, we&apos;d love to hear your feedback on
what we could do better to improve! Your feedback would always remain anonymous. It would, however,
greatly help us continue to iterate on the MACI-RPGF stack to keep learning and implementing improvements
to continue to build a better experience.
</p>

<Button as={Link} href={feedbackUrl} target="_blank" variant="primary">
Expand Down Expand Up @@ -67,10 +69,10 @@ export const BallotConfirmation = ({ votes }: IBallotConfirmationProps): JSX.Ele

<Card>
<div>
<h5 className="mb-3 text-2xl font-bold">Help us improve next round of RetroPGF</h5>
<h5 className="mb-3 text-2xl font-bold">Help us improve the next round of MACI RPGF</h5>

<p className="mb-6 text-gray-700 dark:text-gray-300">
Your anonymized feedback will be influential to help us iterate on Optimism&apos;s RetroPGF process.
Your anonymized feedback will be influential to help us iterate on the MACI RPGF process.
</p>

<Button as={Link} href={feedbackUrl} target="_blank" variant="primary">
Expand Down
25 changes: 12 additions & 13 deletions src/features/ballot/components/BallotOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const SubmitBallotButton = ({ disabled = false }: ISubmitBallotButtonProps): JSX
await onVote(
votes,
() => {
toast.error("Voting is failed");
toast.error("Voting failed");
},
async () => {
await router.push("/ballot/confirmation");
Expand All @@ -81,19 +81,18 @@ const SubmitBallotButton = ({ disabled = false }: ISubmitBallotButtonProps): JSX

const messages = {
signing: {
title: "Sign ballot",
instructions: "Confirm the transactions in your wallet to submit your ballot.",
title: "Sign vote",
instructions: "Confirm the transactions in your wallet to submit your vote.",
},
submitting: {
title: "Submit ballot",
instructions:
"Once you submit your ballot, you won’t be able to change it. If you are ready, go ahead and submit!",
title: "Submit vote",
instructions: "Once you submit your vote, you won’t be able to change it. If you are ready, go ahead and submit!",
},
error: {
title: "Error submitting ballot",
title: "Error submitting vote",
instructions: (
<Alert title={(submit.error as { message?: string }).message} variant="warning">
There was an error submitting the ballot.
There was an error submitting the vote.
</Alert>
),
},
Expand All @@ -105,7 +104,7 @@ const SubmitBallotButton = ({ disabled = false }: ISubmitBallotButtonProps): JSX
return (
<>
<Button className="w-full" disabled={disabled} variant="primary" onClick={handleOpen}>
Submit ballot
Submit vote
</Button>

<Dialog isOpen={isOpen} size="sm" title={title} onOpenChange={setOpen}>
Expand All @@ -121,7 +120,7 @@ const SubmitBallotButton = ({ disabled = false }: ISubmitBallotButtonProps): JSX
</Button>

<Button className="flex-1" variant="primary" onClick={() => submit.mutate()}>
Submit ballot
Submit vote
</Button>
</div>
</Dialog>
Expand Down Expand Up @@ -199,7 +198,7 @@ const BallotOverview = () => {

{address && isRegistered && (
<>
<BallotHeader>Your ballot</BallotHeader>
<BallotHeader>Your vote</BallotHeader>

<BallotSection title="Projects added:">
<div>
Expand Down Expand Up @@ -237,15 +236,15 @@ const BallotOverview = () => {
<>
{ballot?.published && (
<Button as={Link} className="w-full" href="/ballot/confirmation" variant="primary">
View submitted ballot
View submitted vote
</Button>
)}

{!ballot?.published && canSubmit && <SubmitBallotButton disabled={sum > initialVoiceCredits} />}

{!ballot?.published && !canSubmit && viewBallot ? (
<Button as={Link} className="w-full" href="/ballot" variant="primary">
View my ballot
View my vote
</Button>
) : (
<Button disabled className="w-full" variant="primary">
Expand Down
16 changes: 8 additions & 8 deletions src/features/projects/components/AddToBallot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ const ProjectAllocation = ({

<div className="space-y-2 pt-2">
<Button className="w-full" disabled={isError} type="submit" variant="primary">
{inBallot ? "Update" : "Add"} votes
{inBallot ? "Update" : "Add"} vote
</Button>

{inBallot ? (
<Button className="w-full" type="button" variant="ghost" onClick={onRemove}>
Remove from ballot
Remove from vote
</Button>
) : null}
</div>
Expand All @@ -100,6 +100,9 @@ export const ProjectAddToBallot = ({ id = "", name = "" }: IProjectAddToBallotPr
const sum = sumBallot(allocations.filter((p) => p.projectId !== id));
const numVotes = ballot?.votes.length ?? 0;

const dialogMessage = `How much ${config.tokenName} should this Project receive to fill the gap between the impact they generated for
${config.roundOrganizer} and the profit they received for generating this impact`;

const handleOpen = useCallback(() => {
setOpen(true);
}, [setOpen]);
Expand All @@ -118,7 +121,7 @@ export const ProjectAddToBallot = ({ id = "", name = "" }: IProjectAddToBallotPr

{isEligibleToVote && isRegistered ? (
<>
{ballot?.published && <Button disabled>Ballot published</Button>}
{ballot?.published && <Button disabled>Vote published</Button>}

{!ballot?.published && inBallot && (
<IconButton icon={Check} variant="primary" onClick={handleOpen}>
Expand All @@ -133,17 +136,14 @@ export const ProjectAddToBallot = ({ id = "", name = "" }: IProjectAddToBallotPr
variant="primary"
onClick={handleOpen}
>
Add to ballot
Add to vote
</Button>
)}
</>
) : null}

<Dialog isOpen={isOpen} size="sm" title={`Vote for ${name}`} onOpenChange={setOpen}>
<p className="pb-4 leading-relaxed">
How much {config.tokenName} should this Project receive to fill the gap between the impact they generated for
Optimism and the profit they received for generating this impact
</p>
<p className="pb-4 leading-relaxed">{dialogMessage}</p>

<Form
defaultValues={{ amount: inBallot?.amount }}
Expand Down
14 changes: 7 additions & 7 deletions src/pages/ballot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ const ClearBallot = () => {
setOpen(true);
}}
>
Remove all projects from ballot
Remove all projects from vote
</Button>

<Dialog isOpen={isOpen} size="sm" title="Are you sure?" onOpenChange={setOpen}>
<p className="mb-6 leading-6">This will empty your ballot and remove all the projects you have added.</p>
<p className="mb-6 leading-6">This will empty your vote and remove all the projects you have added.</p>

<div className="flex justify-end">
<Button
Expand All @@ -62,10 +62,10 @@ const ClearBallot = () => {
const EmptyBallot = () => (
<div className="flex flex-1 items-center justify-center">
<div className=" max-w-[360px] space-y-4">
<h3 className="text-center text-lg font-bold">Your ballot is empty</h3>
<h3 className="text-center text-lg font-bold">Your vote is empty</h3>

<p className="text-center text-sm text-gray-700">
Your ballot currently doesn&apos;t have any projects added. Browse through the available projects.
Your vote currently doesn&apos;t have any projects added. Browse through the available projects.
</p>

<div className="flex items-center justify-center gap-3">
Expand All @@ -92,9 +92,9 @@ const BallotAllocationForm = () => {

return (
<div>
<h1 className="mb-2 text-2xl font-bold">Review your ballot</h1>
<h1 className="mb-2 text-2xl font-bold">Review your vote</h1>

<p className="mb-6">Once you have reviewed your vote allocation, you can submit your ballot.</p>
<p className="mb-6">Once you have reviewed your votes allocation, you can submit your vote.</p>

<div className="mb-2 justify-between sm:flex">{ballot?.votes.length ? <ClearBallot /> : null}</div>

Expand All @@ -110,7 +110,7 @@ const BallotAllocationForm = () => {
</div>

<div className="flex h-16 items-center justify-between rounded-b-2xl border-t border-gray-300 px-8 py-4 text-lg font-semibold dark:border-gray-800">
<div>Total votes in ballot</div>
<div>Total votes</div>

<div className="flex items-center gap-2">
<TotalAllocation />
Expand Down

0 comments on commit defe62d

Please sign in to comment.