Wire up the sign in and create account buttons to go straight to their respective screens
This commit is contained in:
@@ -22,7 +22,7 @@ type Controls = {
|
|||||||
/**
|
/**
|
||||||
* The did of the account to populate the login form with.
|
* The did of the account to populate the login form with.
|
||||||
*/
|
*/
|
||||||
requestedAccount?: string
|
requestedAccount?: string | 'none' | 'new'
|
||||||
}) => void
|
}) => void
|
||||||
/**
|
/**
|
||||||
* Clears the requested account so that next time the logged out view is
|
* Clears the requested account so that next time the logged out view is
|
||||||
|
|||||||
@@ -8,18 +8,34 @@ import {usePalette} from '#/lib/hooks/usePalette'
|
|||||||
import {colors, s} from '#/lib/styles'
|
import {colors, s} from '#/lib/styles'
|
||||||
import {TextLink} from '../util/Link'
|
import {TextLink} from '../util/Link'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
|
|
||||||
export function HomeLoggedOutCTA() {
|
export function HomeLoggedOutCTA() {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
|
const {requestSwitchToAccount} = useLoggedOutViewControls()
|
||||||
|
|
||||||
|
const showCreateAccount = React.useCallback(() => {
|
||||||
|
requestSwitchToAccount({requestedAccount: 'new'})
|
||||||
|
}, [requestSwitchToAccount])
|
||||||
|
|
||||||
|
const showSignIn = React.useCallback(() => {
|
||||||
|
requestSwitchToAccount({requestedAccount: 'none'})
|
||||||
|
}, [requestSwitchToAccount])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView style={styles.container}>
|
<ScrollView style={styles.container}>
|
||||||
<View style={[styles.hero, isMobile && styles.heroMobile]}>
|
<View style={[styles.hero, isMobile && styles.heroMobile]}>
|
||||||
<Text style={[styles.title, pal.link]}>
|
<Text style={[styles.title, pal.link]}>
|
||||||
<Trans>Bluesky</Trans>
|
<Trans>Bluesky</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={[styles.subtitle, pal.textLight]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.subtitle,
|
||||||
|
isMobile && styles.subtitleMobile,
|
||||||
|
pal.textLight,
|
||||||
|
]}>
|
||||||
<Trans>See what's next</Trans>
|
<Trans>See what's next</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -33,7 +49,7 @@ export function HomeLoggedOutCTA() {
|
|||||||
isMobile && styles.btnMobile,
|
isMobile && styles.btnMobile,
|
||||||
{backgroundColor: colors.blue3},
|
{backgroundColor: colors.blue3},
|
||||||
]}
|
]}
|
||||||
onPress={undefined}
|
onPress={showCreateAccount}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={_(msg`Create new account`)}
|
accessibilityLabel={_(msg`Create new account`)}
|
||||||
accessibilityHint="Opens flow to create a new Bluesky account">
|
accessibilityHint="Opens flow to create a new Bluesky account">
|
||||||
@@ -49,7 +65,7 @@ export function HomeLoggedOutCTA() {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
testID="signInButton"
|
testID="signInButton"
|
||||||
style={[styles.btn, isMobile && styles.btnMobile, pal.btn]}
|
style={[styles.btn, isMobile && styles.btnMobile, pal.btn]}
|
||||||
onPress={undefined}
|
onPress={showSignIn}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={_(msg`Sign in`)}
|
accessibilityLabel={_(msg`Sign in`)}
|
||||||
accessibilityHint="Opens flow to sign into your existing Bluesky account">
|
accessibilityHint="Opens flow to sign into your existing Bluesky account">
|
||||||
@@ -110,6 +126,9 @@ const styles = StyleSheet.create({
|
|||||||
fontSize: 48,
|
fontSize: 48,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
|
subtitleMobile: {
|
||||||
|
fontSize: 42,
|
||||||
|
},
|
||||||
btnsDesktop: {
|
btnsDesktop: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
|
|||||||
const {requestedAccountSwitchTo} = useLoggedOutView()
|
const {requestedAccountSwitchTo} = useLoggedOutView()
|
||||||
const [screenState, setScreenState] = React.useState<ScreenState>(
|
const [screenState, setScreenState] = React.useState<ScreenState>(
|
||||||
requestedAccountSwitchTo
|
requestedAccountSwitchTo
|
||||||
? ScreenState.S_Login
|
? requestedAccountSwitchTo === 'new'
|
||||||
|
? ScreenState.S_CreateAccount
|
||||||
|
: ScreenState.S_Login
|
||||||
: ScreenState.S_LoginOrCreateAccount,
|
: ScreenState.S_LoginOrCreateAccount,
|
||||||
)
|
)
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
|
|||||||
@@ -14,13 +14,19 @@ import {useCloseAllActiveElements} from '#/state/util'
|
|||||||
let NavSignupCard = ({}: {}): React.ReactNode => {
|
let NavSignupCard = ({}: {}): React.ReactNode => {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {requestSwitchToAccount} = useLoggedOutViewControls()
|
||||||
const closeAllActiveElements = useCloseAllActiveElements()
|
const closeAllActiveElements = useCloseAllActiveElements()
|
||||||
|
|
||||||
const showLoggedOut = React.useCallback(() => {
|
const showSignIn = React.useCallback(() => {
|
||||||
closeAllActiveElements()
|
closeAllActiveElements()
|
||||||
setShowLoggedOut(true)
|
requestSwitchToAccount({requestedAccount: 'none'})
|
||||||
}, [setShowLoggedOut, closeAllActiveElements])
|
}, [requestSwitchToAccount, closeAllActiveElements])
|
||||||
|
|
||||||
|
const showCreateAccount = React.useCallback(() => {
|
||||||
|
closeAllActiveElements()
|
||||||
|
requestSwitchToAccount({requestedAccount: 'new'})
|
||||||
|
// setShowLoggedOut(true)
|
||||||
|
}, [requestSwitchToAccount, closeAllActiveElements])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
@@ -39,7 +45,7 @@ let NavSignupCard = ({}: {}): React.ReactNode => {
|
|||||||
|
|
||||||
<View style={{flexDirection: 'row', paddingTop: 12, gap: 8}}>
|
<View style={{flexDirection: 'row', paddingTop: 12, gap: 8}}>
|
||||||
<Button
|
<Button
|
||||||
onPress={showLoggedOut}
|
onPress={showCreateAccount}
|
||||||
accessibilityHint={_(msg`Sign up`)}
|
accessibilityHint={_(msg`Sign up`)}
|
||||||
accessibilityLabel={_(msg`Sign up`)}>
|
accessibilityLabel={_(msg`Sign up`)}>
|
||||||
<Text type="md" style={[{color: 'white'}, s.bold]}>
|
<Text type="md" style={[{color: 'white'}, s.bold]}>
|
||||||
@@ -48,7 +54,7 @@ let NavSignupCard = ({}: {}): React.ReactNode => {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="default"
|
type="default"
|
||||||
onPress={showLoggedOut}
|
onPress={showSignIn}
|
||||||
accessibilityHint={_(msg`Sign in`)}
|
accessibilityHint={_(msg`Sign in`)}
|
||||||
accessibilityLabel={_(msg`Sign in`)}>
|
accessibilityLabel={_(msg`Sign in`)}>
|
||||||
<Text type="md" style={[pal.text, s.bold]}>
|
<Text type="md" style={[pal.text, s.bold]}>
|
||||||
|
|||||||
Reference in New Issue
Block a user