forked from 1Hive/gardens-ui
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathScreenError.js
More file actions
89 lines (84 loc) · 2.09 KB
/
ScreenError.js
File metadata and controls
89 lines (84 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import React, { useMemo, useRef } from 'react'
import PropTypes from 'prop-types'
import { GU, Link, textStyle, useTheme } from '@tecommons/ui'
import { UnsupportedChainError } from 'use-wallet'
import { getNetworkName } from '../../lib/web3-utils'
import connectionError from './assets/connection-error.png'
function AccountModuleErrorScreen({ error, onBack }) {
const theme = useTheme()
const elementRef = useRef()
const [title, secondary] = useMemo(() => {
if (error instanceof UnsupportedChainError) {
return [
'Wrong network',
`Please select the ${getNetworkName()} network in your wallet and try again.`,
]
}
return [
'Failed to enable your account',
'You can try another Ethereum wallet.',
]
}, [error])
return (
<section
ref={elementRef}
css={`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: ${2 * GU}px;
height: 100%;
`}
>
<div
css={`
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
`}
>
<div
css={`
position: relative;
width: 281px;
height: 188px;
background: 50% 50% / 100% 100% no-repeat url(${connectionError});
`}
/>
<h1
css={`
padding-top: ${2 * GU}px;
${textStyle('body1')};
font-weight: 600;
`}
>
{title}
</h1>
<p
css={`
width: ${36 * GU}px;
color: ${theme.surfaceContentSecondary};
`}
>
{secondary}
</p>
</div>
<div
css={`
flex-grow: 0;
`}
>
<Link onClick={onBack}>OK, try again</Link>
</div>
</section>
)
}
AccountModuleErrorScreen.propTypes = {
error: PropTypes.object,
onBack: PropTypes.func.isRequired,
}
export default AccountModuleErrorScreen