fix outage screen navigation

This commit is contained in:
Samuel Newman
2026-08-31 22:03:09 +03:00
committed by GitHub
parent e4e1987af9
commit c4ce54b3c7
+38 -12
View File
@@ -32,7 +32,6 @@ export function Error({
const {t: l} = useLingui() const {t: l} = useLingui()
const t = useTheme() const t = useTheme()
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
const goBack = useGoBack(onGoBack)
return ( return (
<Layout.Center <Layout.Center
@@ -72,24 +71,51 @@ export function Error({
{isRetrying && <ButtonIcon icon={Loader} />} {isRetrying && <ButtonIcon icon={Loader} />}
</Button> </Button>
)} )}
{!hideBackButton && ( {!hideBackButton && secondaryAction ? (
<Button <Button
variant="solid" variant="solid"
color={onRetry ? 'secondary' : 'primary'} color={onRetry ? 'secondary' : 'primary'}
label={ label={secondaryAction.accessibilityLabel ?? secondaryAction.label}
secondaryAction?.accessibilityLabel ?? onPress={secondaryAction.onPress}
secondaryAction?.label ??
l`Return to previous page`
}
onPress={secondaryAction?.onPress ?? goBack}
disabled={isRetrying} disabled={isRetrying}
size="large"> size="large">
<ButtonText> <ButtonText>{secondaryAction.label}</ButtonText>
{secondaryAction?.label ?? <Trans>Go Back</Trans>}
</ButtonText>
</Button> </Button>
)} ) : !hideBackButton ? (
<GoBackButton
hasRetry={Boolean(onRetry)}
isRetrying={isRetrying}
onGoBack={onGoBack}
/>
) : null}
</View> </View>
</Layout.Center> </Layout.Center>
) )
} }
function GoBackButton({
hasRetry,
isRetrying,
onGoBack,
}: {
hasRetry: boolean
isRetrying?: boolean
onGoBack?: () => unknown
}) {
const {t: l} = useLingui()
const goBack = useGoBack(onGoBack)
return (
<Button
variant="solid"
color={hasRetry ? 'secondary' : 'primary'}
label={l`Return to previous page`}
onPress={goBack}
disabled={isRetrying}
size="large">
<ButtonText>
<Trans>Go Back</Trans>
</ButtonText>
</Button>
)
}