|
| 1 | +import React from 'react'; |
| 2 | +import isMobile from 'ismobilejs'; |
| 3 | +import intl from 'react-intl-universal'; |
| 4 | +import { inject, observer } from 'mobx-react'; |
| 5 | +import { Link } from 'react-router-dom'; |
| 6 | +import { Layout, Select, Menu, Modal, Drawer, Tooltip, Popover, Button } from 'antd'; |
| 7 | + |
| 8 | +import { cutMiddle, copyToClipboard } from '../utils/helper'; |
| 9 | +import '../assets/css/header.scss'; |
| 10 | +import walletSuccess from '../assets/images/walletSuccess.svg'; |
| 11 | +import walletFail from '../assets/images/walletFail.svg'; |
| 12 | +import logoSingle from '../assets/images/mainLogo.png'; |
| 13 | +import tronlink from '../assets/images/tronlinkLogo.svg'; |
| 14 | +import tronlinkBlue from '../assets/images/tronlinkBlue.svg'; |
| 15 | +import tronlinkRightArrow from '../assets/images/tronlinkRightArrow.svg'; |
| 16 | +import { PieChartOutlined, DesktopOutlined, ContainerOutlined } from '@ant-design/icons'; |
| 17 | + |
| 18 | +const { Option } = Select; |
| 19 | +const { SubMenu } = Menu; |
| 20 | + |
| 21 | +@inject('network') |
| 22 | +@observer |
| 23 | +class LeftMenu extends React.Component { |
| 24 | + constructor(props) { |
| 25 | + super(props); |
| 26 | + this.state = {}; |
| 27 | + } |
| 28 | + |
| 29 | + componentDidMount() { |
| 30 | + this.props.instantActions && this.props.instantActions(); // should excute when componentDidMount, we need not check if a user logined or not |
| 31 | + if (!this.props.network.isConnected) { |
| 32 | + this.props.network.initTronLinkWallet( |
| 33 | + () => { |
| 34 | + this.props.mountedActions && this.props.mountedActions(); |
| 35 | + }, |
| 36 | + () => { |
| 37 | + // if a user do not login TronLink wallet, we should do something |
| 38 | + this.props.unmountedActions && this.props.unmountedActions(); |
| 39 | + } |
| 40 | + ); |
| 41 | + } else { |
| 42 | + this.props.mountedActions && this.props.mountedActions(); |
| 43 | + } |
| 44 | + // when a user change a node or change a account or change a chain type, |
| 45 | + // we shoule listen TronLink to reload the webpage to get new account info |
| 46 | + this.props.network.listenTronLink(); |
| 47 | + } |
| 48 | + |
| 49 | + render() { |
| 50 | + return <></>; |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +export default LeftMenu; |
0 commit comments