Commit 794bbd88 authored by Ian Lapham's avatar Ian Lapham Committed by Noah Zinsmeister

Update to loading state for injected desktop browsers (#532)

* update injected loading state

* update styles

* update injected connector

* center spinner
parent fe82dcf2
...@@ -64,21 +64,15 @@ const CircleWrapper = styled.div` ...@@ -64,21 +64,15 @@ const CircleWrapper = styled.div`
const HeaderText = styled.div` const HeaderText = styled.div`
${({ theme }) => theme.flexRowNoWrap}; ${({ theme }) => theme.flexRowNoWrap};
color: ${props => (props.color === 'blue' ? ({ theme }) => theme.royalBlue : props.color)}; color: ${props => (props.color === 'blue' ? ({ theme }) => theme.royalBlue : ({ theme }) => theme.textColor)};
font-size: 1rem; font-size: 1rem;
font-weight: 500; font-weight: 500;
${({ theme }) => theme.mediaWidth.upToMedium`
font-size: 12px;
`};
` `
const SubHeader = styled.div` const SubHeader = styled.div`
color: ${({ theme }) => theme.textColor}; color: ${({ theme }) => theme.textColor};
margin-top: 10px; margin-top: 10px;
font-size: 12px; font-size: 12px;
${({ theme }) => theme.mediaWidth.upToMedium`
font-size: 10px;
`};
` `
const IconWrapper = styled.div` const IconWrapper = styled.div`
......
...@@ -64,13 +64,20 @@ const ErrorButton = styled.div` ...@@ -64,13 +64,20 @@ const ErrorButton = styled.div`
} }
` `
const LoadingWrapper = styled.div`
${({ theme }) => theme.flexRowNoWrap};
align-items: center;
justify-content: center;
`
export default function PendingView({ uri = '', size, connector, error = false, setPendingError, tryActivation }) { export default function PendingView({ uri = '', size, connector, error = false, setPendingError, tryActivation }) {
const isMetamask = window.ethereum && window.ethereum.isMetaMask const isMetamask = window.ethereum && window.ethereum.isMetaMask
return ( return (
<PendingSection> <PendingSection>
{!error && connector === walletconnect && <WalletConnectData size={size} uri={uri} />}
<LoadingMessage error={error}> <LoadingMessage error={error}>
<div> <LoadingWrapper>
{!error && <SpinnerWrapper src={Circle} />} {!error && <SpinnerWrapper src={Circle} />}
{error ? ( {error ? (
<ErrorGroup> <ErrorGroup>
...@@ -89,28 +96,31 @@ export default function PendingView({ uri = '', size, connector, error = false, ...@@ -89,28 +96,31 @@ export default function PendingView({ uri = '', size, connector, error = false,
) : ( ) : (
'Initializing...' 'Initializing...'
)} )}
</div> </LoadingWrapper>
</LoadingMessage> </LoadingMessage>
{!error && connector === walletconnect && <WalletConnectData size={size} uri={uri} />}
{Object.keys(SUPPORTED_WALLETS).map(key => { {Object.keys(SUPPORTED_WALLETS).map(key => {
const option = SUPPORTED_WALLETS[key] const option = SUPPORTED_WALLETS[key]
if (option.connector === connector) { if (option.connector === connector) {
if (option.connector === injected && isMetamask && option.name !== 'MetaMask') { if (option.connector === injected) {
return null if (isMetamask && option.name !== 'MetaMask') {
} else { return null
return ( }
<Option if (!isMetamask && option.name === 'MetaMask') {
key={key} return null
clickable={false} }
color={option.color}
header={option.name}
subheader={option.description}
icon={require('../../assets/images/' + option.iconName)}
/>
)
} }
return (
<Option
key={key}
clickable={false}
color={option.color}
header={option.name}
subheader={option.description}
icon={require('../../assets/images/' + option.iconName)}
/>
)
} }
return true return null
})} })}
</PendingSection> </PendingSection>
) )
......
...@@ -1922,10 +1922,10 @@ ...@@ -1922,10 +1922,10 @@
fortmatic "^1.0.0" fortmatic "^1.0.0"
tiny-invariant "^1.0.6" tiny-invariant "^1.0.6"
"@web3-react/injected-connector@6.0.0-beta.20": "@web3-react/injected-connector@^6.0.0-beta.21":
version "6.0.0-beta.20" version "6.0.0-beta.21"
resolved "https://registry.yarnpkg.com/@web3-react/injected-connector/-/injected-connector-6.0.0-beta.20.tgz#b04787a4f036eaa6eb4c5ea327bc941a9383303e" resolved "https://registry.yarnpkg.com/@web3-react/injected-connector/-/injected-connector-6.0.0-beta.21.tgz#6f200dbfe2fb212b79027b48c510246c6eba8bfd"
integrity sha512-uXVgSn8qUUEFd0figiaxHY9yF5RenpHx4sUDxTjAZrSUwkg2jPBoV7BjPcXPP2LGwqVzFDL4059usNXSV1FVqg== integrity sha512-B83mz+8uCSyjqndA+E72FffXj29VlBMNey4aNjMsXkcgjgOOhcYQ8e0LZjZo48fdetYuXD4ZimqnGicb3jtbXg==
dependencies: dependencies:
"@web3-react/abstract-connector" "^6.0.0-beta.19" "@web3-react/abstract-connector" "^6.0.0-beta.19"
"@web3-react/types" "^6.0.0-beta.19" "@web3-react/types" "^6.0.0-beta.19"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment