diff --git a/src/components/Header/components/Provider.tsx b/src/components/Header/components/Provider.tsx index 86b30343..8f2032c0 100644 --- a/src/components/Header/components/Provider.tsx +++ b/src/components/Header/components/Provider.tsx @@ -6,7 +6,7 @@ import * as React from 'react' import Col from 'src/components/layout/Col' import Divider from 'src/components/layout/Divider' -import { md, screenSm, sm } from 'src/theme/variables' +import { screenSm, sm } from 'src/theme/variables' const styles = () => ({ root: { @@ -26,8 +26,8 @@ const styles = () => ({ flex: '1 1 auto', padding: sm, [`@media (min-width: ${screenSm}px)`]: { - paddingLeft: md, - paddingRight: md, + paddingLeft: sm, + paddingRight: sm, }, }, expand: { diff --git a/src/components/Header/components/ProviderInfo/ProviderAccessible.tsx b/src/components/Header/components/ProviderInfo/ProviderAccessible.tsx index 1186c809..009455bd 100644 --- a/src/components/Header/components/ProviderInfo/ProviderAccessible.tsx +++ b/src/components/Header/components/ProviderInfo/ProviderAccessible.tsx @@ -1,18 +1,25 @@ -import { withStyles } from '@material-ui/core/styles' -import Dot from '@material-ui/icons/FiberManualRecord' +import { makeStyles } from '@material-ui/core/styles' import * as React from 'react' +import NetworkLabel from '../NetworkLabel' import CircleDot from 'src/components/Header/components/CircleDot' import Identicon from 'src/components/Identicon' import Col from 'src/components/layout/Col' import Paragraph from 'src/components/layout/Paragraph' import { shortVersionOf } from 'src/logic/wallets/ethAddresses' +import WalletIcon from '../WalletIcon' import { connected as connectedBg, screenSm, sm } from 'src/theme/variables' -const styles = () => ({ +const useStyles = makeStyles({ network: { fontFamily: 'Averta, sans-serif', }, + networkLabel: { + '& div': { + paddingRight: sm, + paddingLeft: sm, + }, + }, identicon: { display: 'none', [`@media (min-width: ${screenSm}px)`]: { @@ -33,6 +40,12 @@ const styles = () => ({ display: 'block', }, }, + providerContainer: { + display: 'flex', + flex: 1, + alignItems: 'center', + width: '100px', + }, account: { alignItems: 'start', display: 'flex', @@ -42,25 +55,27 @@ const styles = () => ({ paddingRight: sm, }, address: { + marginLeft: '5px', letterSpacing: '-0.5px', }, }) -const ProviderInfo = ({ classes, connected, network, provider, userAddress }) => { - const providerText = `${provider} [${network}]` +interface ProviderInfoProps { + connected: boolean + provider: string + userAddress: string +} + +const ProviderInfo = ({ connected, provider, userAddress }: ProviderInfoProps): React.ReactElement => { + const classes = useStyles() const cutAddress = connected ? shortVersionOf(userAddress, 4) : 'Connection Error' const color = connected ? 'primary' : 'warning' const identiconAddress = userAddress || 'random' return ( <> - {connected && ( - <> - - - - )} {!connected && } + weight="bolder" data-testid="connected-wallet" > - {providerText} - - - {cutAddress} + {provider} +
+ {connected && } + + {cutAddress} + +
+ + + ) } -export default withStyles(styles as any)(ProviderInfo) +export default ProviderInfo diff --git a/src/components/Header/components/WalletIcon/icons/icon-authereum.png b/src/components/Header/components/WalletIcon/icons/icon-authereum.png new file mode 100644 index 00000000..c0150acf Binary files /dev/null and b/src/components/Header/components/WalletIcon/icons/icon-authereum.png differ diff --git a/src/components/Header/components/WalletIcon/icons/icon-coinbase.svg b/src/components/Header/components/WalletIcon/icons/icon-coinbase.svg new file mode 100644 index 00000000..7c6cb2e2 --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-coinbase.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/Header/components/WalletIcon/icons/icon-dapper.png b/src/components/Header/components/WalletIcon/icons/icon-dapper.png new file mode 100644 index 00000000..ea799798 Binary files /dev/null and b/src/components/Header/components/WalletIcon/icons/icon-dapper.png differ diff --git a/src/components/Header/components/WalletIcon/icons/icon-fortmatic.svg b/src/components/Header/components/WalletIcon/icons/icon-fortmatic.svg new file mode 100644 index 00000000..a24833fd --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-fortmatic.svg @@ -0,0 +1,11 @@ + + + diff --git a/src/components/Header/components/WalletIcon/icons/icon-ledger.svg b/src/components/Header/components/WalletIcon/icons/icon-ledger.svg new file mode 100644 index 00000000..02b81e95 --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-ledger.svg @@ -0,0 +1 @@ + diff --git a/src/components/Header/components/WalletIcon/icons/icon-metamask.png b/src/components/Header/components/WalletIcon/icons/icon-metamask.png new file mode 100644 index 00000000..e8270510 Binary files /dev/null and b/src/components/Header/components/WalletIcon/icons/icon-metamask.png differ diff --git a/src/components/Header/components/WalletIcon/icons/icon-opera-touch.png b/src/components/Header/components/WalletIcon/icons/icon-opera-touch.png new file mode 100644 index 00000000..c925b772 Binary files /dev/null and b/src/components/Header/components/WalletIcon/icons/icon-opera-touch.png differ diff --git a/src/components/Header/components/WalletIcon/icons/icon-opera.png b/src/components/Header/components/WalletIcon/icons/icon-opera.png new file mode 100644 index 00000000..02fc9630 Binary files /dev/null and b/src/components/Header/components/WalletIcon/icons/icon-opera.png differ diff --git a/src/components/Header/components/WalletIcon/icons/icon-portis.svg b/src/components/Header/components/WalletIcon/icons/icon-portis.svg new file mode 100644 index 00000000..6bda7082 --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-portis.svg @@ -0,0 +1 @@ + diff --git a/src/components/Header/components/WalletIcon/icons/icon-torus.svg b/src/components/Header/components/WalletIcon/icons/icon-torus.svg new file mode 100644 index 00000000..e1930217 --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-torus.svg @@ -0,0 +1,170 @@ + + diff --git a/src/components/Header/components/WalletIcon/icons/icon-trezor.svg b/src/components/Header/components/WalletIcon/icons/icon-trezor.svg new file mode 100644 index 00000000..894808a1 --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-trezor.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/Header/components/WalletIcon/icons/icon-trust.svg b/src/components/Header/components/WalletIcon/icons/icon-trust.svg new file mode 100644 index 00000000..348434a2 --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-trust.svg @@ -0,0 +1,7 @@ + + + diff --git a/src/components/Header/components/WalletIcon/icons/icon-unilogin.svg b/src/components/Header/components/WalletIcon/icons/icon-unilogin.svg new file mode 100644 index 00000000..5fb7355c --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-unilogin.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/Header/components/WalletIcon/icons/icon-wallet-connect.svg b/src/components/Header/components/WalletIcon/icons/icon-wallet-connect.svg new file mode 100644 index 00000000..c26556ce --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/icon-wallet-connect.svg @@ -0,0 +1,9 @@ + + + diff --git a/src/components/Header/components/WalletIcon/icons/index.ts b/src/components/Header/components/WalletIcon/icons/index.ts new file mode 100644 index 00000000..541f7cbb --- /dev/null +++ b/src/components/Header/components/WalletIcon/icons/index.ts @@ -0,0 +1,79 @@ +// Icons +import metamaskIcon from './icon-metamask.png' +import walletConnectIcon from './icon-wallet-connect.svg' +import trezorIcon from './icon-trezor.svg' +import ledgerIcon from './icon-ledger.svg' +import dapperIcon from './icon-dapper.png' +import fortmaticIcon from './icon-fortmatic.svg' +import portisIcon from './icon-portis.svg' +import authereumIcon from './icon-authereum.png' +import torusIcon from './icon-torus.svg' +import uniloginIcon from './icon-unilogin.svg' +import coinbaseIcon from './icon-coinbase.svg' +import operaIcon from './icon-opera.png' + +import { WALLET_PROVIDER } from 'src/logic/wallets/getWeb3' + +type WalletProviderNames = typeof WALLET_PROVIDER[keyof typeof WALLET_PROVIDER] + +interface IconValue { + src: string + height: number +} + +type WalletObjectsProps = { + [key in WalletProviderNames]: Tvalue +} + +const WALLET_ICONS: WalletObjectsProps = { + [WALLET_PROVIDER.METAMASK]: { + src: metamaskIcon, + height: 25, + }, + [WALLET_PROVIDER.WALLETCONNECT]: { + src: walletConnectIcon, + height: 25, + }, + [WALLET_PROVIDER.TREZOR]: { + src: trezorIcon, + height: 25, + }, + [WALLET_PROVIDER.LEDGER]: { + src: ledgerIcon, + height: 25, + }, + [WALLET_PROVIDER.DAPPER]: { + src: dapperIcon, + height: 25, + }, + [WALLET_PROVIDER.FORTMATIC]: { + src: fortmaticIcon, + height: 25, + }, + [WALLET_PROVIDER.PORTIS]: { + src: portisIcon, + height: 25, + }, + [WALLET_PROVIDER.AUTHEREUM]: { + src: authereumIcon, + height: 25, + }, + [WALLET_PROVIDER.TORUS]: { + src: torusIcon, + height: 30, + }, + [WALLET_PROVIDER.UNILOGIN]: { + src: uniloginIcon, + height: 25, + }, + [WALLET_PROVIDER.OPERA]: { + src: operaIcon, + height: 25, + }, + [WALLET_PROVIDER.WALLETLINK]: { + src: coinbaseIcon, + height: 25, + }, +} + +export default WALLET_ICONS diff --git a/src/components/Header/components/WalletIcon/index.tsx b/src/components/Header/components/WalletIcon/index.tsx new file mode 100644 index 00000000..01cf7267 --- /dev/null +++ b/src/components/Header/components/WalletIcon/index.tsx @@ -0,0 +1,37 @@ +import { makeStyles } from '@material-ui/core/styles' +import * as React from 'react' + +import Col from 'src/components/layout/Col' +import Img from 'src/components/layout/Img' +import WALLET_ICONS from './icons' + +const useStyles = makeStyles({ + container: { + marginLeft: '5px', + marginRight: '10px', + letterSpacing: '-0.5px', + }, + icon: { + maxWidth: 'none', + }, +}) + +interface WalletIconProps { + provider: string +} + +const WalletIcon = ({ provider }: WalletIconProps): React.ReactElement => { + const classes = useStyles() + return ( + + {provider} + + ) +} + +export default WalletIcon diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 7fa8242a..0b0def46 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -55,13 +55,13 @@ class HeaderComponent extends React.PureComponent { getProviderInfoBased = () => { const { hasError } = this.state - const { available, loaded, network, provider, userAddress } = this.props + const { available, loaded, provider, userAddress } = this.props if (hasError || !loaded) { return } - return + return } getProviderDetailsBased = () => { diff --git a/src/logic/wallets/getWeb3.ts b/src/logic/wallets/getWeb3.ts index a5ddbbc3..9febbc74 100644 --- a/src/logic/wallets/getWeb3.ts +++ b/src/logic/wallets/getWeb3.ts @@ -26,9 +26,11 @@ export const WALLET_PROVIDER = { PORTIS: 'PORTIS', FORTMATIC: 'FORTMATIC', SQUARELINK: 'SQUARELINK', + UNILOGIN: 'UNILOGIN', WALLETCONNECT: 'WALLETCONNECT', OPERA: 'OPERA', DAPPER: 'DAPPER', + WALLETLINK: 'WALLETLINK', AUTHEREUM: 'AUTHEREUM', LEDGER: 'LEDGER', TREZOR: 'TREZOR',