about summary refs log tree commit diff
path: root/src/screens
diff options
context:
space:
mode:
authorChenyu Huang <itschenyu@gmail.com>2025-08-08 15:33:45 -0700
committerChenyu Huang <itschenyu@gmail.com>2025-08-16 19:45:43 -0700
commit7182cd3d5e157d7ad80f2e5c4a458730c46939a0 (patch)
tree55cc28836cd05c5fb0b1d2784d456faa28c9911e /src/screens
parentcced762a7fb7a2729b63922abc34ae5406a58bce (diff)
downloadvoidsky-7182cd3d5e157d7ad80f2e5c4a458730c46939a0.tar.zst
starter pack dialog flow from profileMenu
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/StarterPack/Wizard/index.tsx41
1 files changed, 31 insertions, 10 deletions
diff --git a/src/screens/StarterPack/Wizard/index.tsx b/src/screens/StarterPack/Wizard/index.tsx
index 8256349df..b918e8baf 100644
--- a/src/screens/StarterPack/Wizard/index.tsx
+++ b/src/screens/StarterPack/Wizard/index.tsx
@@ -54,6 +54,7 @@ import {StepProfiles} from '#/screens/StarterPack/Wizard/StepProfiles'
 import {atoms as a, useTheme, web} from '#/alf'
 import {Button, ButtonIcon, ButtonText} from '#/components/Button'
 import {useDialogControl} from '#/components/Dialog'
+import {notifyDialogSuccess} from '#/components/dialogs/StarterPackDialog'
 import * as Layout from '#/components/Layout'
 import {ListMaybePlaceholder} from '#/components/Lists'
 import {Loader} from '#/components/Loader'
@@ -68,7 +69,9 @@ export function Wizard({
   CommonNavigatorParams,
   'StarterPackEdit' | 'StarterPackWizard'
 >) {
-  const {rkey} = route.params ?? {}
+  const params = route.params ?? {}
+  const rkey = 'rkey' in params ? params.rkey : undefined
+  const fromDialog = 'fromDialog' in params ? params.fromDialog : false
   const {currentAccount} = useSession()
   const moderationOpts = useModerationOpts()
 
@@ -133,6 +136,7 @@ export function Wizard({
           currentListItems={listItems}
           profile={profile}
           moderationOpts={moderationOpts}
+          fromDialog={fromDialog}
         />
       </Provider>
     </Layout.Screen>
@@ -144,17 +148,20 @@ function WizardInner({
   currentListItems,
   profile,
   moderationOpts,
+  fromDialog,
 }: {
   currentStarterPack?: AppBskyGraphDefs.StarterPackView
   currentListItems?: AppBskyGraphDefs.ListItemView[]
   profile: AppBskyActorDefs.ProfileViewDetailed
   moderationOpts: ModerationOpts
+  fromDialog?: boolean
 }) {
   const navigation = useNavigation<NavigationProp>()
   const {_} = useLingui()
   const setMinimalShellMode = useSetMinimalShellMode()
   const [state, dispatch] = useWizardState()
   const {currentAccount} = useSession()
+
   const {data: currentProfile} = useProfileQuery({
     did: currentAccount?.did,
     staleTime: 0,
@@ -213,24 +220,38 @@ function WizardInner({
     })
     Image.prefetch([getStarterPackOgCard(currentProfile!.did, rkey)])
     dispatch({type: 'SetProcessing', processing: false})
-    navigation.replace('StarterPack', {
-      name: currentAccount!.handle,
-      rkey,
-      new: true,
-    })
-  }
 
-  const onSuccessEdit = () => {
-    if (navigation.canGoBack()) {
+    // If launched from ProfileMenu dialog, notify the dialog and go back
+    if (fromDialog) {
       navigation.goBack()
+      notifyDialogSuccess()
     } else {
+      // Original behavior for other entry points
       navigation.replace('StarterPack', {
         name: currentAccount!.handle,
-        rkey: parsed!.rkey,
+        rkey,
+        new: true,
       })
     }
   }
 
+  const onSuccessEdit = () => {
+    // If launched from ProfileMenu dialog, go back to stay on profile page
+    if (fromDialog) {
+      navigation.goBack()
+    } else {
+      // Original behavior for other entry points
+      if (navigation.canGoBack()) {
+        navigation.goBack()
+      } else {
+        navigation.replace('StarterPack', {
+          name: currentAccount!.handle,
+          rkey: parsed!.rkey,
+        })
+      }
+    }
+  }
+
   const {mutate: createStarterPack} = useCreateStarterPackMutation({
     onSuccess: onSuccessCreate,
     onError: e => {