diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json index 9315e29b97..5dc218ca4b 100644 --- a/oxlint-suppressions.json +++ b/oxlint-suppressions.json @@ -296,19 +296,6 @@ "count": 1 } }, - "src/components/StarterPack/Main/ProfilesList.tsx": { - "typescript/no-misused-promises": { - "count": 1 - } - }, - "src/components/StarterPack/ProfileStarterPacks.tsx": { - "typescript/no-explicit-any": { - "count": 1 - }, - "typescript/no-misused-promises": { - "count": 2 - } - }, "src/components/StarterPack/QrCodeDialog.tsx": { "typescript/no-floating-promises": { "count": 5 @@ -398,21 +385,11 @@ "count": 1 } }, - "src/components/dialogs/StarterPackDialog.tsx": { - "typescript/no-misused-promises": { - "count": 1 - } - }, "src/components/dialogs/SwitchAccount.tsx": { "typescript/no-floating-promises": { "count": 1 } }, - "src/components/dialogs/lists/CreateListFromStarterPackDialog.tsx": { - "typescript/no-floating-promises": { - "count": 2 - } - }, "src/components/dialogs/lists/CreateOrEditListDialog.tsx": { "typescript/no-explicit-any": { "count": 2 @@ -857,14 +834,6 @@ "count": 1 } }, - "src/screens/ProfileList/components/MoreOptionsMenu.tsx": { - "typescript/no-floating-promises": { - "count": 1 - }, - "typescript/no-misused-promises": { - "count": 5 - } - }, "src/screens/ProfileList/components/SubscribeMenu.tsx": { "typescript/no-misused-promises": { "count": 2 @@ -996,22 +965,6 @@ "count": 1 } }, - "src/screens/StarterPack/StarterPackScreen.tsx": { - "typescript/no-floating-promises": { - "count": 1 - }, - "typescript/require-await": { - "count": 1 - } - }, - "src/screens/StarterPack/Wizard/index.tsx": { - "typescript/no-floating-promises": { - "count": 2 - }, - "typescript/require-await": { - "count": 1 - } - }, "src/state/a11y.tsx": { "typescript/no-floating-promises": { "count": 1 @@ -1233,11 +1186,6 @@ "count": 2 } }, - "src/state/queries/starter-packs.ts": { - "typescript/require-await": { - "count": 1 - } - }, "src/state/queries/suggested-follows.ts": { "no-unused-vars": { "count": 1 diff --git a/src/Navigation.tsx b/src/Navigation.tsx index b0034aaff1..1aa3c9e4fd 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -575,12 +575,12 @@ function commonScreens(Stack: typeof Flat, unreadCountLabel?: string) { Wizard} - options={{title: title(msg`Create a starter pack`), requireAuth: true}} + options={{title: title(msg`Create a Starter Pack`), requireAuth: true}} /> Wizard} - options={{title: title(msg`Edit your starter pack`), requireAuth: true}} + options={{title: title(msg`Edit your Starter Pack`), requireAuth: true}} /> ( ) } + const onRefresh = async () => { + setIsPTRing(true) + await refetch() + setIsPTRing(false) + } + if (!data) { return ( ( desktopFixedHeight initialNumToRender={initialNumToRender} refreshing={isPTRing} - onRefresh={async () => { - setIsPTRing(true) - await refetch() - setIsPTRing(false) - }} + onRefresh={() => void onRefresh()} /> ) }, @@ -159,14 +160,14 @@ function OptedOutControls({ listUri: string canRemove: boolean }) { - const {_} = useLingui() + const {t: l} = useLingui() const ax = useAnalytics() const [isRemoved, setIsRemoved] = useState(false) const {mutate: removeMembership, isPending} = useListMembershipRemoveMutation( { onSuccess: () => { setIsRemoved(true) - Toast.show(_(msg`Removed from starter pack`)) + Toast.show(l`Removed from Starter Pack`) }, onError: error => Toast.show(cleanError(error), { @@ -183,12 +184,12 @@ function OptedOutControls({ - Opted out of this starter pack + Opted out of this Starter Pack {canRemove ? ( { diff --git a/src/components/StarterPack/ProfileStarterPacks.tsx b/src/components/StarterPack/ProfileStarterPacks.tsx index 4555c6ec4b..67e600fe3f 100644 --- a/src/components/StarterPack/ProfileStarterPacks.tsx +++ b/src/components/StarterPack/ProfileStarterPacks.tsx @@ -6,9 +6,7 @@ import { View, type ViewStyle, } from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' +import {Trans, useLingui} from '@lingui/react/macro' import {useNavigation} from '@react-navigation/native' import {useGenerateStarterPackMutation} from '#/lib/generate-starterpack' @@ -54,7 +52,7 @@ interface ProfileFeedgensProps { isMe: boolean emptyStateMessage?: string emptyStateButton?: EmptyStateButtonProps - emptyStateIcon?: React.ComponentType | React.ReactElement + emptyStateIcon?: React.ComponentType | React.ReactElement } function keyExtractor(item: app.bsky.graph.defs.StarterPackViewBasic) { @@ -90,7 +88,7 @@ export function ProfileStarterPacks({ const {isTabletOrDesktop} = useWebMediaQueries() const items = data?.pages.flatMap(page => page.starterPacks) - const {_} = useLingui() + const {t: l} = useLingui() const EmptyComponent = useCallback(() => { if (emptyStateMessage || emptyStateButton || emptyStateIcon) { @@ -101,9 +99,7 @@ export function ProfileStarterPacks({ iconSize="3xl" message={ emptyStateMessage ?? - _( - msg`Starter packs let you share your favorite feeds and people with your friends.`, - ) + l`Starter Packs let you share your favorite feeds and people with your friends.` } button={emptyStateButton} /> @@ -111,7 +107,7 @@ export function ProfileStarterPacks({ ) } return - }, [_, emptyStateMessage, emptyStateButton, emptyStateIcon]) + }, [l, emptyStateMessage, emptyStateButton, emptyStateIcon]) useImperativeHandle(ref, () => ({ scrollToTop: () => {}, @@ -122,7 +118,7 @@ export function ProfileStarterPacks({ try { await refetch() } catch (err) { - logger.error('Failed to refresh starter packs', {message: err}) + logger.error('Failed to refresh Starter Packs', {message: err}) } setIsPTRing(false) }, [refetch, setIsPTRing]) @@ -132,7 +128,7 @@ export function ProfileStarterPacks({ try { await fetchNextPage() } catch (err) { - logger.error('Failed to load more starter packs', {message: err}) + logger.error('Failed to load more Starter Packs', {message: err}) } }, [isFetchingNextPage, hasNextPage, isError, fetchNextPage]) @@ -179,8 +175,8 @@ export function ProfileStarterPacks({ }} removeClippedSubviews={true} desktopFixedHeight - onEndReached={onEndReached} - onRefresh={onRefresh} + onEndReached={() => void onEndReached()} + onRefresh={() => void onRefresh()} ListEmptyComponent={ data ? (isMe ? EmptyComponent : undefined) : FeedLoadingPlaceholder } @@ -193,7 +189,7 @@ export function ProfileStarterPacks({ } function CreateAnother() { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const navigation = useNavigation() @@ -207,7 +203,7 @@ function CreateAnother() { t.atoms.border_contrast_low, ]}> - - Generate a starter pack + Generate a Starter Pack @@ -349,12 +344,12 @@ function Empty() { { navigation.navigate('StarterPackWizard', {}) }} @@ -363,21 +358,17 @@ function Empty() { {}} showCancel={false} /> ) diff --git a/src/components/StarterPack/QrCodeDialog.tsx b/src/components/StarterPack/QrCodeDialog.tsx index 5ff6213825..95c2a51223 100644 --- a/src/components/StarterPack/QrCodeDialog.tsx +++ b/src/components/StarterPack/QrCodeDialog.tsx @@ -164,7 +164,7 @@ export function QrCodeDialog({ + label={_(msg`Create a QR code for a Starter Pack`)}> }> {!link ? ( diff --git a/src/components/StarterPack/ShareDialog.tsx b/src/components/StarterPack/ShareDialog.tsx index 53248bec24..8db64dfb29 100644 --- a/src/components/StarterPack/ShareDialog.tsx +++ b/src/components/StarterPack/ShareDialog.tsx @@ -81,11 +81,11 @@ function ShareDialogInner({ - Invite people to this starter pack! + Invite people to this Starter Pack! - Share this starter pack and help people join your community on + Share this Starter Pack and help people join your community on Bluesky. diff --git a/src/components/StarterPack/StarterPackCard.tsx b/src/components/StarterPack/StarterPackCard.tsx index 9c3def0adb..b8d582902a 100644 --- a/src/components/StarterPack/StarterPackCard.tsx +++ b/src/components/StarterPack/StarterPackCard.tsx @@ -2,9 +2,7 @@ import {useMemo} from 'react' import {View} from 'react-native' import {Image} from 'expo-image' import {AtUri} from '@atproto/syntax' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Plural, Trans} from '@lingui/react/macro' +import {Plural, Trans, useLingui} from '@lingui/react/macro' import {useQueryClient} from '@tanstack/react-query' import {sanitizeHandle} from '#/lib/strings/handles' @@ -59,7 +57,7 @@ export function Card({ }) { const {record, creator, joinedAllTimeCount} = starterPack - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const {currentAccount} = useSession() const isOwnStarterPack = creator?.did === currentAccount?.did @@ -84,8 +82,8 @@ export function Card({ style={[a.leading_snug, t.atoms.text_contrast_medium]} numberOfLines={1}> {isOwnStarterPack - ? _(msg`Starter pack by you`) - : _(msg`Starter pack by ${sanitizeHandle(creator.handle, '@')}`)} + ? l`Starter Pack by you` + : l`Starter Pack by ${sanitizeHandle(creator.handle, '@')}`} @@ -96,7 +94,7 @@ export function Card({ ) : null} {!!joinedAllTimeCount && joinedAllTimeCount >= 50 && ( - + joined! @@ -110,7 +108,7 @@ export function useStarterPackLink({ }: { view: bsky.starterPack.AnyStarterPackView }) { - const {_} = useLingui() + const {t: l} = useLingui() const qc = useQueryClient() const {rkey, handleOrDid} = useMemo(() => { const rkey = new AtUri(view.uri).rkey @@ -125,8 +123,8 @@ export function useStarterPackLink({ return { to: `/starter-pack/${handleOrDid}/${rkey}`, label: bsky.isType(app.bsky.graph.starterpack, view.record) - ? _(msg`Navigate to ${view.record.name}`) - : _(msg`Navigate to starter pack`), + ? l`Navigate to ${view.record.name}` + : l`Navigate to Starter Pack`, precache, } } @@ -139,7 +137,7 @@ export function Link({ onPress?: () => void children: BaseLinkProps['children'] }) { - const {_} = useLingui() + const {t: l} = useLingui() const queryClient = useQueryClient() const {record} = starterPack const {rkey, handleOrDid} = useMemo(() => { @@ -155,7 +153,7 @@ export function Link({ return ( { precacheResolvedUri( queryClient, diff --git a/src/components/StarterPack/Wizard/WizardListCard.tsx b/src/components/StarterPack/Wizard/WizardListCard.tsx index eba7398754..3c2c52e876 100644 --- a/src/components/StarterPack/Wizard/WizardListCard.tsx +++ b/src/components/StarterPack/Wizard/WizardListCard.tsx @@ -5,9 +5,7 @@ import { type ModerationOpts, type ModerationUI, } from '@bsky/sdk/moderation' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' +import {Trans, useLingui} from '@lingui/react/macro' import {DISCOVER_FEED_URI, STARTER_PACK_MAX_SIZE} from '#/lib/constants' import {sanitizeDisplayName} from '#/lib/strings/display-names' @@ -53,15 +51,15 @@ function WizardListCard({ moderationUi: ModerationUI }) { const t = useTheme() - const {_} = useLingui() + const {t: l} = useLingui() return ( ) : !disabled ? ( @@ -396,7 +396,7 @@ export function AppClipOverlay({ Download Bluesky to get started! - We'll remember the starter pack you chose and use it when you create + We’ll remember the Starter Pack you chose and use it when you create an account in the app. diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx index c30bd3bb58..8ff2b76591 100644 --- a/src/screens/StarterPack/StarterPackScreen.tsx +++ b/src/screens/StarterPack/StarterPackScreen.tsx @@ -4,9 +4,7 @@ import {Image} from 'expo-image' import {AtUri} from '@atproto/syntax' import {type ModerationOpts} from '@bsky/sdk/moderation' import {RichText as RichTextAPI} from '@bsky/sdk/richtext' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Plural, Trans} from '@lingui/react/macro' +import {Plural, Trans, useLingui} from '@lingui/react/macro' import {useNavigation} from '@react-navigation/native' import {type NativeStackScreenProps} from '@react-navigation/native-stack' import {useQueryClient} from '@tanstack/react-query' @@ -96,7 +94,7 @@ export function StarterPackScreen({route}: StarterPackScreeProps) { } export function StarterPackScreenShort({route}: StarterPackScreenShortProps) { - const {_} = useLingui() + const {t: l} = useLingui() const { data: resolvedStarterPack, isLoading, @@ -111,8 +109,8 @@ export function StarterPackScreenShort({route}: StarterPackScreenShortProps) { ) @@ -130,7 +128,7 @@ export function StarterPackScreenInner({ routeParams: StarterPackScreeProps['route']['params'] }) { const {name, rkey} = routeParams - const {_} = useLingui() + const {t: l} = useLingui() const {currentAccount} = useSession() const moderationOpts = useModerationOpts() @@ -156,8 +154,8 @@ export function StarterPackScreenInner({ ) } @@ -187,13 +185,13 @@ function StarterPackScreenLoaded({ const showPeopleTab = Boolean(starterPack.list) const showFeedsTab = Boolean(starterPack.feeds?.length) const showPostsTab = Boolean(starterPack.list) - const {_} = useLingui() + const {t: l} = useLingui() const ax = useAnalytics() const tabs = [ - ...(showPeopleTab ? [_(msg`People`)] : []), - ...(showFeedsTab ? [_(msg`Feeds`)] : []), - ...(showPostsTab ? [_(msg`Posts`)] : []), + ...(showPeopleTab ? [l`People`] : []), + ...(showFeedsTab ? [l`Feeds`] : []), + ...(showPostsTab ? [l`Posts`] : []), ] const qrCodeDialogControl = useDialogControl() @@ -211,7 +209,7 @@ function StarterPackScreenLoaded({ const onOpenShareDialog = useCallback(() => { const rkey = new AtUri(starterPack.uri).rkey - shortenLink(makeStarterPackLink(starterPack.creator.did, rkey)).then( + void shortenLink(makeStarterPackLink(starterPack.creator.did, rkey)).then( res => { setLink(res.url) }, @@ -301,7 +299,7 @@ function Header({ routeParams: StarterPackScreeProps['route']['params'] onOpenShareDialog: () => void }) { - const {_} = useLingui() + const {t: l} = useLingui() const t = useTheme() const {currentAccount, hasSession} = useSession() const appviewClient = useAppviewClient() @@ -351,10 +349,10 @@ function Header({ listItems = await getAllListMembers(appviewClient, starterPack.list.uri) } catch (e) { setIsProcessing(false) - Toast.show(_(msg`An error occurred while trying to follow all`), { + Toast.show(l`An error occurred while trying to follow all`, { type: 'error', }) - logger.error('Failed to get list members for starter pack', { + logger.error('Failed to get list members for Starter Pack', { safeMessage: e, }) return @@ -378,7 +376,7 @@ function Header({ }) } catch (e) { setIsProcessing(false) - Toast.show(_(msg`An error occurred while trying to follow all`), { + Toast.show(l`An error occurred while trying to follow all`, { type: 'error', }) logger.error('Failed to follow all accounts', {safeMessage: e}) @@ -392,7 +390,7 @@ function Header({ }) } }) - Toast.show(_(msg`All accounts have been followed!`)) + Toast.show(l`All accounts have been followed!`) captureAction(ProgressGuideAction.Follow, dids.length) ax.metric('starterPack:followAll', { logContext: 'StarterPackProfilesList', @@ -427,7 +425,7 @@ function Header({ {isOwn ? (