From 1de1d10cf6b823f075112f8f938963c95b7fd3ba Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 8 Feb 2024 12:01:36 -0800 Subject: Fix error screen on native, use `Not Found` for profile errors instead of `Oops!` (#2789) * remove unnecessary `` * show back header on profile error * use `Not Found` instead of `Oops` for account errors * use `Not Found` instead of `Oops` for account errors --- src/view/com/modals/ProfilePreview.tsx | 2 +- src/view/com/util/error/ErrorScreen.tsx | 98 ++++++++++++++++++--------------- src/view/screens/Profile.tsx | 31 +++++------ 3 files changed, 69 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/view/com/modals/ProfilePreview.tsx b/src/view/com/modals/ProfilePreview.tsx index 88b0df71d..1764b6b90 100644 --- a/src/view/com/modals/ProfilePreview.tsx +++ b/src/view/com/modals/ProfilePreview.tsx @@ -46,7 +46,7 @@ export function Component({did}: {did: string}) { if (profileError) { return ( diff --git a/src/view/com/util/error/ErrorScreen.tsx b/src/view/com/util/error/ErrorScreen.tsx index 45444331c..98fe6437b 100644 --- a/src/view/com/util/error/ErrorScreen.tsx +++ b/src/view/com/util/error/ErrorScreen.tsx @@ -11,6 +11,8 @@ import {Button} from '../forms/Button' import {CenteredView} from '../Views' import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {ViewHeader} from 'view/com/util/ViewHeader' +import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' export function ErrorScreen({ title, @@ -18,66 +20,72 @@ export function ErrorScreen({ details, onPressTryAgain, testID, + showHeader, }: { title: string message: string details?: string onPressTryAgain?: () => void testID?: string + showHeader?: boolean }) { const theme = useTheme() + const {isMobile} = useWebMediaQueries() const pal = usePalette('default') const {_} = useLingui() return ( - - - - - - - - {title} - - {message} - {details && ( - - {details} - - )} - {onPressTryAgain && ( - - + - )} - + + {title} + + {message} + {details && ( + + {details} + + )} + {onPressTryAgain && ( + + + + )} + + ) } diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 6d0f15d81..cc54ad3b2 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -50,6 +50,7 @@ interface SectionRef { type Props = NativeStackScreenProps export function ProfileScreen({route}: Props) { + const {_} = useLingui() const {currentAccount} = useSession() const name = route.params.name === 'me' ? currentAccount?.did : route.params.name @@ -97,14 +98,13 @@ export function ProfileScreen({route}: Props) { } if (resolveError || profileError) { return ( - - - + ) } if (profile && moderationOpts) { @@ -118,14 +118,13 @@ export function ProfileScreen({route}: Props) { } // should never happen return ( - - - + ) } -- cgit 1.4.1