From 452f066547c469a809c8940dfa98e228f5d01fb8 Mon Sep 17 00:00:00 2001 From: dimakorzhovnik Date: Fri, 5 Nov 2021 14:50:41 +0300 Subject: [PATCH] feat(app): bostrom launch --- package.json | 2 +- src/components/valueImg/index.jsx | 18 ++ src/containers/Wallet/card/PubkeyCard.jsx | 8 +- src/containers/Wallet/card/tweet.jsx | 1 - .../Wallet/components/pocketCard.jsx | 2 +- src/containers/Wallet/hooks/pubkeyCard.js | 2 +- src/containers/account/index.jsx | 18 +- src/containers/application/application.jsx | 271 +++++++++--------- src/containers/genesis/index.jsx | 3 +- src/containers/gol/components/row.jsx | 5 + src/containers/gol/table.jsx | 8 +- src/containers/movie/index.jsx | 75 +++++ src/image/seedling.png | Bin 0 -> 11224 bytes src/router.jsx | 59 ++-- src/style/home.css | 2 +- src/utils/config.js | 4 +- 16 files changed, 308 insertions(+), 170 deletions(-) create mode 100644 src/containers/movie/index.jsx create mode 100644 src/image/seedling.png diff --git a/package.json b/package.json index b4eca6573..6a5b89ed7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "start": "webpack-dev-server --config=webpack.config.dev.js --https -d --disable-host-check", - "build": "webpack --config=webpack.config.prod.js -p && ncp build/index.html build/404.html && echo 'cyb.ai' > build/CNAME", + "build": "webpack --config=webpack.config.prod.js -p && ncp build/index.html build/404.html && echo 'rebyc.cyber.page' > build/CNAME", "devserver": "parcel serve src/index.html -p 8001 --no-cache", "lint": "eslint src/" }, diff --git a/src/components/valueImg/index.jsx b/src/components/valueImg/index.jsx index c19a4939f..9cd3a0aa0 100644 --- a/src/components/valueImg/index.jsx +++ b/src/components/valueImg/index.jsx @@ -7,6 +7,9 @@ const hydrogen = require('../../image/hydrogen.svg'); const tocyb = require('../../image/boot.png'); const boot = require('../../image/large-green.png'); const downOutline = require('../../image/chevronDownOutline.svg'); +const gol = require('../../image/seedling.png'); +const atom = require('../../image/cosmos-2.svg'); +const eth = require('../../image/Ethereum_logo_2014.svg'); const ValueImg = ({ text, @@ -54,6 +57,21 @@ const ValueImg = ({ textCurency = 'choose'; break; + case 'GOL': + img = gol; + textCurency = 'GOL'; + break; + + case 'atom': + img = atom; + textCurency = 'ATOM'; + break; + + case 'eth': + img = eth; + textCurency = 'ETH'; + break; + default: if (text.includes('pool')) { textCurency = trimString(text, 4, 3); diff --git a/src/containers/Wallet/card/PubkeyCard.jsx b/src/containers/Wallet/card/PubkeyCard.jsx index 5d60659d3..0cde70ec3 100644 --- a/src/containers/Wallet/card/PubkeyCard.jsx +++ b/src/containers/Wallet/card/PubkeyCard.jsx @@ -211,7 +211,7 @@ const CosmosAddressInfo = ({ value={ ((totalCosmos.total / COSMOS.DIVISOR_ATOM) * 1000) / 1000 } - text="ATOM" + text="atom" /> {open && ( @@ -219,7 +219,7 @@ const CosmosAddressInfo = ({ total={totalCosmos} paddingLeft={15} divisor={COSMOS.DIVISOR_ATOM} - currency="ATOM" + currency="atom" /> )} @@ -411,6 +411,7 @@ const EULnetworkInfo = ({ .map((key) => { return ( { return ( @@ -514,7 +516,7 @@ const EthAddressInfo = ({ diff --git a/src/containers/Wallet/card/tweet.jsx b/src/containers/Wallet/card/tweet.jsx index aed180a54..0bdf9dc58 100644 --- a/src/containers/Wallet/card/tweet.jsx +++ b/src/containers/Wallet/card/tweet.jsx @@ -310,7 +310,6 @@ function TweetCard({ const mapStateToProps = (store) => { return { - mobile: store.settings.mobile, node: store.ipfs.ipfs, }; }; diff --git a/src/containers/Wallet/components/pocketCard.jsx b/src/containers/Wallet/components/pocketCard.jsx index 64ab15bbf..16a5bf215 100644 --- a/src/containers/Wallet/components/pocketCard.jsx +++ b/src/containers/Wallet/components/pocketCard.jsx @@ -12,7 +12,7 @@ const editOutline = require('../../../image/create-outline.svg'); const editDone = require('../../../image/ionicons_svg_ios-checkmark-circle.svg'); const deleteIcon = require('../../../image/trash-outline.svg'); const imgEth = require('../../../image/Ethereum_logo_2014.svg'); -const imgCyber = require('../../../image/blue-circle.png'); +const imgCyber = require('../../../image/large-green.png'); const imgCosmos = require('../../../image/cosmos-2.svg'); const imgData = { diff --git a/src/containers/Wallet/hooks/pubkeyCard.js b/src/containers/Wallet/hooks/pubkeyCard.js index 721812b08..e6c7144f9 100644 --- a/src/containers/Wallet/hooks/pubkeyCard.js +++ b/src/containers/Wallet/hooks/pubkeyCard.js @@ -74,7 +74,7 @@ export const useGetBalanceEth = (address) => { setBalanceEth((item) => ({ ...item, gol: responseGol })); } }; - feachData(); + setTimeout(feachData, 100); }, [address]); return balanceEth; diff --git a/src/containers/account/index.jsx b/src/containers/account/index.jsx index 0d3ead89b..b2efcaffd 100644 --- a/src/containers/account/index.jsx +++ b/src/containers/account/index.jsx @@ -6,7 +6,7 @@ import GetLink from './tabs/link'; import { getIpfsHash, getTweet, chekFollow } from '../../utils/search/utils'; // import Balance fro./mainnce'; import Heroes from './tabs/heroes'; -import { fromBech32, formatNumber, asyncForEach } from '../../utils/utils'; +import { coinDecimals, formatNumber, asyncForEach } from '../../utils/utils'; import { Loading, Copy, ContainerCard, Card, Dots } from '../../components'; import ActionBarContainer from './actionBar'; import GetTxs from './tabs/txs'; @@ -18,7 +18,7 @@ import AvatarIpfs from './component/avatarIpfs'; import CyberLinkCount from './component/cyberLinkCount'; import { AppContext } from '../../context'; import { useGetCommunity, useGetBalance, useGetHeroes } from './hooks'; -import { CYBER } from '../../utils/config'; +import { CYBER, PATTERN_CYBER } from '../../utils/config'; const TabBtn = ({ text, isSelected, onSelect, to }) => ( @@ -57,6 +57,7 @@ function AccountDetails({ node, mobile, defaultAccount }) { const [tweets, setTweets] = useState(false); const [follow, setFollow] = useState(false); const [activeAddress, setActiveAddress] = useState(null); + const [karmaNeuron, setKarmaNeuron] = useState(0); useEffect(() => { const { pathname } = location; @@ -107,6 +108,17 @@ function AccountDetails({ node, mobile, defaultAccount }) { getFeeds(); }, [address, updateAddress]); + useEffect(() => { + const getKarma = async () => { + if (jsCyber !== null && address.match(PATTERN_CYBER)) { + const responseKarma = await jsCyber.karma(address); + const karma = parseFloat(responseKarma.karma); + setKarmaNeuron(karma); + } + }; + getKarma(); + }, [jsCyber, address]); + useEffect(() => { const chekFollowAddress = async () => { const addressFromIpfs = await getIpfsHash(address); @@ -237,7 +249,7 @@ function AccountDetails({ node, mobile, defaultAccount }) { } + value={formatNumber(karmaNeuron)} stylesContainer={{ width: '100%', maxWidth: 'unset', diff --git a/src/containers/application/application.jsx b/src/containers/application/application.jsx index 5a2d107fa..6db3314e1 100644 --- a/src/containers/application/application.jsx +++ b/src/containers/application/application.jsx @@ -92,6 +92,7 @@ function App({ setAccountsProps, setDefaultAccountProps, setBandwidthProps, + time, children, }) { const { jsCyber } = useContext(AppContext); @@ -104,11 +105,14 @@ function App({ const [countLink, setCountLink] = useState(0); const [priceLink, setPriceLink] = useState(0.25); const [amounPower, setAmounPower] = useState(0); - let story = false; - const localStorageStory = localStorage.getItem('story'); - if (localStorageStory !== null) { - story = localStorageStory; - } + const [story, setStory] = useState(false); + + useEffect(() => { + if (!time) { + setStory(true); + setOpenMenu(false); + } + }, [time]); useEffect(() => { const { pathname } = location; @@ -297,147 +301,146 @@ function App({ return (
-
- - setOpenMenu(false)} - openMenu={openMenu} - > - - - setOpenMenu(!openMenu)} imgLogo={cyber} /> - - - - - - - - {!home && ( - - onChangeInput(e)} - onKeyPress={handleKeyPress} - className="search-input" - ref={textInput} - value={query} - autoComplete="off" - id="search-input-searchBar" - style={{ - width: '100%', - height: 41, - fontSize: 20, - textAlign: 'center', - position: 'absolute', - top: '50%', - transform: 'translate(0, -50%)', - zIndex: 1, - backgroundColor: '#000', - }} - /> - lensIcon + setOpenMenu(false)} + openMenu={openMenu} + > + + + setOpenMenu(!openMenu)} + imgLogo={cyber} /> + + + - )} - - {defaultAccount.name !== null && ( - - {defaultAccount.name} - + - )} - - - - - - Cyb app - {' '} - has not been audited yet. Be especially careful when interracting with apps from search results! They can trick you with what you actually sign! {' '} - - Join the discussion {' '} - - on how to make apps in search results secure - - } + {!home && ( + + onChangeInput(e)} + onKeyPress={handleKeyPress} + className="search-input" + ref={textInput} + value={query} + autoComplete="off" + id="search-input-searchBar" + style={{ + width: '100%', + height: 41, + fontSize: 20, + textAlign: 'center', + position: 'absolute', + top: '50%', + transform: 'translate(0, -50%)', + zIndex: 1, + backgroundColor: '#000', + }} + /> bugs - + + )} + + {defaultAccount.name !== null && ( + + + {defaultAccount.name} + + + )} + + + + + Cyb app has not been audited yet. + Be especially careful when interracting with apps from + search results! They can trick you with what you actually + sign! Join the discussion + on how to make apps in search results secure + + } + > + bugs + + - -
+
+ )} {/* */} {children} diff --git a/src/containers/genesis/index.jsx b/src/containers/genesis/index.jsx index 683624869..c3c80089c 100644 --- a/src/containers/genesis/index.jsx +++ b/src/containers/genesis/index.jsx @@ -1,4 +1,5 @@ import React, { useEffect, useState, useRef } from 'react'; +import { useHistory } from 'react-router-dom'; import { connect } from 'react-redux'; import Iframe from 'react-iframe'; import Timer from './timer'; @@ -16,7 +17,7 @@ function Genesis() { height="100%" id="iframeCid" className="iframe-SearchItem" - src="http://127.0.0.1:8080/ipfs/QmadZMMwcAkgwVQ5vd6bbRpSQo1NVe9ihmsdYc8HwJhSLu/" + src="http://127.0.0.1:8080/ipfs/QmY37mCc1FuSMzpKaHoz5aDtJsz4gnJWG13Vrih8ifxXjS/" /> )} diff --git a/src/containers/gol/components/row.jsx b/src/containers/gol/components/row.jsx index 0a0629964..93cf887ca 100644 --- a/src/containers/gol/components/row.jsx +++ b/src/containers/gol/components/row.jsx @@ -14,6 +14,11 @@ const RowTable = ({ text, cybWon }) => ( {cybWon} + + + {cybWon} + + ); diff --git a/src/containers/gol/table.jsx b/src/containers/gol/table.jsx index db06085f7..9c046e721 100644 --- a/src/containers/gol/table.jsx +++ b/src/containers/gol/table.jsx @@ -28,7 +28,12 @@ const TableDiscipline = ({ address }) => { - CYB won + TOCYB + + + + + BOOT @@ -43,6 +48,7 @@ const TableDiscipline = ({ address }) => { Object.keys(resultGol).map((key) => ( ))} diff --git a/src/containers/movie/index.jsx b/src/containers/movie/index.jsx new file mode 100644 index 000000000..53edf1797 --- /dev/null +++ b/src/containers/movie/index.jsx @@ -0,0 +1,75 @@ +import React, { useEffect, useState, useRef } from 'react'; +import { useHistory } from 'react-router-dom'; +import { connect } from 'react-redux'; +import Iframe from 'react-iframe'; +import { Dots, Loading } from '../../components'; + +// const linkMovie = +// 'http://127.0.0.1:8080/ipfs/QmY37mCc1FuSMzpKaHoz5aDtJsz4gnJWG13Vrih8ifxXjS/'; + +const linkMovie = + 'https://gateway.ipfs.cybernode.ai/ipfs/QmTx3ZpdER5pVWR2x2E7vNrg3r7w7eLR3D2tr11pTViU2M'; + +function Movie() { + const [loading, setLoading] = useState(true); + const history = useHistory(); + + const redirect = () => { + history.push(`/oracle`); + }; + + useEffect(() => { + const handlerEventListener = (e) => { + if (e.data === 'endStatusMovie') { + redirect(); + } + }; + window.addEventListener('message', handlerEventListener); + return () => { + window.removeEventListener('message', handlerEventListener); + }; + }, []); + + useEffect(() => { + const iframeTag = document.querySelector('iframe'); + + if (iframeTag) { + iframeTag.addEventListener('load', function (e) { + setLoading(false); + }); + } else { + setLoading(false); + } + }, []); + + return ( +
+ {loading && ( +
+ +
+ rendering story +
+
+ )} +