forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 💫
1import {useCallback} from 'react'
2import {StyleSheet, View} from 'react-native'
3import {msg} from '@lingui/core/macro'
4import {useLingui} from '@lingui/react'
5import {Trans} from '@lingui/react/macro'
6import {StackActions, useNavigation} from '@react-navigation/native'
7
8import {usePalette} from '#/lib/hooks/usePalette'
9import {type NavigationProp} from '#/lib/routes/types'
10import {s} from '#/lib/styles'
11import {Button} from '#/view/com/util/forms/Button'
12import {Text} from '#/view/com/util/text/Text'
13import {ViewHeader} from '#/view/com/util/ViewHeader'
14import * as Layout from '#/components/Layout'
15
16export const NotFoundScreen = () => {
17 const pal = usePalette('default')
18 const {_} = useLingui()
19 const navigation = useNavigation<NavigationProp>()
20
21 const canGoBack = navigation.canGoBack()
22 const onPressHome = useCallback(() => {
23 if (canGoBack) {
24 navigation.goBack()
25 } else {
26 navigation.navigate('HomeTab')
27 navigation.dispatch(StackActions.popToTop())
28 }
29 }, [navigation, canGoBack])
30
31 return (
32 <Layout.Screen testID="notFoundView">
33 <ViewHeader title={_(msg`Page Not Found`)} />
34 <View style={styles.container}>
35 <Text type="title-2xl" style={[pal.text, s.mb10]}>
36 <Trans>Page not found</Trans>
37 </Text>
38 <Text type="md" style={[pal.text, s.mb10]}>
39 <Trans>
40 We're sorry! We can't find the page you were looking for.
41 </Trans>
42 </Text>
43 <Button
44 type="primary"
45 label={canGoBack ? _(msg`Go Back`) : _(msg`Go Home`)}
46 accessibilityLabel={canGoBack ? _(msg`Go back`) : _(msg`Go home`)}
47 accessibilityHint={
48 canGoBack
49 ? _(msg`Returns to previous page`)
50 : _(msg`Returns to home page`)
51 }
52 onPress={onPressHome}
53 />
54 </View>
55 </Layout.Screen>
56 )
57}
58
59const styles = StyleSheet.create({
60 container: {
61 paddingTop: 100,
62 paddingHorizontal: 20,
63 alignItems: 'center',
64 height: '100%',
65 },
66})