run lingui codemod
This commit is contained in:
@@ -8,9 +8,7 @@ import {
|
|||||||
type ViewStyle,
|
type ViewStyle,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {type AppBskyGraphDefs} from '@atproto/api'
|
import {type AppBskyGraphDefs} from '@atproto/api'
|
||||||
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 {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
import {useGenerateStarterPackMutation} from '#/lib/generate-starterpack'
|
import {useGenerateStarterPackMutation} from '#/lib/generate-starterpack'
|
||||||
@@ -91,7 +89,7 @@ export function ProfileStarterPacks({
|
|||||||
const {isTabletOrDesktop} = useWebMediaQueries()
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
|
|
||||||
const items = data?.pages.flatMap(page => page.starterPacks)
|
const items = data?.pages.flatMap(page => page.starterPacks)
|
||||||
const {_} = useLingui()
|
const {t: l} = useLingui()
|
||||||
|
|
||||||
const EmptyComponent = useCallback(() => {
|
const EmptyComponent = useCallback(() => {
|
||||||
if (emptyStateMessage || emptyStateButton || emptyStateIcon) {
|
if (emptyStateMessage || emptyStateButton || emptyStateIcon) {
|
||||||
@@ -102,9 +100,7 @@ export function ProfileStarterPacks({
|
|||||||
iconSize="3xl"
|
iconSize="3xl"
|
||||||
message={
|
message={
|
||||||
emptyStateMessage ??
|
emptyStateMessage ??
|
||||||
_(
|
l`Starter packs let you share your favorite feeds and people with your friends.`
|
||||||
msg`Starter packs let you share your favorite feeds and people with your friends.`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
button={emptyStateButton}
|
button={emptyStateButton}
|
||||||
/>
|
/>
|
||||||
@@ -112,7 +108,7 @@ export function ProfileStarterPacks({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
return <Empty />
|
return <Empty />
|
||||||
}, [_, emptyStateMessage, emptyStateButton, emptyStateIcon])
|
}, [l, emptyStateMessage, emptyStateButton, emptyStateIcon])
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
scrollToTop: () => {},
|
scrollToTop: () => {},
|
||||||
@@ -169,13 +165,13 @@ export function ProfileStarterPacks({
|
|||||||
<ListFooter
|
<ListFooter
|
||||||
isFetchingNextPage={isFetchingNextPage}
|
isFetchingNextPage={isFetchingNextPage}
|
||||||
hasNextPage={hasNextPage}
|
hasNextPage={hasNextPage}
|
||||||
error={isError ? _(msg`Could not load more starter packs`) : undefined}
|
error={isError ? l`Could not load more starter packs` : undefined}
|
||||||
onRetry={fetchNextPage}
|
onRetry={fetchNextPage}
|
||||||
style={{paddingBottom: bottomBarOffset}}
|
style={{paddingBottom: bottomBarOffset}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}, [
|
}, [
|
||||||
_,
|
l,
|
||||||
data,
|
data,
|
||||||
items?.length,
|
items?.length,
|
||||||
isMe,
|
isMe,
|
||||||
@@ -214,7 +210,7 @@ export function ProfileStarterPacks({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function CreateAnother({style}: {style?: StyleProp<ViewStyle>}) {
|
function CreateAnother({style}: {style?: StyleProp<ViewStyle>}) {
|
||||||
const {_} = useLingui()
|
const {t: l} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
|
||||||
@@ -229,7 +225,7 @@ function CreateAnother({style}: {style?: StyleProp<ViewStyle>}) {
|
|||||||
style,
|
style,
|
||||||
]}>
|
]}>
|
||||||
<Button
|
<Button
|
||||||
label={_(msg`Create a starter pack`)}
|
label={l`Create a starter pack`}
|
||||||
variant="solid"
|
variant="solid"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -245,7 +241,7 @@ function CreateAnother({style}: {style?: StyleProp<ViewStyle>}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Empty() {
|
function Empty() {
|
||||||
const {_} = useLingui()
|
const {t: l} = useLingui()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const confirmDialogControl = useDialogControl()
|
const confirmDialogControl = useDialogControl()
|
||||||
const followersDialogControl = useDialogControl()
|
const followersDialogControl = useDialogControl()
|
||||||
@@ -325,7 +321,7 @@ function Empty() {
|
|||||||
</View>
|
</View>
|
||||||
<View style={[a.flex_row, a.gap_md, {marginLeft: 'auto'}]}>
|
<View style={[a.flex_row, a.gap_md, {marginLeft: 'auto'}]}>
|
||||||
<Button
|
<Button
|
||||||
label={_(msg`Create a starter pack for me`)}
|
label={l`Create a starter pack for me`}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -338,7 +334,7 @@ function Empty() {
|
|||||||
{isGenerating && <Loader size="md" />}
|
{isGenerating && <Loader size="md" />}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
label={_(msg`Create a starter pack`)}
|
label={l`Create a starter pack`}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -355,7 +351,6 @@ function Empty() {
|
|||||||
</ButtonText>
|
</ButtonText>
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Prompt.Outer control={confirmDialogControl}>
|
<Prompt.Outer control={confirmDialogControl}>
|
||||||
<Prompt.Content>
|
<Prompt.Content>
|
||||||
<Prompt.TitleText>
|
<Prompt.TitleText>
|
||||||
@@ -371,12 +366,12 @@ function Empty() {
|
|||||||
<Prompt.Actions>
|
<Prompt.Actions>
|
||||||
<Prompt.Action
|
<Prompt.Action
|
||||||
color="primary"
|
color="primary"
|
||||||
cta={_(msg`Choose for me`)}
|
cta={l`Choose for me`}
|
||||||
onPress={generate}
|
onPress={generate}
|
||||||
/>
|
/>
|
||||||
<Prompt.Action
|
<Prompt.Action
|
||||||
color="secondary"
|
color="secondary"
|
||||||
cta={_(msg`Let me choose`)}
|
cta={l`Let me choose`}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate('StarterPackWizard', {})
|
navigation.navigate('StarterPackWizard', {})
|
||||||
}}
|
}}
|
||||||
@@ -385,21 +380,17 @@ function Empty() {
|
|||||||
</Prompt.Outer>
|
</Prompt.Outer>
|
||||||
<Prompt.Basic
|
<Prompt.Basic
|
||||||
control={followersDialogControl}
|
control={followersDialogControl}
|
||||||
title={_(msg`Oops!`)}
|
title={l`Oops!`}
|
||||||
description={_(
|
description={l`You must be following at least seven other people to generate a starter pack.`}
|
||||||
msg`You must be following at least seven other people to generate a starter pack.`,
|
|
||||||
)}
|
|
||||||
onConfirm={() => {}}
|
onConfirm={() => {}}
|
||||||
showCancel={false}
|
showCancel={false}
|
||||||
/>
|
/>
|
||||||
<Prompt.Basic
|
<Prompt.Basic
|
||||||
control={errorDialogControl}
|
control={errorDialogControl}
|
||||||
title={_(msg`Oops!`)}
|
title={l`Oops!`}
|
||||||
description={_(
|
description={l`An error occurred while generating your starter pack. Want to try again?`}
|
||||||
msg`An error occurred while generating your starter pack. Want to try again?`,
|
|
||||||
)}
|
|
||||||
onConfirm={generate}
|
onConfirm={generate}
|
||||||
confirmButtonCta={_(msg`Retry`)}
|
confirmButtonCta={l`Retry`}
|
||||||
/>
|
/>
|
||||||
</LinearGradientBackground>
|
</LinearGradientBackground>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user