forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import React from 'react'
2import {View} from 'react-native'
3import {msg} from '@lingui/core/macro'
4import {useLingui} from '@lingui/react'
5import {Trans} from '@lingui/react/macro'
6import {useNavigation} from '@react-navigation/native'
7
8import {type NavigationProp} from '#/lib/routes/types'
9import {atoms as a, useTheme} from '#/alf'
10import {Button, ButtonText} from '#/components/Button'
11import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
12import {Text} from '#/components/Typography'
13
14export function ErrorState({error}: {error: string}) {
15 const t = useTheme()
16 const {_} = useLingui()
17 const navigation = useNavigation<NavigationProp>()
18
19 const onPressBack = React.useCallback(() => {
20 if (navigation.canGoBack()) {
21 navigation.goBack()
22 } else {
23 navigation.navigate('Home')
24 }
25 }, [navigation])
26
27 return (
28 <View style={[a.px_xl]}>
29 <CircleInfo width={48} style={[t.atoms.text_contrast_low]} />
30
31 <Text style={[a.text_xl, a.font_semi_bold, a.pb_md, a.pt_xl]}>
32 <Trans>Hmmmm, we couldn't load that moderation service.</Trans>
33 </Text>
34 <Text
35 style={[
36 a.text_md,
37 a.leading_normal,
38 a.pb_md,
39 t.atoms.text_contrast_medium,
40 ]}>
41 <Trans>
42 This moderation service is unavailable. See below for more details. If
43 this issue persists, contact us.
44 </Trans>
45 </Text>
46 <View
47 style={[
48 a.relative,
49 a.py_md,
50 a.px_lg,
51 a.rounded_md,
52 a.mb_2xl,
53 t.atoms.bg_contrast_25,
54 ]}>
55 <Text style={[a.text_md, a.leading_normal]}>{error}</Text>
56 </View>
57
58 <View style={{flexDirection: 'row'}}>
59 <Button
60 size="small"
61 color="secondary"
62 variant="solid"
63 label={_(msg`Go Back`)}
64 accessibilityHint="Returns to previous page"
65 onPress={onPressBack}>
66 <ButtonText>
67 <Trans>Go Back</Trans>
68 </ButtonText>
69 </Button>
70 </View>
71 </View>
72 )
73}