move dialogs into their respective screens
This commit is contained in:
@@ -5,6 +5,8 @@ import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
|||||||
import {List} from 'view/com/util/List'
|
import {List} from 'view/com/util/List'
|
||||||
import {useWizardState} from '#/screens/StarterPack/Wizard/State'
|
import {useWizardState} from '#/screens/StarterPack/Wizard/State'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
|
import {WizardAddDialog} from '#/components/StarterPack/Wizard/WizardAddDialog'
|
||||||
import {WizardFeedCard} from '#/components/StarterPack/Wizard/WizardFeedCard'
|
import {WizardFeedCard} from '#/components/StarterPack/Wizard/WizardFeedCard'
|
||||||
import {WizardListEmpty} from '#/components/StarterPack/Wizard/WizardListEmpty'
|
import {WizardListEmpty} from '#/components/StarterPack/Wizard/WizardListEmpty'
|
||||||
|
|
||||||
@@ -14,18 +16,27 @@ function keyExtractor(item: GeneratorView) {
|
|||||||
|
|
||||||
export function StepFeeds() {
|
export function StepFeeds() {
|
||||||
const [state, dispatch] = useWizardState()
|
const [state, dispatch] = useWizardState()
|
||||||
|
const control = useDialogControl()
|
||||||
|
|
||||||
const renderItem = ({item}: ListRenderItemInfo<GeneratorView>) => {
|
const renderItem = ({item}: ListRenderItemInfo<GeneratorView>) => {
|
||||||
return <WizardFeedCard generator={item} state={state} dispatch={dispatch} />
|
return <WizardFeedCard generator={item} state={state} dispatch={dispatch} />
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List
|
<>
|
||||||
data={state.feeds}
|
<List
|
||||||
renderItem={renderItem}
|
data={state.feeds}
|
||||||
keyExtractor={keyExtractor}
|
renderItem={renderItem}
|
||||||
style={[a.flex_1]}
|
keyExtractor={keyExtractor}
|
||||||
ListEmptyComponent={<WizardListEmpty type="feeds" />}
|
style={[a.flex_1]}
|
||||||
/>
|
ListEmptyComponent={<WizardListEmpty type="feeds" />}
|
||||||
|
/>
|
||||||
|
<WizardAddDialog
|
||||||
|
control={control}
|
||||||
|
type="feeds"
|
||||||
|
state={state}
|
||||||
|
dispatch={dispatch}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {ListRenderItemInfo, View} from 'react-native'
|
import {ListRenderItemInfo} from 'react-native'
|
||||||
import {AppBskyActorDefs} from '@atproto/api'
|
import {AppBskyActorDefs} from '@atproto/api'
|
||||||
|
|
||||||
import {List} from 'view/com/util/List'
|
import {List} from 'view/com/util/List'
|
||||||
import {useWizardState} from '#/screens/StarterPack/Wizard/State'
|
import {useWizardState} from '#/screens/StarterPack/Wizard/State'
|
||||||
import {atoms as a} from '#/alf'
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
|
import {WizardAddDialog} from '#/components/StarterPack/Wizard/WizardAddDialog'
|
||||||
import {WizardListEmpty} from '#/components/StarterPack/Wizard/WizardListEmpty'
|
import {WizardListEmpty} from '#/components/StarterPack/Wizard/WizardListEmpty'
|
||||||
import {WizardProfileCard} from '#/components/StarterPack/Wizard/WizardProfileCard'
|
import {WizardProfileCard} from '#/components/StarterPack/Wizard/WizardProfileCard'
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ function keyExtractor(item: AppBskyActorDefs.ProfileViewBasic) {
|
|||||||
|
|
||||||
export function StepProfiles() {
|
export function StepProfiles() {
|
||||||
const [state, dispatch] = useWizardState()
|
const [state, dispatch] = useWizardState()
|
||||||
|
const control = useDialogControl()
|
||||||
|
|
||||||
const renderItem = ({
|
const renderItem = ({
|
||||||
item,
|
item,
|
||||||
@@ -25,14 +27,18 @@ export function StepProfiles() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View style={[a.flex_1]}>
|
<List
|
||||||
<List
|
data={state.profiles}
|
||||||
data={state.profiles}
|
renderItem={renderItem}
|
||||||
renderItem={renderItem}
|
keyExtractor={keyExtractor}
|
||||||
keyExtractor={keyExtractor}
|
ListEmptyComponent={<WizardListEmpty type="profiles" />}
|
||||||
ListEmptyComponent={<WizardListEmpty type="profiles" />}
|
/>
|
||||||
/>
|
<WizardAddDialog
|
||||||
</View>
|
control={control}
|
||||||
|
type="profiles"
|
||||||
|
state={state}
|
||||||
|
dispatch={dispatch}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import {StepFeeds} from '#/screens/StarterPack/Wizard/StepFeeds'
|
|||||||
import {StepProfiles} from '#/screens/StarterPack/Wizard/StepProfiles'
|
import {StepProfiles} from '#/screens/StarterPack/Wizard/StepProfiles'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import {useDialogControl} from '#/components/Dialog'
|
|
||||||
import {WizardAddDialog} from '#/components/StarterPack/Wizard/WizardAddDialog'
|
|
||||||
import {Provider} from './State'
|
import {Provider} from './State'
|
||||||
|
|
||||||
export function Wizard({
|
export function Wizard({
|
||||||
@@ -77,7 +75,6 @@ function WizardInner() {
|
|||||||
did: currentAccount?.did,
|
did: currentAccount?.did,
|
||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
})
|
})
|
||||||
const searchDialogControl = useDialogControl()
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
@@ -176,15 +173,6 @@ function WizardInner() {
|
|||||||
<Container>
|
<Container>
|
||||||
<StepView />
|
<StepView />
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
{(state.currentStep === 'Profiles' || state.currentStep === 'Feeds') && (
|
|
||||||
<WizardAddDialog
|
|
||||||
control={searchDialogControl}
|
|
||||||
state={state}
|
|
||||||
dispatch={dispatch}
|
|
||||||
type={state.currentStep === 'Profiles' ? 'profiles' : 'feeds'}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</CenteredView>
|
</CenteredView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user