From f7c3640c6f365b368816bfca8230e3cd13514d5b Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 Date: Sun, 27 Aug 2023 15:03:33 +0530 Subject: [PATCH 1/4] added countdown --- src/components/common/ProgressTracker.jsx | 58 +++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/components/common/ProgressTracker.jsx b/src/components/common/ProgressTracker.jsx index 6be13a7..9b36119 100644 --- a/src/components/common/ProgressTracker.jsx +++ b/src/components/common/ProgressTracker.jsx @@ -4,6 +4,7 @@ import { getConfig } from '../../utils/config'; import { formatNumberWithComma } from '../../utils/utilityFunctions'; import { useSelector } from 'react-redux'; import { Links, ReducerNames } from '../../utils/constants'; +import moment from 'moment-timezone'; const ProgressTracker = () => { const ProgressMeterMax = process.env.REACT_APP_PROGRESS_METER_MAX ?? 3000; @@ -56,6 +57,51 @@ const ProgressTracker = () => { const ReadableNumber = formatNumberWithComma(ProgressMeterMax); + const futureDateUtc = moment.unix(1693612799); // September 1 @ 23:59:59 + + // Get the user's local timezone + const userTimezone = moment.tz.guess(); + const [countdown, setCountdown] = useState({ + days: 0, + hours: 0, + minutes: 0, + seconds: 0, + }); + + function updateCountdown() { + const nowLocal = moment(); // Get the current local time + const futureDateLocal = futureDateUtc.clone().tz(userTimezone); + + // Calculate the time remaining + const countdownDuration = moment.duration(futureDateLocal.diff(nowLocal)); + + setCountdown({ + days: countdownDuration.days(), + hours: countdownDuration.hours(), + minutes: countdownDuration.minutes(), + seconds: countdownDuration.seconds(), + }); + } + + useEffect(() => { + updateCountdown(); + + const interval = setInterval(updateCountdown, 1000); + + return () => clearInterval(interval); + }, []); + + const NumberContainer = ({ number, text }) => { + return ( + +

+ {number} +

+

{text}

+
+ ); + }; + if (showTracker) { return (
@@ -110,6 +156,18 @@ const ProgressTracker = () => { )}
+
+

VOTER REGISTRATION ENDS

+

+ + + + +

+
); } else return null; From 66da4faf9fbe671866e5949cce9e7a5d593a87a4 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 Date: Sun, 27 Aug 2023 15:50:01 +0530 Subject: [PATCH 2/4] added voter status UI --- src/images/InfoIcon.js | 12 ++++ src/pages/auth/Home.jsx | 134 +++++++++++++++++++++++++++++++++++++++- src/styles/index.css | 4 ++ src/utils/constants.js | 5 ++ 4 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 src/images/InfoIcon.js diff --git a/src/images/InfoIcon.js b/src/images/InfoIcon.js new file mode 100644 index 0000000..a4e1a35 --- /dev/null +++ b/src/images/InfoIcon.js @@ -0,0 +1,12 @@ +export const InfoIcon = ({ styles = '' }) => ( + + + +); diff --git a/src/pages/auth/Home.jsx b/src/pages/auth/Home.jsx index 4fad7e9..c7c30f9 100644 --- a/src/pages/auth/Home.jsx +++ b/src/pages/auth/Home.jsx @@ -1,9 +1,10 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { wallet } from '../../index'; import { getConfig } from '../../utils/config'; import { toast } from 'react-toastify'; import { isNumber } from '../../utils/utilityFunctions'; import { + AccountFlag, ImageSrc, LSKeys, ReducerNames, @@ -13,6 +14,8 @@ import { useDispatch, useSelector } from 'react-redux'; import { updateTokens } from '../../redux/reducer/sbtsReducer'; import TokensGrid from '../../components/common/TokensGrid'; import { setActivePageIndex } from '../../redux/reducer/commonReducer'; +import { InfoIcon } from '../../images/InfoIcon'; +import { PrimaryButton } from '../../components/common/Buttons'; const Home = () => { const { isUserHuman } = useSelector((state) => state[ReducerNames.SBT]); @@ -39,6 +42,9 @@ const Home = () => { } }, [activePageIndex]); + const [showTooltip, setShowtooltip] = useState(false); + const [voterStatus, setVoterStatus] = useState(null); + const fetchOGSBTTokens = async () => { try { const data = await wallet.viewMethod({ @@ -182,8 +188,134 @@ const Home = () => { } }; + useEffect(() => { + if (isUserHuman) { + fetchVoterStatus(); + } + }, [isUserHuman]); + + const fetchVoterStatus = async () => { + const data = await wallet.viewMethod({ + contractId: app_contract, + method: 'account_flagged', + args: { + account: wallet.accountId, + }, + }); + setVoterStatus(data); + }; + + const tagClasses = 'rounded-2xl md:rounded-full p-2 px-4'; + + const ToolTip = ({ heading, description }) => { + return ( +
+
+

{heading}

+

{description}

+
+ + + +
+ ); + }; + + const VerifiedTag = () => { + return ( +
+ Verified Voter +
+ ); + }; + + const BlacklistTag = () => { + return ( +
+
+

Blacklist

+
setShowtooltip(true)} + onMouseLeave={() => setShowtooltip(false)} + className="bg-icon-white pointer group relative" + > + + {showTooltip && ( + + )} +
+
+ Complete Appeal +
+ ); + }; + + const VerificationTag = () => { + return ( +
+
+

More Verification Need

+
setShowtooltip(true)} + onMouseLeave={() => setShowtooltip(false)} + className="pointer group relative" + > + + {showTooltip && ( + + )} +
+
+ Apply to Verify +
+ ); + }; + + const VoterStatusTags = () => { + switch (voterStatus) { + case AccountFlag.Blacklisted: + return ; + case AccountFlag.Verified: + return ; + default: + return ; + } + }; + return (
+ {/* voter status */} + {isUserHuman && ( +
+

Voter Status

+ +
+ )}

My I-AM-HUMAN Soul Bound Tokens

diff --git a/src/styles/index.css b/src/styles/index.css index 311a032..e48c5d7 100644 --- a/src/styles/index.css +++ b/src/styles/index.css @@ -157,3 +157,7 @@ html { width: 5rem !important; height: 5rem !important; } + +.bg-icon-white svg { + fill: white !important; +} diff --git a/src/utils/constants.js b/src/utils/constants.js index 777bb82..f2e9807 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -117,3 +117,8 @@ export const Links = { FAIR_VOTING_POLICY: 'https://bafkreidwdxocdkfsv6srynw7ipnogfuw76fzncmxd5jv7furbsn5cp4bz4.ipfs.nftstorage.link/', }; + +export const AccountFlag = { + Blacklisted: 'Blacklisted', + Verified: 'Verified', +}; From 99e60c31f4045ebf28a86d988d9f565d68409e91 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 Date: Mon, 28 Aug 2023 20:32:10 +0530 Subject: [PATCH 3/4] fixed netlify issue --- package.json | 1 + yarn.lock | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/package.json b/package.json index 1ea6d33..a890d84 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "ethers": "^6.6.7", "jsonp": "^0.2.1", "moment": "^2.29.4", + "moment-timezone": "^0.5.43", "near-api-js": "^2.1.4", "react": "^18.2.0", "react-confetti": "^6.1.0", diff --git a/yarn.lock b/yarn.lock index 891f4ec..266e5de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11738,6 +11738,13 @@ mkdirp@^0.5.1, mkdirp@~0.5.1: dependencies: minimist "^1.2.6" +moment-timezone@^0.5.43: + version "0.5.43" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.43.tgz#3dd7f3d0c67f78c23cd1906b9b2137a09b3c4790" + integrity sha512-72j3aNyuIsDxdF1i7CEgV2FfxM1r6aaqJyLB2vwb33mXYyoyLly+F1zbWqhA3/bVIoJ4szlUoMbUnVdid32NUQ== + dependencies: + moment "^2.29.4" + moment@^2.29.4: version "2.29.4" resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" From 5abd0f68f0bb186c142fad82d74464e88b02f045 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 Date: Mon, 28 Aug 2023 20:57:47 +0530 Subject: [PATCH 4/4] added links and commented voter status --- src/pages/auth/Home.jsx | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/pages/auth/Home.jsx b/src/pages/auth/Home.jsx index c7c30f9..c680a25 100644 --- a/src/pages/auth/Home.jsx +++ b/src/pages/auth/Home.jsx @@ -188,11 +188,11 @@ const Home = () => { } }; - useEffect(() => { - if (isUserHuman) { - fetchVoterStatus(); - } - }, [isUserHuman]); + // useEffect(() => { + // if (isUserHuman) { + // fetchVoterStatus(); + // } + // }, [isUserHuman]); const fetchVoterStatus = async () => { const data = await wallet.viewMethod({ @@ -263,7 +263,16 @@ const Home = () => { )}
- Complete Appeal + + window.open( + 'https://docs.google.com/forms/d/e/1FAIpQLSdQYxiUcxpiCDVKnN55Q7T2fnUPt0VjRdzo46qEkV7ub5mWFw/viewform', + '_blank' + ) + } + > + Complete Appeal + ); }; @@ -291,7 +300,16 @@ const Home = () => { )} - Apply to Verify + + window.open( + 'https://docs.google.com/forms/d/e/1FAIpQLSfa3S6Qz1MdiJEXINMICv9O9oVD7LOdwiPmHI_4_gCLAhN0CA/viewform', + '_blank' + ) + } + > + Apply to Verify + ); }; @@ -310,12 +328,12 @@ const Home = () => { return (
{/* voter status */} - {isUserHuman && ( + {/* {isUserHuman && (

Voter Status

- )} + )} */}

My I-AM-HUMAN Soul Bound Tokens