diff options
Diffstat (limited to 'src/components/StarterPack')
-rw-r--r-- | src/components/StarterPack/QrCode.tsx | 8 | ||||
-rw-r--r-- | src/components/StarterPack/QrCodeDialog.tsx | 8 | ||||
-rw-r--r-- | src/components/StarterPack/StarterPackCard.tsx | 20 | ||||
-rw-r--r-- | src/components/StarterPack/Wizard/WizardEditListDialog.tsx | 2 | ||||
-rw-r--r-- | src/components/StarterPack/Wizard/WizardListCard.tsx | 3 |
5 files changed, 30 insertions, 11 deletions
diff --git a/src/components/StarterPack/QrCode.tsx b/src/components/StarterPack/QrCode.tsx index 515a9059a..6443ec694 100644 --- a/src/components/StarterPack/QrCode.tsx +++ b/src/components/StarterPack/QrCode.tsx @@ -13,6 +13,7 @@ import {useTheme} from '#/alf' import {atoms as a} from '#/alf' import {LinearGradientBackground} from '#/components/LinearGradientBackground' import {Text} from '#/components/Typography' +import * as bsky from '#/types/bsky' const LazyViewShot = React.lazy( // @ts-expect-error dynamic import @@ -30,7 +31,12 @@ export const QrCode = React.forwardRef<ViewShot, Props>(function QrCode( ) { const {record} = starterPack - if (!AppBskyGraphStarterpack.isRecord(record)) { + if ( + !bsky.dangerousIsType<AppBskyGraphStarterpack.Record>( + record, + AppBskyGraphStarterpack.isRecord, + ) + ) { return null } diff --git a/src/components/StarterPack/QrCodeDialog.tsx b/src/components/StarterPack/QrCodeDialog.tsx index 2feea0973..43d8b72da 100644 --- a/src/components/StarterPack/QrCodeDialog.tsx +++ b/src/components/StarterPack/QrCodeDialog.tsx @@ -18,6 +18,7 @@ import * as Dialog from '#/components/Dialog' import {DialogControlProps} from '#/components/Dialog' import {Loader} from '#/components/Loader' import {QrCode} from '#/components/StarterPack/QrCode' +import * as bsky from '#/types/bsky' export function QrCodeDialog({ starterPack, @@ -77,7 +78,12 @@ export function QrCodeDialog({ } else { setIsProcessing(true) - if (!AppBskyGraphStarterpack.isRecord(starterPack.record)) { + if ( + !bsky.validate( + starterPack.record, + AppBskyGraphStarterpack.validateRecord, + ) + ) { return } diff --git a/src/components/StarterPack/StarterPackCard.tsx b/src/components/StarterPack/StarterPackCard.tsx index 2a9da509d..caa052726 100644 --- a/src/components/StarterPack/StarterPackCard.tsx +++ b/src/components/StarterPack/StarterPackCard.tsx @@ -1,7 +1,7 @@ import React from 'react' import {View} from 'react-native' import {Image} from 'expo-image' -import {AppBskyGraphDefs, AppBskyGraphStarterpack, AtUri} from '@atproto/api' +import {AppBskyGraphStarterpack, AtUri} from '@atproto/api' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useQueryClient} from '@tanstack/react-query' @@ -15,11 +15,12 @@ import {atoms as a, useTheme} from '#/alf' import {StarterPack as StarterPackIcon} from '#/components/icons/StarterPack' import {Link as BaseLink, LinkProps as BaseLinkProps} from '#/components/Link' import {Text} from '#/components/Typography' +import * as bsky from '#/types/bsky' export function Default({ starterPack, }: { - starterPack?: AppBskyGraphDefs.StarterPackViewBasic + starterPack?: bsky.starterPack.AnyStarterPackView }) { if (!starterPack) return null return ( @@ -32,7 +33,7 @@ export function Default({ export function Notification({ starterPack, }: { - starterPack?: AppBskyGraphDefs.StarterPackViewBasic + starterPack?: bsky.starterPack.AnyStarterPackView }) { if (!starterPack) return null return ( @@ -47,7 +48,7 @@ export function Card({ noIcon, noDescription, }: { - starterPack: AppBskyGraphDefs.StarterPackViewBasic + starterPack: bsky.starterPack.AnyStarterPackView noIcon?: boolean noDescription?: boolean }) { @@ -57,7 +58,12 @@ export function Card({ const t = useTheme() const {currentAccount} = useSession() - if (!AppBskyGraphStarterpack.isRecord(record)) { + if ( + !bsky.dangerousIsType<AppBskyGraphStarterpack.Record>( + record, + AppBskyGraphStarterpack.isRecord, + ) + ) { return null } @@ -100,7 +106,7 @@ export function Link({ starterPack, children, }: { - starterPack: AppBskyGraphDefs.StarterPackViewBasic + starterPack: bsky.starterPack.AnyStarterPackView onPress?: () => void children: BaseLinkProps['children'] }) { @@ -139,7 +145,7 @@ export function Link({ export function Embed({ starterPack, }: { - starterPack: AppBskyGraphDefs.StarterPackViewBasic + starterPack: bsky.starterPack.AnyStarterPackView }) { const t = useTheme() const imageUri = getStarterPackOgCard(starterPack) diff --git a/src/components/StarterPack/Wizard/WizardEditListDialog.tsx b/src/components/StarterPack/Wizard/WizardEditListDialog.tsx index b67a8d302..5ce298842 100644 --- a/src/components/StarterPack/Wizard/WizardEditListDialog.tsx +++ b/src/components/StarterPack/Wizard/WizardEditListDialog.tsx @@ -38,7 +38,7 @@ export function WizardEditListDialog({ state: WizardState dispatch: (action: WizardAction) => void moderationOpts: ModerationOpts - profile: AppBskyActorDefs.ProfileViewBasic + profile: AppBskyActorDefs.ProfileViewDetailed }) { const {_} = useLingui() const t = useTheme() diff --git a/src/components/StarterPack/Wizard/WizardListCard.tsx b/src/components/StarterPack/Wizard/WizardListCard.tsx index 75d2bff60..e1a70a0b7 100644 --- a/src/components/StarterPack/Wizard/WizardListCard.tsx +++ b/src/components/StarterPack/Wizard/WizardListCard.tsx @@ -22,6 +22,7 @@ import {Button, ButtonText} from '#/components/Button' import * as Toggle from '#/components/forms/Toggle' import {Checkbox} from '#/components/forms/Toggle' import {Text} from '#/components/Typography' +import * as bsky from '#/types/bsky' function WizardListCard({ type, @@ -123,7 +124,7 @@ export function WizardProfileCard({ btnType: 'checkbox' | 'remove' state: WizardState dispatch: (action: WizardAction) => void - profile: AppBskyActorDefs.ProfileViewBasic + profile: bsky.profile.AnyProfileView moderationOpts: ModerationOpts }) { const {currentAccount} = useSession() |