about summary refs log tree commit diff
path: root/src/screens/StarterPack/Wizard/State.tsx
diff options
context:
space:
mode:
authorChenyu Huang <itschenyu@gmail.com>2025-08-08 16:10:35 -0700
committerChenyu Huang <itschenyu@gmail.com>2025-08-19 15:28:37 -0700
commitf42b5831bb831e3b9f925730477a27e01d2b33f4 (patch)
treef0df61f8c22f91f7474646bea84023cef92be01f /src/screens/StarterPack/Wizard/State.tsx
parent7182cd3d5e157d7ad80f2e5c4a458730c46939a0 (diff)
downloadvoidsky-f42b5831bb831e3b9f925730477a27e01d2b33f4.tar.zst
parameterize the initial profile for starter pack profile select wizard screen
Diffstat (limited to 'src/screens/StarterPack/Wizard/State.tsx')
-rw-r--r--src/screens/StarterPack/Wizard/State.tsx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/screens/StarterPack/Wizard/State.tsx b/src/screens/StarterPack/Wizard/State.tsx
index 7fae8ca6d..f34218219 100644
--- a/src/screens/StarterPack/Wizard/State.tsx
+++ b/src/screens/StarterPack/Wizard/State.tsx
@@ -7,7 +7,6 @@ import {
 import {msg, plural} 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'
 
@@ -37,6 +36,7 @@ interface State {
   processing: boolean
   error?: string
   transitionDirection: 'Backward' | 'Forward'
+  targetDid?: string
 }
 
 type TStateContext = [State, (action: Action) => void]
@@ -118,15 +118,17 @@ function reducer(state: State, action: Action): State {
 export function Provider({
   starterPack,
   listItems,
+  targetProfile,
   children,
 }: {
   starterPack?: AppBskyGraphDefs.StarterPackView
   listItems?: AppBskyGraphDefs.ListItemView[]
+  targetProfile: bsky.profile.AnyProfileView
   children: React.ReactNode
 }) {
-  const {currentAccount} = useSession()
-
   const createInitialState = (): State => {
+    const targetDid = targetProfile?.did
+
     if (
       starterPack &&
       bsky.validate(starterPack.record, AppBskyGraphStarterpack.validateRecord)
@@ -136,23 +138,22 @@ export function Provider({
         currentStep: 'Details',
         name: starterPack.record.name,
         description: starterPack.record.description,
-        profiles:
-          listItems
-            ?.map(i => i.subject)
-            .filter(p => p.did !== currentAccount?.did) ?? [],
+        profiles: listItems?.map(i => i.subject) ?? [],
         feeds: starterPack.feeds ?? [],
         processing: false,
         transitionDirection: 'Forward',
+        targetDid,
       }
     }
 
     return {
       canNext: true,
       currentStep: 'Details',
-      profiles: [],
+      profiles: [targetProfile],
       feeds: [],
       processing: false,
       transitionDirection: 'Forward',
+      targetDid,
     }
   }