-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathGenericErrorPage.tsx
98 lines (93 loc) · 4.4 KB
/
GenericErrorPage.tsx
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
90
91
92
93
94
95
96
97
98
import React from 'react';
import {useErrorBoundary} from 'react-error-boundary';
import {View} from 'react-native';
import LogoWordmark from '@assets/images/expensify-wordmark.svg';
import Button from '@components/Button';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import ImageSVG from '@components/ImageSVG';
import SafeAreaConsumer from '@components/SafeAreaConsumer';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
import ErrorBodyText from './ErrorBodyText';
function GenericErrorPage() {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
const {resetBoundary} = useErrorBoundary();
return (
<SafeAreaConsumer>
{({paddingBottom}) => (
<View style={[styles.flex1, styles.pt10, styles.ph5, StyleUtils.getErrorPageContainerStyle(Number(paddingBottom))]}>
<View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}>
<View>
<View style={styles.mb5}>
<Icon
src={Expensicons.Bug}
height={variables.componentSizeNormal}
width={variables.componentSizeNormal}
fill={theme.iconSuccessFill}
/>
</View>
<View style={styles.mb5}>
<Text style={[styles.textHeadline]}>{translate('genericErrorPage.title')}</Text>
</View>
<View style={styles.mb5}>
<ErrorBodyText />
<Text>
{`${translate('genericErrorPage.body.helpTextConcierge')} `}
<TextLink
href={`mailto:${CONST.EMAIL.CONCIERGE}`}
style={[styles.link]}
>
{CONST.EMAIL.CONCIERGE}
</TextLink>
</Text>
</View>
<View style={[styles.flexRow]}>
<View style={[styles.flex1, styles.flexRow]}>
<Button
success
medium
onPress={resetBoundary}
text={translate('genericErrorPage.refresh')}
style={styles.mr3}
/>
<Button
medium
onPress={() => {
Session.signOutAndRedirectToSignIn();
resetBoundary();
}}
text={translate('initialSettingsPage.signOut')}
/>
</View>
</View>
</View>
</View>
<View>
<View style={[styles.flex1, styles.flexRow, styles.justifyContentCenter]}>
<ImageSVG
contentFit="contain"
src={LogoWordmark}
height={30}
width={80}
fill={theme.text}
/>
</View>
</View>
</View>
)}
</SafeAreaConsumer>
);
}
GenericErrorPage.displayName = 'ErrorPage';
export default GenericErrorPage;