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