From 91a7f355b22968f37ba222604b7c9a6e0292018c Mon Sep 17 00:00:00 2001 From: Saurabh Shinde Date: Wed, 2 Sep 2020 23:31:32 +0530 Subject: [PATCH] Added token info page --- .../TokensPage/components/TokenInfo/index.tsx | 319 ++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 webapp/src/containers/TokensPage/components/TokenInfo/index.tsx diff --git a/webapp/src/containers/TokensPage/components/TokenInfo/index.tsx b/webapp/src/containers/TokensPage/components/TokenInfo/index.tsx new file mode 100644 index 000000000..d5a8f61df --- /dev/null +++ b/webapp/src/containers/TokensPage/components/TokenInfo/index.tsx @@ -0,0 +1,319 @@ +import React, { useEffect, useState } from 'react'; +import { NavLink as RRNavLink, RouteComponentProps } from 'react-router-dom'; +import { I18n } from 'react-redux-i18n'; +import { connect } from 'react-redux'; +import { Helmet } from 'react-helmet'; +import { MdArrowBack } from 'react-icons/md'; +import { + Button, + Row, + Col, + Nav, + NavItem, + NavLink, + TabContent, + TabPane, +} from 'reactstrap'; + +import classnames from 'classnames'; + +import KeyValueLi from '../../../../components/KeyValueLi'; +import TransfersList from './TransfersList'; +import DeefIcon from '../../../../assets/svg/icon-coin-deef-lapis.svg'; +import { fetchTokenInfo } from '../../reducer'; +import { + TOKENS_PATH, + TOKEN_TRANSFERS, + TOKEN_HOLDERS, + TOKEN_INFO, + TOKEN_EXCHANGE, + TOKEN_DEX, + TOKEN_READ_CONTRACT, + TOKEN_WRITE_CONTRACT, + TOKEN_ANALYSIS, + TOKEN_COMMENTS, +} from '../../../../constants'; + +interface RouteParams { + id?: string; +} + +interface TokenInfoProps extends RouteComponentProps { + tokenInfo: any; + fetchToken: (id: string | undefined) => void; +} + +const TokenInfo: React.FunctionComponent = ( + props: TokenInfoProps +) => { + const { id } = props.match.params; + const [activeTab, setActiveTab] = useState(TOKEN_TRANSFERS); + + const { tokenInfo } = props; + + useEffect(() => { + props.fetchToken(id); + }, []); + + return ( +
+ + {I18n.t('containers.tokens.tokensPage.title')} + +
+ +

{tokenInfo.name}

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + +
+ +
+
+ +
+

{TOKEN_HOLDERS}

+
+
+ +
+

{TOKEN_INFO}

+
+
+ +
+

{TOKEN_EXCHANGE}

+
+
+ +
+

{TOKEN_DEX}

+
+
+ +
+

{TOKEN_READ_CONTRACT}

+
+
+ +
+

{TOKEN_WRITE_CONTRACT}

+
+
+ +
+

{TOKEN_ANALYSIS}

+
+
+ +
+

{TOKEN_COMMENTS}

+
+
+
+
+
+ ); +}; + +const mapStateToProps = (state) => { + const { tokens } = state; + const { tokenInfo } = tokens; + return { + tokenInfo, + }; +}; + +const mapDispatchToProps = { + fetchToken: (id) => fetchTokenInfo({ id }), +}; + +export default connect(mapStateToProps, mapDispatchToProps)(TokenInfo);