075ffdf583
* Enable PWI * Disable access to feeds on PWI * Remove feeds nav item from drawer when signed out * Replace discover feed on home with a CTA * Wire up the sign in and create account buttons to go straight to their respective screens * Give a custom ScreenHider interface for no-pwi * Add side borders on desktop to the screen hider * Filter accounts in the autocomplete according to mod settings * Trim replies in the post thread that are pwi opt-out * Show 'learn more' on the content hider when no-override is enabled * Apply the moderation filter on profile cards * Disable post search on logged-out view * Update locale files * Bump api pkg * Ensure feeds with no posts don't show as NSFPublic * Fix types --------- Co-authored-by: Eric Bailey <git@esb.lol>
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
import React from 'react'
|
|
import {View} from 'react-native'
|
|
import {msg, Trans} from '@lingui/macro'
|
|
import {useLingui} from '@lingui/react'
|
|
|
|
import {s} from 'lib/styles'
|
|
import {usePalette} from 'lib/hooks/usePalette'
|
|
import {DefaultAvatar} from '#/view/com/util/UserAvatar'
|
|
import {Text} from '#/view/com/util/text/Text'
|
|
import {Button} from '#/view/com/util/forms/Button'
|
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
|
import {useCloseAllActiveElements} from '#/state/util'
|
|
|
|
let NavSignupCard = ({}: {}): React.ReactNode => {
|
|
const {_} = useLingui()
|
|
const pal = usePalette('default')
|
|
const {requestSwitchToAccount} = useLoggedOutViewControls()
|
|
const closeAllActiveElements = useCloseAllActiveElements()
|
|
|
|
const showSignIn = React.useCallback(() => {
|
|
closeAllActiveElements()
|
|
requestSwitchToAccount({requestedAccount: 'none'})
|
|
}, [requestSwitchToAccount, closeAllActiveElements])
|
|
|
|
const showCreateAccount = React.useCallback(() => {
|
|
closeAllActiveElements()
|
|
requestSwitchToAccount({requestedAccount: 'new'})
|
|
// setShowLoggedOut(true)
|
|
}, [requestSwitchToAccount, closeAllActiveElements])
|
|
|
|
return (
|
|
<View
|
|
style={{
|
|
alignItems: 'flex-start',
|
|
paddingTop: 6,
|
|
marginBottom: 24,
|
|
}}>
|
|
<DefaultAvatar type="user" size={48} />
|
|
|
|
<View style={{paddingTop: 12}}>
|
|
<Text type="md" style={[pal.text, s.bold]}>
|
|
<Trans>Sign up or sign in to join the conversation</Trans>
|
|
</Text>
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', paddingTop: 12, gap: 8}}>
|
|
<Button
|
|
onPress={showCreateAccount}
|
|
accessibilityHint={_(msg`Sign up`)}
|
|
accessibilityLabel={_(msg`Sign up`)}>
|
|
<Text type="md" style={[{color: 'white'}, s.bold]}>
|
|
<Trans>Sign up</Trans>
|
|
</Text>
|
|
</Button>
|
|
<Button
|
|
type="default"
|
|
onPress={showSignIn}
|
|
accessibilityHint={_(msg`Sign in`)}
|
|
accessibilityLabel={_(msg`Sign in`)}>
|
|
<Text type="md" style={[pal.text, s.bold]}>
|
|
Sign in
|
|
</Text>
|
|
</Button>
|
|
</View>
|
|
</View>
|
|
)
|
|
}
|
|
NavSignupCard = React.memo(NavSignupCard)
|
|
export {NavSignupCard}
|