Feedback PR

This commit is contained in:
Mati Dastugue 2020-07-17 12:21:05 -03:00
parent 141ffd7eab
commit 0237de751f
7 changed files with 11 additions and 26 deletions

View File

@ -1,4 +1,4 @@
import { withStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
import * as React from 'react' import * as React from 'react'
import NetworkLabel from '../NetworkLabel' import NetworkLabel from '../NetworkLabel'
@ -10,7 +10,7 @@ import { shortVersionOf } from 'src/logic/wallets/ethAddresses'
import WalletIcon from '../WalletIcon' import WalletIcon from '../WalletIcon'
import { connected as connectedBg, screenSm, sm } from 'src/theme/variables' import { connected as connectedBg, screenSm, sm } from 'src/theme/variables'
const styles = () => ({ const useStyles = makeStyles({
network: { network: {
fontFamily: 'Averta, sans-serif', fontFamily: 'Averta, sans-serif',
}, },
@ -61,13 +61,13 @@ const styles = () => ({
}) })
interface ProviderInfoProps { interface ProviderInfoProps {
classes: Record<string, any>
connected: boolean connected: boolean
provider: string provider: string
userAddress: string userAddress: string
} }
const ProviderInfo: React.FC<ProviderInfoProps> = ({ classes, connected, provider, userAddress }) => { const ProviderInfo = ({ connected, provider, userAddress }: ProviderInfoProps): React.ReactElement => {
const classes = useStyles()
const cutAddress = connected ? shortVersionOf(userAddress, 4) : 'Connection Error' const cutAddress = connected ? shortVersionOf(userAddress, 4) : 'Connection Error'
const color = connected ? 'primary' : 'warning' const color = connected ? 'primary' : 'warning'
const identiconAddress = userAddress || 'random' const identiconAddress = userAddress || 'random'
@ -101,4 +101,4 @@ const ProviderInfo: React.FC<ProviderInfoProps> = ({ classes, connected, provide
) )
} }
export default withStyles(styles as any)(ProviderInfo) export default ProviderInfo

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,11 +1,9 @@
// Icons // Icons
import metamaskIcon from './icon-metamask.png' import metamaskIcon from './icon-metamask.png'
import metamaskIcon2x from './icon-metamask@2x.png'
import walletConnectIcon from './icon-wallet-connect.svg' import walletConnectIcon from './icon-wallet-connect.svg'
import trezorIcon from './icon-trezor.svg' import trezorIcon from './icon-trezor.svg'
import ledgerIcon from './icon-ledger.svg' import ledgerIcon from './icon-ledger.svg'
import dapperIcon from './icon-dapper.png' import dapperIcon from './icon-dapper.png'
import dapperIcon2x from './icon-dapper@2x.png'
import fortmaticIcon from './icon-fortmatic.svg' import fortmaticIcon from './icon-fortmatic.svg'
import portisIcon from './icon-portis.svg' import portisIcon from './icon-portis.svg'
import authereumIcon from './icon-authereum.png' import authereumIcon from './icon-authereum.png'
@ -13,79 +11,67 @@ import torusIcon from './icon-torus.svg'
import uniloginIcon from './icon-unilogin.svg' import uniloginIcon from './icon-unilogin.svg'
import coinbaseIcon from './icon-coinbase.svg' import coinbaseIcon from './icon-coinbase.svg'
import operaIcon from './icon-opera.png' import operaIcon from './icon-opera.png'
import operaIcon2x from './icon-opera@2x.png'
import { WALLET_PROVIDER } from 'src/logic/wallets/getWeb3' import { WALLET_PROVIDER } from 'src/logic/wallets/getWeb3'
interface WalletObjectsProps<TValue> { type WalletProviderNames = typeof WALLET_PROVIDER[keyof typeof WALLET_PROVIDER]
[key: string]: TValue
}
interface IconValue { interface IconValue {
src: string src: string
srcSet: string
height: number height: number
} }
type WalletObjectsProps<Tvalue> = {
[key in WalletProviderNames]: Tvalue
}
const WALLET_ICONS: WalletObjectsProps<IconValue> = { const WALLET_ICONS: WalletObjectsProps<IconValue> = {
[WALLET_PROVIDER.METAMASK]: { [WALLET_PROVIDER.METAMASK]: {
src: metamaskIcon, src: metamaskIcon,
srcSet: metamaskIcon2x,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.WALLETCONNECT]: { [WALLET_PROVIDER.WALLETCONNECT]: {
src: walletConnectIcon, src: walletConnectIcon,
srcSet: walletConnectIcon,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.TREZOR]: { [WALLET_PROVIDER.TREZOR]: {
src: trezorIcon, src: trezorIcon,
srcSet: trezorIcon,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.LEDGER]: { [WALLET_PROVIDER.LEDGER]: {
src: ledgerIcon, src: ledgerIcon,
srcSet: ledgerIcon,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.DAPPER]: { [WALLET_PROVIDER.DAPPER]: {
src: dapperIcon, src: dapperIcon,
srcSet: dapperIcon2x,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.FORTMATIC]: { [WALLET_PROVIDER.FORTMATIC]: {
src: fortmaticIcon, src: fortmaticIcon,
srcSet: fortmaticIcon,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.PORTIS]: { [WALLET_PROVIDER.PORTIS]: {
src: portisIcon, src: portisIcon,
srcSet: portisIcon,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.AUTHEREUM]: { [WALLET_PROVIDER.AUTHEREUM]: {
src: authereumIcon, src: authereumIcon,
srcSet: authereumIcon,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.TORUS]: { [WALLET_PROVIDER.TORUS]: {
src: torusIcon, src: torusIcon,
srcSet: torusIcon,
height: 30, height: 30,
}, },
[WALLET_PROVIDER.UNILOGIN]: { [WALLET_PROVIDER.UNILOGIN]: {
src: uniloginIcon, src: uniloginIcon,
srcSet: uniloginIcon,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.OPERA]: { [WALLET_PROVIDER.OPERA]: {
src: operaIcon, src: operaIcon,
srcSet: operaIcon2x,
height: 25, height: 25,
}, },
[WALLET_PROVIDER.WALLETLINK]: { [WALLET_PROVIDER.WALLETLINK]: {
src: coinbaseIcon, src: coinbaseIcon,
srcSet: coinbaseIcon,
height: 25, height: 25,
}, },
} }

View File

@ -20,7 +20,7 @@ interface WalletIconProps {
provider: string provider: string
} }
const WalletIcon: React.FC<WalletIconProps> = ({ provider }) => { const WalletIcon = ({ provider }: WalletIconProps): React.ReactElement => {
const classes = useStyles() const classes = useStyles()
return ( return (
<Col className={classes.container} layout="column" start="sm"> <Col className={classes.container} layout="column" start="sm">
@ -29,7 +29,6 @@ const WalletIcon: React.FC<WalletIconProps> = ({ provider }) => {
className={classes.icon} className={classes.icon}
height={WALLET_ICONS[provider].height} height={WALLET_ICONS[provider].height}
src={WALLET_ICONS[provider].src} src={WALLET_ICONS[provider].src}
srcSet={WALLET_ICONS[provider].srcSet}
/> />
</Col> </Col>
) )