Mark `Retry` and `Go Back` buttons in Error.tsx for localisation (#3352)

* Mark `Retry` and `Go Back` buttons in Error.tsx for localisation

* add and sort imports

* sort imports better
zio/stable
surfdude29 2024-03-30 00:51:35 +00:00 committed by GitHub
parent ef24611a1f
commit 69217f9a09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 9 deletions

View File

@ -1,13 +1,15 @@
import React from 'react' import React from 'react'
import {View} from 'react-native'
import {useNavigation} from '@react-navigation/core'
import {StackActions} from '@react-navigation/native'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {NavigationProp} from 'lib/routes/types'
import {CenteredView} from 'view/com/util/Views' 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 {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import {View} from 'react-native'
import {Button} from '#/components/Button'
import {useNavigation} from '@react-navigation/core'
import {NavigationProp} from 'lib/routes/types'
import {StackActions} from '@react-navigation/native'
import {router} from '#/routes' import {router} from '#/routes'
export function Error({ export function Error({
@ -20,6 +22,7 @@ export function Error({
onRetry?: () => unknown onRetry?: () => unknown
}) { }) {
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const {_} = useLingui()
const t = useTheme() const t = useTheme()
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
@ -68,21 +71,25 @@ export function Error({
<Button <Button
variant="solid" variant="solid"
color="primary" color="primary"
label="Click here" label={_(msg`Press to retry`)}
onPress={onRetry} onPress={onRetry}
size="large" size="large"
style={[a.rounded_sm, a.overflow_hidden, {paddingVertical: 10}]}> style={[a.rounded_sm, a.overflow_hidden, {paddingVertical: 10}]}>
Retry <ButtonText>
<Trans>Retry</Trans>
</ButtonText>
</Button> </Button>
)} )}
<Button <Button
variant="solid" variant="solid"
color={onRetry ? 'secondary' : 'primary'} color={onRetry ? 'secondary' : 'primary'}
label="Click here" label={_(msg`Return to previous page`)}
onPress={onGoBack} onPress={onGoBack}
size="large" size="large"
style={[a.rounded_sm, a.overflow_hidden, {paddingVertical: 10}]}> style={[a.rounded_sm, a.overflow_hidden, {paddingVertical: 10}]}>
Go Back <ButtonText>
<Trans>Go Back</Trans>
</ButtonText>
</Button> </Button>
</View> </View>
</CenteredView> </CenteredView>