From a3ff6d42ad70c7e72cc28f25f9aa6bb35a0a2f27 Mon Sep 17 00:00:00 2001 From: Victor Creed Date: Fri, 15 Jan 2021 15:46:50 +0200 Subject: [PATCH 1/8] Fixes wallet connection when user uses tutorial in wrong network --- .../component/screen2/index.tsx | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/app/containers/TutorialDialogModal/component/screen2/index.tsx b/src/app/containers/TutorialDialogModal/component/screen2/index.tsx index 9a6b01fc3..df0e8dd10 100644 --- a/src/app/containers/TutorialDialogModal/component/screen2/index.tsx +++ b/src/app/containers/TutorialDialogModal/component/screen2/index.tsx @@ -20,14 +20,14 @@ interface Props { onNetwork: boolean; mouseLeave: boolean; activeTutorial: boolean; - handleEngage: () => void; + handleEngage: (wallet?: string) => void; } export function Screen2(props: Props) { const { t } = useTranslation(); const content = useContent(); const [cycle, setCycle] = useState(false); - const [step, setStep] = useState(props.activeTutorial === true ? 7 : 1); + const [step, setStep] = useState(props.activeTutorial ? 7 : 1); const [speechText, setSpeechText] = useState( props.activeTutorial ? content[7].speech : content[1].speech, ); @@ -55,7 +55,7 @@ export function Screen2(props: Props) { }, [props.onNetwork]); useEffect(() => { - if (props.mouseLeave === true) { + if (props.mouseLeave) { setCycle(true); } }, [props.mouseLeave]); @@ -109,10 +109,7 @@ export function Screen2(props: Props) { {t(translations.rskConnectTutorial.input_settings.new_RPC)}
- alert('Copied!')} - > + https://public-node.rsk.co @@ -136,10 +133,7 @@ export function Screen2(props: Props) { {t(translations.rskConnectTutorial.input_settings.explorer_url)}
- alert('Copied!')} - > + https://explorer.rsk.co @@ -165,31 +159,31 @@ export function Screen2(props: Props) {
stepChange(1)} - >
+ />
stepChange(2)} - >
+ />
stepChange(3)} - >
+ />
stepChange(4)} - >
+ />
stepChange(5)} - >
+ />
stepChange(6)} - >
+ />
stepChange(7)} - >
+ /> right arrow
props.handleEngage('injected')} > engage button
From d9222a691f6145a0d6d0c7bdfa1c511f3d1db317 Mon Sep 17 00:00:00 2001 From: Victor Creed Date: Fri, 15 Jan 2021 15:49:16 +0200 Subject: [PATCH 2/8] NFT contracts for mainnnet --- src/utils/blockchain/contracts.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/blockchain/contracts.ts b/src/utils/blockchain/contracts.ts index 0e9d6a8d7..3b427cd52 100644 --- a/src/utils/blockchain/contracts.ts +++ b/src/utils/blockchain/contracts.ts @@ -106,17 +106,17 @@ export const contracts = { blockNumber: 1218833, }, SovrynNFTCommunity: { - address: '0xC5452Dbb2E3956C1161cB9C2d6DB53C2b60E7805', + address: '0x857a62c9c0b6f1211e04275a1f0c5f26fce2021f', abi: SovrynNFTAbi, blockNumber: 1218834, }, SovrynNFTHero: { - address: '0x420fECFda0975c49Fd0026f076B302064ED9C6Ff', + address: '0x7806d3fedf9c9741041f5d70af5adf326705b03d', abi: SovrynNFTAbi, blockNumber: 1218835, }, SovrynNFTSuperhero: { - address: '0x78c0D49d003bf0A88EA6dF729B7a2AD133B9Ae25', + address: '0xd9bbcd6e0ab105c83e2b5be0bbb9bb90ef963de7', abi: SovrynNFTAbi, blockNumber: 1218836, }, From 1d44514f49d5d78003389c1368b1eb6cd0db579f Mon Sep 17 00:00:00 2001 From: bitcoinuser Date: Fri, 15 Jan 2021 11:48:08 -0300 Subject: [PATCH 3/8] Add new strings and translate to PT-BR --- src/locales/pt_br/translation.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/locales/pt_br/translation.json b/src/locales/pt_br/translation.json index 64f268771..6d6aa9e07 100644 --- a/src/locales/pt_br/translation.json +++ b/src/locales/pt_br/translation.json @@ -411,6 +411,26 @@ "pending_for_user": { "title": "Pendente para o usuário", "text": "Por favor, confirme a transação na sua carteira." + }, + "pending": { + "title": "Transação pendente", + "text": "Sua transação está sendo processada." + }, + "confirmed": { + "title": "Transação confirmada!", + "text": "Sua transação foi confirmada na blockchain." + }, + "failed": { + "title": "Transação falhou!", + "text": "Transação revertida pelo contrato." + }, + "denied": { + "title": "Rejeitada!", + "text": "Transação negada pelo usuário." + }, + "texts": { + "transaction": "Transação", + "closeButton": "Fechar" } }, "topUpBtcDialog": { From fed0688b980f64a66e97a1bd7250ef918fa0e27b Mon Sep 17 00:00:00 2001 From: Victor Creed Date: Fri, 15 Jan 2021 17:51:44 +0200 Subject: [PATCH 4/8] timers updated --- package.json | 2 + src/app/components/SaleBanner/SaleBanner.scss | 7 +- src/app/components/SaleBanner/index.tsx | 225 ++++++++++-------- src/app/containers/SalesPage/SaleInfoBar.tsx | 11 +- .../SalesPage/hooks/useSaleEndTime.ts | 36 +++ .../SalesPage/hooks/useSaleIsOpen.ts | 31 +++ .../containers/SalesPage/screen2/index.tsx | 27 +-- yarn.lock | 12 + 8 files changed, 211 insertions(+), 140 deletions(-) create mode 100644 src/app/containers/SalesPage/hooks/useSaleEndTime.ts create mode 100644 src/app/containers/SalesPage/hooks/useSaleIsOpen.ts diff --git a/package.json b/package.json index 4fd194717..eecb122e2 100644 --- a/package.json +++ b/package.json @@ -89,6 +89,7 @@ "local-storage": "2.0.0", "mathjs": "7.1.0", "mini-css-extract-plugin": "0.9.0", + "moment": "2.29.1", "node-plop": "0.25.0", "optimize-css-assets-webpack-plugin": "5.0.3", "plop": "2.6.0", @@ -108,6 +109,7 @@ "react-bootstrap": "1.3.0", "react-bootstrap-icons": "1.0.0", "react-copy-to-clipboard": "5.0.2", + "react-countdown": "2.3.1", "react-dev-utils": "^10.2.1", "react-dom": "16.13.0", "react-helmet-async": "1.0.4", diff --git a/src/app/components/SaleBanner/SaleBanner.scss b/src/app/components/SaleBanner/SaleBanner.scss index 91e328981..c8b72f1fe 100644 --- a/src/app/components/SaleBanner/SaleBanner.scss +++ b/src/app/components/SaleBanner/SaleBanner.scss @@ -51,6 +51,7 @@ display: flex; justify-content: center; align-items: center; + min-width: 250px; } .picture-container { display: none; @@ -95,10 +96,8 @@ } .timer-container { position: absolute; - right: 0; - top: 0; - padding-right: 50px; - padding-top: 55px; + right: 50px; + top: 55px; } .date-container { height: 90px; diff --git a/src/app/components/SaleBanner/index.tsx b/src/app/components/SaleBanner/index.tsx index 3dc072420..2154062ef 100644 --- a/src/app/components/SaleBanner/index.tsx +++ b/src/app/components/SaleBanner/index.tsx @@ -1,87 +1,123 @@ -import React, { useEffect } from 'react'; -import './SaleBanner.scss'; +import React, { useState } from 'react'; +import { Link } from 'react-router-dom'; +import Countdown from 'react-countdown'; import { Button } from '@blueprintjs/core'; +import moment from 'moment'; + +import './SaleBanner.scss'; import samurai from './assets/banner-samurai.svg'; -import { Link } from 'react-router-dom'; +import { useSaleEndTime } from '../../containers/SalesPage/hooks/useSaleEndTime'; +import { currentNetwork } from '../../../utils/classifiers'; + +const startDate = moment('2021-01-19 17:00+0').utc().toDate(); +// const startDate: Date = null as any; export function SaleBanner() { - useEffect(() => { - const countDownDate = new Date('Jan 15, 2021 12:30:00+0').getTime(); - const x = setInterval(function () { - const now = new Date().getTime(); - const distance = countDownDate - now; - let sdays, - shours, - smins, - ssecs = ''; - const days = Math.floor(distance / (1000 * 60 * 60 * 24)); - if (days <= 9) { - sdays = `0${days}`; - } else { - sdays = `${days}`; - } - const hours = Math.floor( - (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60), + const [show, setShow] = useState(true); + const { date: endDate, now, loading } = useSaleEndTime(); + + const closeBanner = () => { + setShow(false); + }; + + const countDown = ({ days, hours, minutes, seconds, completed }) => { + if (completed) { + return <>; + } else { + return ( +
+
+
+

Days

+

{days}

+
+
+

Hours

+

{hours}

+
+
+

Mins

+

{minutes}

+
+
+

Secs

+

{seconds}

+
+
+
); - if (hours <= 9) { - shours = `0${hours}`; - } else { - shours = `${hours}`; - } - const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); - if (minutes <= 9) { - smins = `0${minutes}`; - } else { - smins = `${minutes}`; - } - var seconds = Math.floor((distance % (1000 * 60)) / 1000); - if (seconds <= 9) { - ssecs = `0${seconds}`; - } else { - ssecs = `${seconds}`; - } - let daysElement = document.getElementById('days') as HTMLInputElement; - daysElement.innerText = sdays; - let hoursElement = document.getElementById('hours') as HTMLInputElement; - hoursElement.innerText = shours; - let minsElement = document.getElementById('mins') as HTMLInputElement; - minsElement.innerText = smins; - let secsElement = document.getElementById('secs') as HTMLInputElement; - secsElement.innerText = ssecs; + } + }; - if (distance < 0) { - clearInterval(x); - let timerElement = document.getElementById( - 'timer-container', - ) as HTMLInputElement; - timerElement.style.display = 'none'; - let titleElement = document.getElementById( - 'title-text', - ) as HTMLInputElement; - titleElement.innerText = 'Token sale is live now!'; - } - }, 1000); + if (!show) { + return null; + } - return () => { - clearInterval(x); - }; - }, []); + //todo: temp only, until date is not decided + if (currentNetwork === 'mainnet') { + return ( +
+
+
+

+ <>SOV* Genesis Sale +

+
+

SOV Token Sale

+
+
+ + Learn More + +
+
+
+ banner-samurai +
+
+
+
+
+ ); + } - const closeBanner = () => { - let timerElement = document.getElementById( - 'banner-container', - ) as HTMLInputElement; - timerElement.style.display = 'none'; - }; return ( -