From adb50c9ac3f0071b273d03e67afff912e5c046d7 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:05:02 +0530 Subject: [PATCH] Added election tokens, Removed whistleblower banner (#227) --- src/App.js | 3 +- src/components/common/ProgressTracker.jsx | 43 +------- src/components/common/TokensGrid.jsx | 30 ++++++ .../fractalVerification/SuccessPage.jsx | 100 +----------------- src/pages/CommunitySBT.jsx | 22 ++++ src/pages/auth/Home.jsx | 18 +++- src/redux/reducer/sbtsReducer.js | 20 +++- src/utils/constants.js | 6 ++ 8 files changed, 98 insertions(+), 144 deletions(-) diff --git a/src/App.js b/src/App.js index a98a838..965785f 100644 --- a/src/App.js +++ b/src/App.js @@ -17,7 +17,8 @@ import { updateUserLogin } from './redux/reducer/commonReducer'; const Wrapper = ({ children }) => { return ( <> - + {/* commenting for right now -> IAH FV minting is at hault */} + {/* */} {children} diff --git a/src/components/common/ProgressTracker.jsx b/src/components/common/ProgressTracker.jsx index 09abd84..7519b54 100644 --- a/src/components/common/ProgressTracker.jsx +++ b/src/components/common/ProgressTracker.jsx @@ -9,7 +9,6 @@ const ProgressTracker = () => { const ProgressMeterMax = process.env.REACT_APP_PROGRESS_METER_MAX ?? 3000; const [humansRegistered, setHumansRegistered] = useState(0); const { showTracker } = useSelector((state) => state[ReducerNames.PROGRESS]); - const { fvToken } = useSelector((state) => state[ReducerNames.SBT]); const fetchHumansRegistered = async () => { try { @@ -60,7 +59,7 @@ const ProgressTracker = () => { return (
<> - {/*
+
{ }} >

- JOIN {humansRegistered} HUMANS TO REACH {ReadableNumber} VOTERS - + JOIN {humansRegistered} HUMANS TO REACH {ReadableNumber} HUMANS

-
*/} -
- {fvToken ? ( -
-

- Learn about how to protect integrity of the election and how - to submit to the Whistleblower Bounty Program -

- -
- ) : ( -
-

- JOIN THE HUMANS OF NEAR -

-

- Unlock Elections, Governance, & Community Treasury with{' '} - {ReadableNumber} Humans on NEAR -

- -
- )}
diff --git a/src/components/common/TokensGrid.jsx b/src/components/common/TokensGrid.jsx index fd335ae..a829c1e 100644 --- a/src/components/common/TokensGrid.jsx +++ b/src/components/common/TokensGrid.jsx @@ -15,6 +15,9 @@ const TokensGrid = () => { gwgCoreContributor, modToken, iVotedToken, + coaToken, + homToken, + tcToken, } = useSelector((state) => state[ReducerNames.SBT]); return ( @@ -118,6 +121,33 @@ const TokensGrid = () => { )} + {coaToken && ( + + +

+ My Council of Advisor Soul Bound Token +

+ +
+ )} + {homToken && ( + + +

+ My House of Merit Soul Bound Token +

+ +
+ )} + {tcToken && ( + + +

+ My Transparency Commission Soul Bound Token +

+ +
+ )}
); }; diff --git a/src/components/fractalVerification/SuccessPage.jsx b/src/components/fractalVerification/SuccessPage.jsx index d2663c9..df831ff 100644 --- a/src/components/fractalVerification/SuccessPage.jsx +++ b/src/components/fractalVerification/SuccessPage.jsx @@ -1,111 +1,15 @@ -import React, { Fragment, useRef, useState } from 'react'; +import React from 'react'; import { CircleWavyCheck } from '../../images/CircleWavyCheck'; import TokensGrid from '../common/TokensGrid'; -import { OutlineButton, PrimaryButton } from '../common/Buttons'; -import { ImageSrc, Links } from '../../utils/constants'; -import { Dialog, Transition } from '@headlessui/react'; import { useDispatch } from 'react-redux'; import { updateShowConfetti } from '../../redux/reducer/commonReducer'; -import { Link } from '../common/Link'; export const SuccesVerification = () => { - const [showModal, setShowModal] = useState(true); const dispatch = useDispatch(); - - function removeModal() { - setShowModal(false); - dispatch(updateShowConfetti(true)); - } - - const cancelButtonRef = useRef(null); + dispatch(updateShowConfetti(true)); return (
- - - -
- - -
-
- - -
- -

- Before you vote in the general election, learn about the - Whistleblower Bounty Program. -

-

- The{' '} - - Whistleblower bounty program - {' '} - offers up to 2,500 NEAR for whistleblowers who come - forward to share instances of vote buying, account buying, - election fraud, and other violations of the{' '} - - Fair voting policy. - -
-
- Please make sure to read and understand the{' '} - - Fair voting policy - - , which outlines the responsibilities of each voter. -

-
- - Cancel - - -

- I understand my responsibilities as a voter -

-
-
-
-
-
-
-
-
-
diff --git a/src/pages/CommunitySBT.jsx b/src/pages/CommunitySBT.jsx index aa4ba55..cd8deb2 100644 --- a/src/pages/CommunitySBT.jsx +++ b/src/pages/CommunitySBT.jsx @@ -126,6 +126,28 @@ const CommunitySBTPage = () => { isAvailable={true} onClick={() => window.open(Links.ELECTIONS, '_blank')} /> + + + + { fetchVibeToken(); fetchKudosToken(); fetchModsToken(); - fetchIVotedToken(); + fetchElectionsToken(); } }, [activePageIndex]); @@ -116,7 +116,7 @@ const Home = () => { } }; - const fetchIVotedToken = async () => { + const fetchElectionsToken = async () => { try { const data = await wallet.viewMethod({ contractId: app_contract, @@ -133,10 +133,22 @@ const Home = () => { if (token.metadata.class === 1) { dispatch(updateTokens({ type: TokenTypes.I_VOTED, value: token })); } + // class2=HoM + if (token.metadata.class === 2) { + dispatch(updateTokens({ type: TokenTypes.HoM, value: token })); + } + // class3=CoA + if (token.metadata.class === 3) { + dispatch(updateTokens({ type: TokenTypes.CoA, value: token })); + } + // class4=TC + if (token.metadata.class === 4) { + dispatch(updateTokens({ type: TokenTypes.TC, value: token })); + } } } } catch (error) { - toast.error('An error occured while fetching I Voted SBT details'); + toast.error('An error occured while fetching election token details'); } }; diff --git a/src/redux/reducer/sbtsReducer.js b/src/redux/reducer/sbtsReducer.js index 5a1f49c..89c3052 100644 --- a/src/redux/reducer/sbtsReducer.js +++ b/src/redux/reducer/sbtsReducer.js @@ -60,6 +60,9 @@ export const sbtReducer = createSlice({ gwgCoreContributor: null, modToken: null, iVotedToken: null, + coaToken: null, + homToken: null, + tcToken: null, }, reducers: { updateTokens: (state, action) => { @@ -98,6 +101,15 @@ export const sbtReducer = createSlice({ case TokenTypes.I_VOTED: state.iVotedToken = value; break; + case TokenTypes.CoA: + state.coaToken = value; + break; + case TokenTypes.HoM: + state.homToken = value; + break; + case TokenTypes.TC: + state.tcToken = value; + break; default: break; } @@ -112,7 +124,10 @@ export const sbtReducer = createSlice({ state.ndcContributor || state.gwgCoreContributor || state.modToken || - state.iVotedToken; + state.iVotedToken || + state.coaToken || + state.homToken || + state.tcToken; }, handleErrorMessage: (state, action) => { state.error = action.payload; @@ -130,6 +145,9 @@ export const sbtReducer = createSlice({ state.ndcContributor = null; state.modToken = null; state.iVotedToken = null; + state.tcToken = null; + state.coaToken = null; + state.homToken = null; }, updateTokenRemoveStatus: (state, action) => { state.tokenRemoveSuccess = !state.tokenRemoveSuccess; diff --git a/src/utils/constants.js b/src/utils/constants.js index 2da3337..706e1b5 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -35,6 +35,9 @@ export const TokenTypes = { GWG__Core_Contributor: 'GWG Core Contributor', MOD: 'Mod', I_VOTED: 'I Voted', + CoA: 'CoA', + HoM: 'HoM', + TC: 'TC', }; export const ReducerNames = { @@ -114,6 +117,9 @@ export const ImageSrc = { 'https://bafkreidrd4ci3p23e7zttaq5ukpzeddyzvfdm37x3xomju3rgeq77f2dba.ipfs.nftstorage.link/', Astra: 'https://bafkreig2uojfxnf4bto6wuzaylec7wjmo4lznv6nz42fpas2bb4wuueehe.ipfs.nftstorage.link/', + HoM: 'https://bafybeifwzgubzysrir7pcnrkstxsgtxferm2qesu3hduasuaucwnn7enyu.ipfs.nftstorage.link/', + CoA: 'https://bafybeidw2rljcg3okollcnycryk2zc6zk3ykbygzattagdpjbagqp4cebm.ipfs.nftstorage.link/', + TC: 'https://bafybeid5xdhn6zx3s5htfuvzlueeyxgylejevnumlbxjfxc7a6g27bhr7u.ipfs.nftstorage.link/', }; export const Links = {