move landing to logged out view
This commit is contained in:
@@ -10,9 +10,11 @@ import {makeProfileLink} from 'lib/routes/links'
|
|||||||
import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types'
|
import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types'
|
||||||
import {shareUrl} from 'lib/sharing'
|
import {shareUrl} from 'lib/sharing'
|
||||||
import {isWeb} from 'platform/detection'
|
import {isWeb} from 'platform/detection'
|
||||||
|
import {useSetUsedStarterPack} from 'state/preferences/starter-pack'
|
||||||
import {useResolveDidQuery} from 'state/queries/resolve-uri'
|
import {useResolveDidQuery} from 'state/queries/resolve-uri'
|
||||||
import {useStarterPackQuery} from 'state/queries/useStarterPackQuery'
|
import {useStarterPackQuery} from 'state/queries/useStarterPackQuery'
|
||||||
import {useSession} from 'state/session'
|
import {useSession} from 'state/session'
|
||||||
|
import {useLoggedOutViewControls} from 'state/shell/logged-out'
|
||||||
import {PagerWithHeader} from 'view/com/pager/PagerWithHeader'
|
import {PagerWithHeader} from 'view/com/pager/PagerWithHeader'
|
||||||
import {ProfileSubpageHeader} from 'view/com/profile/ProfileSubpageHeader'
|
import {ProfileSubpageHeader} from 'view/com/profile/ProfileSubpageHeader'
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
import {CenteredView} from 'view/com/util/Views'
|
||||||
@@ -110,6 +112,8 @@ function Header({
|
|||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const qrCodeDialogControl = useDialogControl()
|
const qrCodeDialogControl = useDialogControl()
|
||||||
|
const setUsedStarterPack = useSetUsedStarterPack()
|
||||||
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
|
|
||||||
const {record, creator} = starterPack
|
const {record, creator} = starterPack
|
||||||
const isOwn = creator.did === currentAccount?.did
|
const isOwn = creator.did === currentAccount?.did
|
||||||
@@ -136,9 +140,10 @@ function Header({
|
|||||||
variant="solid"
|
variant="solid"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
size="small"
|
size="small"
|
||||||
onPress={() =>
|
onPress={() => {
|
||||||
navigation.replace('StarterPackLanding', {name, rkey})
|
setUsedStarterPack({uri: starterPack.uri})
|
||||||
}>
|
setShowLoggedOut(true)
|
||||||
|
}}>
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Debug</Trans>
|
<Trans>Debug</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export const schema = z.object({
|
|||||||
usedStarterPack: z
|
usedStarterPack: z
|
||||||
.object({
|
.object({
|
||||||
uri: z.string(),
|
uri: z.string(),
|
||||||
cid: z.string(),
|
cid: z.string().optional(),
|
||||||
initialFeed: z.string().optional(),
|
initialFeed: z.string().optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import React from 'react'
|
|||||||
|
|
||||||
import * as persisted from '#/state/persisted'
|
import * as persisted from '#/state/persisted'
|
||||||
|
|
||||||
type StateContext = {uri: string; cid: string; initialFeed?: string} | undefined
|
type StateContext =
|
||||||
|
| {uri: string; cid?: string; initialFeed?: string}
|
||||||
|
| undefined
|
||||||
type SetContext = (v: StateContext) => void
|
type SetContext = (v: StateContext) => void
|
||||||
|
|
||||||
const stateContext = React.createContext<StateContext>(undefined)
|
const stateContext = React.createContext<StateContext>(undefined)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
} from '#/state/shell/logged-out'
|
} from '#/state/shell/logged-out'
|
||||||
import {useSetMinimalShellMode} from '#/state/shell/minimal-mode'
|
import {useSetMinimalShellMode} from '#/state/shell/minimal-mode'
|
||||||
import {NavigationProp} from 'lib/routes/types'
|
import {NavigationProp} from 'lib/routes/types'
|
||||||
|
import {useUsedStarterPack} from 'state/preferences/starter-pack'
|
||||||
import {ErrorBoundary} from '#/view/com/util/ErrorBoundary'
|
import {ErrorBoundary} from '#/view/com/util/ErrorBoundary'
|
||||||
import {Text} from '#/view/com/util/text/Text'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
import {Login} from '#/screens/Login'
|
import {Login} from '#/screens/Login'
|
||||||
@@ -28,6 +29,7 @@ enum ScreenState {
|
|||||||
S_LoginOrCreateAccount,
|
S_LoginOrCreateAccount,
|
||||||
S_Login,
|
S_Login,
|
||||||
S_CreateAccount,
|
S_CreateAccount,
|
||||||
|
S_StarterPack,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
|
export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
|
||||||
@@ -36,9 +38,12 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
|
|||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen} = useAnalytics()
|
const {screen} = useAnalytics()
|
||||||
|
const usedStarterPack = useUsedStarterPack()
|
||||||
const {requestedAccountSwitchTo} = useLoggedOutView()
|
const {requestedAccountSwitchTo} = useLoggedOutView()
|
||||||
const [screenState, setScreenState] = React.useState<ScreenState>(
|
const [screenState, setScreenState] = React.useState<ScreenState>(
|
||||||
requestedAccountSwitchTo
|
usedStarterPack?.uri
|
||||||
|
? ScreenState.S_StarterPack
|
||||||
|
: requestedAccountSwitchTo
|
||||||
? requestedAccountSwitchTo === 'new'
|
? requestedAccountSwitchTo === 'new'
|
||||||
? ScreenState.S_CreateAccount
|
? ScreenState.S_CreateAccount
|
||||||
: ScreenState.S_Login
|
: ScreenState.S_Login
|
||||||
|
|||||||
Reference in New Issue
Block a user