Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/App.js
import React, { useState } from 'react'; | import React, { useState, useEffect } from 'react'; | ||||
import 'antd/dist/antd.less'; | import 'antd/dist/antd.less'; | ||||
import { Spin } from 'antd'; | import { Modal, Spin } from 'antd'; | ||||
import { CashLoadingIcon } from '@components/Common/CustomIcons'; | import { CashLoadingIcon } from '@components/Common/CustomIcons'; | ||||
import '../index.css'; | import '../index.css'; | ||||
import styled, { ThemeProvider, createGlobalStyle } from 'styled-components'; | import styled, { ThemeProvider, createGlobalStyle } from 'styled-components'; | ||||
import { theme } from '@assets/styles/theme'; | import { theme } from '@assets/styles/theme'; | ||||
import { | import { | ||||
FolderOpenFilled, | FolderOpenFilled, | ||||
CaretRightOutlined, | CaretRightOutlined, | ||||
SettingFilled, | SettingFilled, | ||||
Show All 16 Lines | import { | ||||
Switch, | Switch, | ||||
useLocation, | useLocation, | ||||
useHistory, | useHistory, | ||||
} from 'react-router-dom'; | } from 'react-router-dom'; | ||||
// Easter egg imports not used in extension/src/components/App.js | // Easter egg imports not used in extension/src/components/App.js | ||||
import TabCash from '@assets/tabcash.png'; | import TabCash from '@assets/tabcash.png'; | ||||
import ABC from '@assets/logo_topright.png'; | import ABC from '@assets/logo_topright.png'; | ||||
import { checkForTokenById } from '@utils/tokenMethods.js'; | import { checkForTokenById } from '@utils/tokenMethods.js'; | ||||
import { currency } from './Common/Ticker'; | |||||
const GlobalStyle = createGlobalStyle` | const GlobalStyle = createGlobalStyle` | ||||
.ant-modal-wrap > div > div.ant-modal-content > div > div > div.ant-modal-confirm-btns > button, .ant-modal > button, .ant-modal-confirm-btns > button, .ant-modal-footer > button { | .ant-modal-wrap > div > div.ant-modal-content > div > div > div.ant-modal-confirm-btns > button, .ant-modal > button, .ant-modal-confirm-btns > button, .ant-modal-footer > button { | ||||
border-radius: 8px; | border-radius: 8px; | ||||
background-color: ${props => props.theme.modals.buttons.background}; | background-color: ${props => props.theme.modals.buttons.background}; | ||||
color: ${props => props.theme.wallet.text.secondary}; | color: ${props => props.theme.wallet.text.secondary}; | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | const App = () => { | ||||
// Easter egg boolean not used in extension/src/components/App.js | // Easter egg boolean not used in extension/src/components/App.js | ||||
const hasTab = validWallet | const hasTab = validWallet | ||||
? checkForTokenById( | ? checkForTokenById( | ||||
wallet.state.tokens, | wallet.state.tokens, | ||||
'50d8292c6255cda7afc6c8566fed3cf42a2794e9619740fe8f4c95431271410e', | '50d8292c6255cda7afc6c8566fed3cf42a2794e9619740fe8f4c95431271410e', | ||||
) | ) | ||||
: false; | : false; | ||||
useEffect(() => { | |||||
// If URL is not as specified in currency.appURL in Ticker.js, show a popup | |||||
const currentUrl = window.location.hostname; | |||||
if (currentUrl !== currency.appUrl) { | |||||
console.log( | |||||
`Loaded URL ${currentUrl} does not match app URL ${currency.appUrl}!`, | |||||
); | |||||
Modal.warning({ | |||||
title: 'Cashtab is moving!', | |||||
content: ( | |||||
<div> | |||||
<p> | |||||
Cashtab is moving to a new home at{' '} | |||||
<a | |||||
href="https://cashtab.com/" | |||||
target="_blank" | |||||
rel="noreferrer" | |||||
> | |||||
Cashtab.com | |||||
</a> | |||||
</p> | |||||
<p> | |||||
Please write down your wallet 12-word seed and | |||||
import it at the new domain. | |||||
</p> | |||||
<p> | |||||
At the end of the month, cashtabapp.com will | |||||
auto-fwd to cashtab.com after one minute. | |||||
</p> | |||||
</div> | |||||
), | |||||
}); | |||||
} | |||||
}, []); | |||||
return ( | return ( | ||||
<ThemeProvider theme={theme}> | <ThemeProvider theme={theme}> | ||||
<GlobalStyle /> | <GlobalStyle /> | ||||
<Spin | <Spin | ||||
spinning={ | spinning={ | ||||
loading || loadingUtxosAfterSend || (wallet && !validWallet) | loading || loadingUtxosAfterSend || (wallet && !validWallet) | ||||
} | } | ||||
indicator={CashLoadingIcon} | indicator={CashLoadingIcon} | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |