-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from adrianvrj/feat-199
[feat] Add confirmation page
- Loading branch information
Showing
16 changed files
with
264 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Confirmation from "@/components/modules/confirmation/Confirmation"; | ||
|
||
const ConfirmationPage = async () => { | ||
return ( | ||
<> | ||
<Confirmation/> | ||
</> | ||
); | ||
}; | ||
|
||
export default ConfirmationPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
frontend/gostarkme-web/components/modules/confirmation/Confirmation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
'use client'; | ||
import React, { useEffect } from "react"; | ||
import CreationConfirmation from "./CreationConfirmation"; | ||
import VoteConfirmation from "./VoteConfirmation"; | ||
import DonationConfirmation from "./DonationConfirmation"; | ||
import { useAtom, useAtomValue } from "jotai"; | ||
import { latestTxAtom } from "@/state/latestTx"; | ||
import Navbar from "@/components/ui/Navbar"; | ||
import { navItems } from "@/constants"; | ||
import { clickedFundState } from "@/state/nFunds"; | ||
import { walletStarknetkitLatestAtom } from "@/state/connectedWallet"; | ||
|
||
const Confirmation = () => { | ||
const tx = useAtomValue(latestTxAtom); | ||
const actualFund = useAtomValue(clickedFundState); | ||
const voteMessage = ` 🗳️ Just cast my vote for an amazing cause called ${actualFund?.name} on Go Stark Me! This fund needs more votes to start raising funds—every vote counts! Let’s support projects that make a difference at https://web3wagers.github.io/gostarkme/ @web3_wagers 🙌💫 #GoStarkMe #Starknet #CommunityPower`; | ||
const donationMessage = `🙌 Proud to support ${actualFund?.name} on Go Stark Me! Donations make a difference. 💪 Go ahead and donate at https://web3wagers.github.io/gostarkme/ @web3_wagers #Starknet #GoStarkMe #Web3Wagers`; | ||
const newFundMessage = `🚀 Just launched a new fund on Go Stark Me called ${actualFund?.name}! I’m raising support for an important cause, and every contribution makes a difference. Join me in making an impact at https://web3wagers.github.io/gostarkme/! 💪🌍 Check it out on @web3_wagers #GoStarkMe #Starknet #BlockchainForGood`; | ||
|
||
return ( | ||
<> | ||
<Navbar | ||
logoSrc={process.env.NEXT_PUBLIC_APP_ROOT + "icons/starklogo.png"} | ||
logoAlt="Go Stark Me logo" | ||
title="Go Stark Me" | ||
navItems={navItems} | ||
ctaButton={{ | ||
label: "Connect wallet", | ||
href: "/" | ||
}} | ||
/> | ||
{tx === undefined && | ||
<div className="text-center text-gray-500 mt-5"> | ||
The place you are trying to reach is not enabled yet. | ||
</div> | ||
} | ||
|
||
{tx !== undefined && | ||
<div className="flex flex-col items-center justify-center gap-4 text-center mt-32"> | ||
<h1 className="text-3xl font-extrabold">Success 🚀</h1> | ||
{tx?.type === "newfund" && | ||
<CreationConfirmation message={newFundMessage} txHash={tx.txHash} /> | ||
} | ||
|
||
{tx?.type === "vote" && | ||
<VoteConfirmation message={voteMessage} txHash={tx.txHash} /> | ||
} | ||
|
||
{tx?.type === "donation" && | ||
<DonationConfirmation message={donationMessage} txHash={tx.txHash} /> | ||
} | ||
</div> | ||
} | ||
</> | ||
) | ||
}; | ||
|
||
export default Confirmation; |
22 changes: 22 additions & 0 deletions
22
frontend/gostarkme-web/components/modules/confirmation/CreationConfirmation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ShareXButton from "@/components/ui/ShareOnX"; | ||
import React from "react"; | ||
|
||
interface CreationConfirmationProps { | ||
txHash: String; | ||
message: String; | ||
} | ||
|
||
const CreationConfirmation: React.FC<CreationConfirmationProps> = ({ | ||
txHash, | ||
message, | ||
}) => ( | ||
<> | ||
<div className="flex flex-col items-center justify-center gap-4 text-center"> | ||
<p className="text-2xl font-light m-5">Your funding was created, take a look at the transaction <a className="text-blue-600" target="_blank" href={"https://sepolia.voyager.online/tx/" + txHash}>here.</a></p> | ||
<p className="text-2xl font-light m-5">Share your contribution via X to tell everyone how cool you are</p> | ||
<ShareXButton message={message} /> | ||
</div> | ||
</> | ||
); | ||
|
||
export default CreationConfirmation; |
22 changes: 22 additions & 0 deletions
22
frontend/gostarkme-web/components/modules/confirmation/DonationConfirmation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ShareXButton from "@/components/ui/ShareOnX"; | ||
import React from "react"; | ||
|
||
interface DonationConfirmationProps { | ||
txHash: String; | ||
message: String; | ||
} | ||
|
||
const DonationConfirmation: React.FC<DonationConfirmationProps> = ({ | ||
txHash, | ||
message, | ||
}) => ( | ||
<> | ||
<div className="flex flex-col items-center justify-center gap-4 text-center"> | ||
<p className="text-2xl font-light m-5">Your donation was sent to the funding, take a look at the transaction <a className="text-blue-600" target="_blank" href={"https://sepolia.voyager.online/tx/" + txHash}>here.</a></p> | ||
<p className="text-2xl font-light m-5">Share your contribution via X to tell everyone how cool you are</p> | ||
<ShareXButton message={message} /> | ||
</div> | ||
</> | ||
); | ||
|
||
export default DonationConfirmation; |
22 changes: 22 additions & 0 deletions
22
frontend/gostarkme-web/components/modules/confirmation/VoteConfirmation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ShareXButton from "@/components/ui/ShareOnX"; | ||
import React from "react"; | ||
|
||
interface VoteConfirmationProps { | ||
txHash: String; | ||
message: String; | ||
} | ||
|
||
const VoteConfirmation: React.FC<VoteConfirmationProps> = ({ | ||
txHash, | ||
message, | ||
}) => ( | ||
<> | ||
<div className="flex flex-col items-center justify-center gap-4 text-center"> | ||
<p className="text-2xl font-light m-5">Your vote was submitted, take a look at the transaction <a className="text-blue-600" target="_blank" href={"https://sepolia.voyager.online/tx/" + txHash}>here.</a></p> | ||
<p className="text-2xl font-light m-5">Share your contribution via X to tell everyone how cool you are</p> | ||
<ShareXButton message={message} /> | ||
</div> | ||
</> | ||
); | ||
|
||
export default VoteConfirmation; |
Oops, something went wrong.