Fix alignment of error screen (#10763)
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {msg} from '@lingui/core/macro'
|
import {Trans, useLingui} from '@lingui/react/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
|
||||||
import {Trans} from '@lingui/react/macro'
|
|
||||||
|
|
||||||
import {useGoBack} from '#/lib/hooks/useGoBack'
|
import {useGoBack} from '#/lib/hooks/useGoBack'
|
||||||
import {CenteredView} from '#/view/com/util/Views'
|
|
||||||
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
|
import * as Layout from '#/components/Layout'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export function Error({
|
export function Error({
|
||||||
@@ -15,22 +13,20 @@ export function Error({
|
|||||||
onRetry,
|
onRetry,
|
||||||
onGoBack,
|
onGoBack,
|
||||||
hideBackButton,
|
hideBackButton,
|
||||||
sideBorders = true,
|
|
||||||
}: {
|
}: {
|
||||||
title?: string
|
title?: string
|
||||||
message?: string
|
message?: string
|
||||||
onRetry?: () => unknown
|
onRetry?: () => unknown
|
||||||
onGoBack?: () => unknown
|
onGoBack?: () => unknown
|
||||||
hideBackButton?: boolean
|
hideBackButton?: boolean
|
||||||
sideBorders?: boolean
|
|
||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {t: l} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const goBack = useGoBack(onGoBack)
|
const goBack = useGoBack(onGoBack)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CenteredView
|
<Layout.Center
|
||||||
style={[
|
style={[
|
||||||
a.h_full_vh,
|
a.h_full_vh,
|
||||||
a.align_center,
|
a.align_center,
|
||||||
@@ -38,8 +34,7 @@ export function Error({
|
|||||||
!gtMobile && a.justify_between,
|
!gtMobile && a.justify_between,
|
||||||
t.atoms.border_contrast_low,
|
t.atoms.border_contrast_low,
|
||||||
{paddingTop: 175, paddingBottom: 110},
|
{paddingTop: 175, paddingBottom: 110},
|
||||||
]}
|
]}>
|
||||||
sideBorders={sideBorders}>
|
|
||||||
<View style={[a.w_full, a.align_center, a.gap_lg]}>
|
<View style={[a.w_full, a.align_center, a.gap_lg]}>
|
||||||
<Text style={[a.font_semi_bold, a.text_3xl]}>{title}</Text>
|
<Text style={[a.font_semi_bold, a.text_3xl]}>{title}</Text>
|
||||||
<Text
|
<Text
|
||||||
@@ -58,7 +53,7 @@ export function Error({
|
|||||||
<Button
|
<Button
|
||||||
variant="solid"
|
variant="solid"
|
||||||
color="primary"
|
color="primary"
|
||||||
label={_(msg`Press to retry`)}
|
label={l`Press to retry`}
|
||||||
onPress={onRetry}
|
onPress={onRetry}
|
||||||
size="large">
|
size="large">
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
@@ -70,7 +65,7 @@ export function Error({
|
|||||||
<Button
|
<Button
|
||||||
variant="solid"
|
variant="solid"
|
||||||
color={onRetry ? 'secondary' : 'primary'}
|
color={onRetry ? 'secondary' : 'primary'}
|
||||||
label={_(msg`Return to previous page`)}
|
label={l`Return to previous page`}
|
||||||
onPress={goBack}
|
onPress={goBack}
|
||||||
size="large">
|
size="large">
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
@@ -79,6 +74,6 @@ export function Error({
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</CenteredView>
|
</Layout.Center>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ let ListMaybePlaceholder = ({
|
|||||||
message={errorMessage ?? _(msg`Something went wrong!`)}
|
message={errorMessage ?? _(msg`Something went wrong!`)}
|
||||||
onRetry={onRetry}
|
onRetry={onRetry}
|
||||||
onGoBack={onGoBack}
|
onGoBack={onGoBack}
|
||||||
sideBorders={sideBorders}
|
|
||||||
hideBackButton={hideBackButton}
|
hideBackButton={hideBackButton}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -226,7 +225,6 @@ let ListMaybePlaceholder = ({
|
|||||||
onRetry={onRetry}
|
onRetry={onRetry}
|
||||||
onGoBack={onGoBack}
|
onGoBack={onGoBack}
|
||||||
hideBackButton={hideBackButton}
|
hideBackButton={hideBackButton}
|
||||||
sideBorders={sideBorders}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ function Inner({convoId}: {convoId: string}) {
|
|||||||
title={l`Something went wrong`}
|
title={l`Something went wrong`}
|
||||||
message={l`We couldn't load this conversation`}
|
message={l`We couldn't load this conversation`}
|
||||||
onRetry={() => convoState.error.retry()}
|
onRetry={() => convoState.error.retry()}
|
||||||
sideBorders={false}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ function SettingsInner() {
|
|||||||
title={l`Something went wrong`}
|
title={l`Something went wrong`}
|
||||||
message={l`We couldn’t load this conversation’s settings`}
|
message={l`We couldn’t load this conversation’s settings`}
|
||||||
onRetry={() => convoState.error.retry()}
|
onRetry={() => convoState.error.retry()}
|
||||||
sideBorders={false}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ function JoinRequestsInner() {
|
|||||||
title={l`Something went wrong`}
|
title={l`Something went wrong`}
|
||||||
message={l`We couldn’t load this conversation’s join requests`}
|
message={l`We couldn’t load this conversation’s join requests`}
|
||||||
onRetry={() => convoState.error.retry()}
|
onRetry={() => convoState.error.retry()}
|
||||||
sideBorders={false}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user