Update Lists.tsx

zio/stable
Minseo Lee 2024-03-02 13:26:21 +09:00
parent ab2b454be8
commit d0438b6b28
1 changed files with 10 additions and 7 deletions

View File

@ -2,7 +2,8 @@ import React from 'react'
import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {View} from 'react-native' import {View} from 'react-native'
import {Loader} from '#/components/Loader' import {Loader} from '#/components/Loader'
import {Trans} from '@lingui/macro' import {Trans, msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {cleanError} from 'lib/strings/errors' import {cleanError} from 'lib/strings/errors'
import {Button} from '#/components/Button' import {Button} from '#/components/Button'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@ -58,6 +59,7 @@ function ListFooterMaybeError({
onRetry?: () => Promise<unknown> onRetry?: () => Promise<unknown>
}) { }) {
const t = useTheme() const t = useTheme()
const {_} = useLingui()
if (!isError) return null if (!isError) return null
@ -83,7 +85,7 @@ function ListFooterMaybeError({
</Text> </Text>
<Button <Button
variant="gradient" variant="gradient"
label="Press to retry" label={_(msg`Press to retry`)}
style={[ style={[
a.align_center, a.align_center,
a.justify_center, a.justify_center,
@ -93,7 +95,7 @@ function ListFooterMaybeError({
a.py_sm, a.py_sm,
]} ]}
onPress={onRetry}> onPress={onRetry}>
Retry <Trans>Retry</Trans>
</Button> </Button>
</View> </View>
</View> </View>
@ -144,6 +146,7 @@ export function ListMaybePlaceholder({
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const t = useTheme() const t = useTheme()
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
const {_} = useLingui()
const canGoBack = navigation.canGoBack() const canGoBack = navigation.canGoBack()
const onGoBack = React.useCallback(() => { const onGoBack = React.useCallback(() => {
@ -218,7 +221,7 @@ export function ListMaybePlaceholder({
<Button <Button
variant="solid" variant="solid"
color="primary" color="primary"
label="Click here" label={_(msg`Click here`)}
onPress={onRetry} onPress={onRetry}
size="large" size="large"
style={[ style={[
@ -226,17 +229,17 @@ export function ListMaybePlaceholder({
a.overflow_hidden, a.overflow_hidden,
{paddingVertical: 10}, {paddingVertical: 10},
]}> ]}>
Retry <Trans>Retry</Trans>
</Button> </Button>
)} )}
<Button <Button
variant="solid" variant="solid"
color={isError && onRetry ? 'secondary' : 'primary'} color={isError && onRetry ? 'secondary' : 'primary'}
label="Click here" label={_(msg`Click here`)}
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 <Trans>Go Back</Trans>
</Button> </Button>
</View> </View>
</> </>