Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/App.js
import React from 'react'; | import React from 'react'; | ||||
import 'antd/dist/antd.less'; | import 'antd/dist/antd.less'; | ||||
import '../index.css'; | import '../index.css'; | ||||
import styled from 'styled-components'; | import styled, { ThemeProvider } from 'styled-components'; | ||||
import { theme } from '@assets/styles/theme'; | |||||
import { | import { | ||||
FolderOpenFilled, | FolderOpenFilled, | ||||
CaretRightOutlined, | CaretRightOutlined, | ||||
SettingFilled, | SettingFilled, | ||||
} from '@ant-design/icons'; | } from '@ant-design/icons'; | ||||
import Wallet from '@components/Wallet/Wallet'; | import Wallet from '@components/Wallet/Wallet'; | ||||
import Send from '@components/Send/Send'; | import Send from '@components/Send/Send'; | ||||
import SendToken from '@components/Send/SendToken'; | import SendToken from '@components/Send/SendToken'; | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | const hasTab = checkForTokenById( | ||||
'50d8292c6255cda7afc6c8566fed3cf42a2794e9619740fe8f4c95431271410e', | '50d8292c6255cda7afc6c8566fed3cf42a2794e9619740fe8f4c95431271410e', | ||||
); | ); | ||||
const location = useLocation(); | const location = useLocation(); | ||||
const history = useHistory(); | const history = useHistory(); | ||||
const selectedKey = | const selectedKey = | ||||
location && location.pathname ? location.pathname.substr(1) : ''; | location && location.pathname ? location.pathname.substr(1) : ''; | ||||
return ( | return ( | ||||
<ThemeProvider theme={theme}> | |||||
<CustomApp> | <CustomApp> | ||||
<WalletBody> | <WalletBody> | ||||
<WalletCtn> | <WalletCtn> | ||||
<HeaderCtn> | <HeaderCtn> | ||||
<CashTabLogo src={CashTab} alt="cashtab" /> | <CashTabLogo src={CashTab} alt="cashtab" /> | ||||
{hasTab && <EasterEgg src={TabCash} alt="tabcash" />} | {hasTab && ( | ||||
<EasterEgg src={TabCash} alt="tabcash" /> | |||||
)} | |||||
<a | <a | ||||
href="https://www.bitcoinabc.org/" | href="https://www.bitcoinabc.org/" | ||||
target="_blank" | target="_blank" | ||||
rel="noopener noreferrer" | rel="noopener noreferrer" | ||||
> | > | ||||
<AbcLogo src={ABC} alt="abc" /> | <AbcLogo src={ABC} alt="abc" /> | ||||
</a> | </a> | ||||
</HeaderCtn> | </HeaderCtn> | ||||
<WalletLabel name={wallet.name}></WalletLabel> | <WalletLabel name={wallet.name}></WalletLabel> | ||||
<Switch> | <Switch> | ||||
<Route path="/wallet"> | <Route path="/wallet"> | ||||
<Wallet /> | <Wallet /> | ||||
</Route> | </Route> | ||||
<Route path="/send"> | <Route path="/send"> | ||||
<Send /> | <Send /> | ||||
</Route> | </Route> | ||||
<Route | <Route | ||||
path="/send-token/:tokenId" | path="/send-token/:tokenId" | ||||
render={props => ( | render={props => ( | ||||
<SendToken | <SendToken | ||||
tokenId={props.match.params.tokenId} | tokenId={props.match.params.tokenId} | ||||
/> | /> | ||||
)} | )} | ||||
/> | /> | ||||
<Route path="/configure"> | <Route path="/configure"> | ||||
<Configure /> | <Configure /> | ||||
</Route> | </Route> | ||||
<Redirect exact from="/" to="/wallet" /> | <Redirect exact from="/" to="/wallet" /> | ||||
<Route component={NotFound} /> | <Route component={NotFound} /> | ||||
</Switch> | </Switch> | ||||
</WalletCtn> | </WalletCtn> | ||||
{wallet ? ( | {wallet ? ( | ||||
<Footer> | <Footer> | ||||
<NavButton | <NavButton | ||||
active={selectedKey === 'wallet'} | active={selectedKey === 'wallet'} | ||||
onClick={() => history.push('/wallet')} | onClick={() => history.push('/wallet')} | ||||
> | > | ||||
<FolderOpenFilled /> | <FolderOpenFilled /> | ||||
<fbt desc="Wallet menu button">Wallet</fbt> | <fbt desc="Wallet menu button">Wallet</fbt> | ||||
</NavButton> | </NavButton> | ||||
<NavButton | <NavButton | ||||
active={selectedKey === 'send'} | active={selectedKey === 'send'} | ||||
onClick={() => history.push('/send')} | onClick={() => history.push('/send')} | ||||
> | > | ||||
<CaretRightOutlined /> | <CaretRightOutlined /> | ||||
<fbt desc="Send menu button">Send</fbt> | <fbt desc="Send menu button">Send</fbt> | ||||
</NavButton> | </NavButton> | ||||
<NavButton | <NavButton | ||||
active={selectedKey === 'configure'} | active={selectedKey === 'configure'} | ||||
onClick={() => history.push('/configure')} | onClick={() => history.push('/configure')} | ||||
> | > | ||||
<SettingFilled /> | <SettingFilled /> | ||||
<fbt desc="Settings menu button">Settings</fbt> | <fbt desc="Settings menu button">Settings</fbt> | ||||
</NavButton> | </NavButton> | ||||
</Footer> | </Footer> | ||||
) : null} | ) : null} | ||||
</WalletBody> | </WalletBody> | ||||
</CustomApp> | </CustomApp> | ||||
</ThemeProvider> | |||||
); | ); | ||||
}; | }; | ||||
export default App; | export default App; |