Fix error screen on native, use `Not Found` for profile errors instead of `Oops!` (#2789)
* remove unnecessary `<CenterView>` * show back header on profile error * use `Not Found` instead of `Oops` for account errors * use `Not Found` instead of `Oops` for account errorszio/stable
parent
4041db31e2
commit
1de1d10cf6
|
@ -46,7 +46,7 @@ export function Component({did}: {did: string}) {
|
|||
if (profileError) {
|
||||
return (
|
||||
<ErrorScreen
|
||||
title={_(msg`Oops!`)}
|
||||
title={_(msg`Not Found`)}
|
||||
message={cleanError(profileError)}
|
||||
onPressTryAgain={refetchProfile}
|
||||
/>
|
||||
|
|
|
@ -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,18 +20,23 @@ 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 (
|
||||
<>
|
||||
{showHeader && isMobile && <ViewHeader title="Error" showBorder />}
|
||||
<CenteredView testID={testID} style={[styles.outer, pal.view]}>
|
||||
<View style={styles.errorIconContainer}>
|
||||
<View
|
||||
|
@ -78,6 +85,7 @@ export function ErrorScreen({
|
|||
</View>
|
||||
)}
|
||||
</CenteredView>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ interface SectionRef {
|
|||
|
||||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'Profile'>
|
||||
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 (
|
||||
<CenteredView>
|
||||
<ErrorScreen
|
||||
testID="profileErrorScreen"
|
||||
title="Oops!"
|
||||
title={profileError ? _(msg`Not Found`) : _(msg`Oops!`)}
|
||||
message={cleanError(resolveError || profileError)}
|
||||
onPressTryAgain={onPressTryAgain}
|
||||
showHeader
|
||||
/>
|
||||
</CenteredView>
|
||||
)
|
||||
}
|
||||
if (profile && moderationOpts) {
|
||||
|
@ -118,14 +118,13 @@ export function ProfileScreen({route}: Props) {
|
|||
}
|
||||
// should never happen
|
||||
return (
|
||||
<CenteredView>
|
||||
<ErrorScreen
|
||||
testID="profileErrorScreen"
|
||||
title="Oops!"
|
||||
message="Something went wrong and we're not sure what."
|
||||
onPressTryAgain={onPressTryAgain}
|
||||
showHeader
|
||||
/>
|
||||
</CenteredView>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue