diff options
Diffstat (limited to 'src/screens/StarterPack/Wizard/State.tsx')
-rw-r--r-- | src/screens/StarterPack/Wizard/State.tsx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/screens/StarterPack/Wizard/State.tsx b/src/screens/StarterPack/Wizard/State.tsx index f65933fbb..baf0195d8 100644 --- a/src/screens/StarterPack/Wizard/State.tsx +++ b/src/screens/StarterPack/Wizard/State.tsx @@ -1,15 +1,12 @@ import React from 'react' -import { - AppBskyActorDefs, - AppBskyGraphDefs, - AppBskyGraphStarterpack, -} from '@atproto/api' +import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api' import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' import {msg} from '@lingui/macro' import {STARTER_PACK_MAX_SIZE} from '#/lib/constants' import {useSession} from '#/state/session' import * as Toast from '#/view/com/util/Toast' +import * as bsky from '#/types/bsky' const steps = ['Details', 'Profiles', 'Feeds'] as const type Step = (typeof steps)[number] @@ -20,7 +17,7 @@ type Action = | {type: 'SetCanNext'; canNext: boolean} | {type: 'SetName'; name: string} | {type: 'SetDescription'; description: string} - | {type: 'AddProfile'; profile: AppBskyActorDefs.ProfileViewBasic} + | {type: 'AddProfile'; profile: bsky.profile.AnyProfileView} | {type: 'RemoveProfile'; profileDid: string} | {type: 'AddFeed'; feed: GeneratorView} | {type: 'RemoveFeed'; feedUri: string} @@ -32,7 +29,7 @@ interface State { currentStep: Step name?: string description?: string - profiles: AppBskyActorDefs.ProfileViewBasic[] + profiles: bsky.profile.AnyProfileView[] feeds: GeneratorView[] processing: boolean error?: string @@ -113,7 +110,6 @@ function reducer(state: State, action: Action): State { return updatedState } -// TODO supply the initial state to this component export function Provider({ starterPack, listItems, @@ -126,7 +122,10 @@ export function Provider({ const {currentAccount} = useSession() const createInitialState = (): State => { - if (starterPack && AppBskyGraphStarterpack.isRecord(starterPack.record)) { + if ( + starterPack && + bsky.validate(starterPack.record, AppBskyGraphStarterpack.validateRecord) + ) { return { canNext: true, currentStep: 'Details', |