From f99c521adfee392df5f72212f83031a59d810205 Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Mon, 25 Sep 2023 22:20:29 +0530 Subject: [PATCH] Removed Elections counter (#219) --- src/components/common/ProgressTracker.jsx | 84 +------------------ .../fractalVerification/TabScreens.jsx | 63 +------------- src/pages/Activate.jsx | 20 ++--- src/utils/constants.js | 6 +- 4 files changed, 12 insertions(+), 161 deletions(-) diff --git a/src/components/common/ProgressTracker.jsx b/src/components/common/ProgressTracker.jsx index a3293c4..09abd84 100644 --- a/src/components/common/ProgressTracker.jsx +++ b/src/components/common/ProgressTracker.jsx @@ -3,21 +3,13 @@ import { wallet } from '../..'; import { getConfig } from '../../utils/config'; import { formatNumberWithComma } from '../../utils/utilityFunctions'; import { useSelector } from 'react-redux'; -import { - ElectionsStartTime, - IAHShutDownEndTime, - IAHShutDownStartTime, - Links, - ReducerNames, -} from '../../utils/constants'; -import moment from 'moment-timezone'; +import { Links, ReducerNames } from '../../utils/constants'; 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 [electionStarted, setElectionStarted] = useState(false); const fetchHumansRegistered = async () => { try { @@ -64,56 +56,6 @@ const ProgressTracker = () => { const ReadableNumber = formatNumberWithComma(ProgressMeterMax); - // 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 timestamp = electionStarted - ? IAHShutDownStartTime - : IAHShutDownEndTime; - const futureDateLocal = timestamp.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(() => { - const isElectionStarted = moment().isSameOrAfter( - ElectionsStartTime.clone().tz(userTimezone) - ); - setElectionStarted(isElectionStarted); - updateCountdown(); - - const interval = setInterval(updateCountdown, 1000); - - return () => clearInterval(interval); - }, []); - - const NumberContainer = ({ number, text }) => { - return ( - -

- {number} -

-

{text}

-
- ); - }; - if (showTracker) { return (
@@ -169,30 +111,6 @@ const ProgressTracker = () => { )}
- {/* to not show any countdown from 1 sept to 7 sept */} - {!electionStarted && - countdown.days <= 0 && - countdown.hours <= 0 && - countdown.minutes <= 0 && - countdown.seconds <= 0 ? null : ( -
-

- {electionStarted - ? 'TIME REMAINING IN CURRENT ELECTION' - : 'VOTER REGISTRATION END'} - S -

-

- - - - -

-
- )} ); } else return null; diff --git a/src/components/fractalVerification/TabScreens.jsx b/src/components/fractalVerification/TabScreens.jsx index ba96a8b..fa7a3f7 100644 --- a/src/components/fractalVerification/TabScreens.jsx +++ b/src/components/fractalVerification/TabScreens.jsx @@ -17,18 +17,10 @@ import { SuccesVerification } from './SuccessPage'; import { useSelector, useDispatch } from 'react-redux'; import { verifyUser } from '../../services/api'; import { updateResponse } from '../../redux/reducer/oracleReducer'; -import { - IAHShutDownEndTime, - IAHShutDownStartTime, - ImageSrc, - OneE21, - ReducerNames, -} from '../../utils/constants'; +import { ImageSrc, OneE21, ReducerNames } from '../../utils/constants'; import { setActivePageIndex } from '../../redux/reducer/commonReducer'; import { Link } from '../common/Link'; import { fpPromise } from '../../utils/fingerprint'; -import { Dialog, Transition } from '@headlessui/react'; -import moment from 'moment-timezone'; const DEFAULT_ERROR_MESSAGE = 'Something went wrong, please try again.'; @@ -284,61 +276,8 @@ export const ScanFace = () => { } }, [responseData?.token]); - const userTimezone = moment.tz.guess(); - const electionEndDate = IAHShutDownEndTime; - const electionStartDate = IAHShutDownStartTime; - - const formatString = 'MMMM D, HH:mm:ss [UTC]'; // Format string - return (
- {/* compare using the local dates */} - {moment().isBetween( - electionStartDate.clone().tz(userTimezone), - electionEndDate.clone().tz(userTimezone) - ) && ( - - {}}> - -
- - -
-
- - -
-

- I-AM-HUMAN Voter Registration is paused during the NDC - Election between{' '} - {moment(electionStartDate).utc().format(formatString)}{' '} - and {moment(electionEndDate).utc().format(formatString)} - . -

-
-
-
-
-
-
-
- )}
diff --git a/src/pages/Activate.jsx b/src/pages/Activate.jsx index b1f8e25..52c9af4 100644 --- a/src/pages/Activate.jsx +++ b/src/pages/Activate.jsx @@ -38,24 +38,15 @@ const ActivatePage = () => {
window.open(Links.ELECTIONS, '_blank')} title="NEAR General Election" description="The NDC is launching the inaugural ecosystem wide General Election to enable decentralized governance on-chain. #Vote in the September 8th General Election and mint your “I Voted” reputation Soul Bound Token!" - buttonText="Vote Now" + buttonText="Closed" /> - window.open( - 'https://near.org/nomination.ndctools.near/widget/NDC.Nomination.Page', - '_blank' - ) - } - buttonText="Participate Now" + buttonText="Closed" /> { ) } /> - window.open(Links.KUDOS_WIDGET, '_blank')} @@ -102,6 +92,12 @@ const ActivatePage = () => { } buttonText="See you IRL" /> +