mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at samuel/exp-cli 110 lines 3.3 kB view raw
1import React from 'react' 2import {View} from 'react-native' 3import {msg, Trans} from '@lingui/macro' 4import {useLingui} from '@lingui/react' 5 6import {isNative} from '#/platform/detection' 7import {useLoggedOutViewControls} from '#/state/shell/logged-out' 8import {useCloseAllActiveElements} from '#/state/util' 9import {Logo} from '#/view/icons/Logo' 10import {Logotype} from '#/view/icons/Logotype' 11import {atoms as a, useBreakpoints, useTheme} from '#/alf' 12import {Button, ButtonText} from '#/components/Button' 13import * as Dialog from '#/components/Dialog' 14import {useGlobalDialogsControlContext} from '#/components/dialogs/Context' 15import {Text} from '#/components/Typography' 16 17export function SigninDialog() { 18 const {signinDialogControl: control} = useGlobalDialogsControlContext() 19 return ( 20 <Dialog.Outer control={control}> 21 <Dialog.Handle /> 22 <SigninDialogInner control={control} /> 23 </Dialog.Outer> 24 ) 25} 26 27function SigninDialogInner({}: {control: Dialog.DialogOuterProps['control']}) { 28 const t = useTheme() 29 const {_} = useLingui() 30 const {gtMobile} = useBreakpoints() 31 const {requestSwitchToAccount} = useLoggedOutViewControls() 32 const closeAllActiveElements = useCloseAllActiveElements() 33 34 const showSignIn = React.useCallback(() => { 35 closeAllActiveElements() 36 requestSwitchToAccount({requestedAccount: 'none'}) 37 }, [requestSwitchToAccount, closeAllActiveElements]) 38 39 const showCreateAccount = React.useCallback(() => { 40 closeAllActiveElements() 41 requestSwitchToAccount({requestedAccount: 'new'}) 42 }, [requestSwitchToAccount, closeAllActiveElements]) 43 44 return ( 45 <Dialog.ScrollableInner 46 label={_(msg`Sign in to Bluesky or create a new account`)} 47 style={[gtMobile ? {width: 'auto', maxWidth: 420} : a.w_full]}> 48 <View style={[!isNative && a.p_2xl]}> 49 <View 50 style={[ 51 a.flex_row, 52 a.align_center, 53 a.justify_center, 54 a.gap_sm, 55 a.pb_lg, 56 ]}> 57 <Logo width={36} /> 58 <View style={{paddingTop: 6}}> 59 <Logotype width={120} fill={t.atoms.text.color} /> 60 </View> 61 </View> 62 63 <Text 64 style={[ 65 a.text_lg, 66 a.text_center, 67 t.atoms.text, 68 a.pb_2xl, 69 a.leading_snug, 70 a.mx_auto, 71 { 72 maxWidth: 300, 73 }, 74 ]}> 75 <Trans> 76 Sign in or create your account to join the conversation! 77 </Trans> 78 </Text> 79 80 <View style={[a.flex_col, a.gap_md]}> 81 <Button 82 variant="solid" 83 color="primary" 84 size="large" 85 onPress={showCreateAccount} 86 label={_(msg`Create an account`)}> 87 <ButtonText> 88 <Trans>Create an account</Trans> 89 </ButtonText> 90 </Button> 91 92 <Button 93 variant="solid" 94 color="secondary" 95 size="large" 96 onPress={showSignIn} 97 label={_(msg`Sign in`)}> 98 <ButtonText> 99 <Trans>Sign in</Trans> 100 </ButtonText> 101 </Button> 102 </View> 103 104 {isNative && <View style={{height: 10}} />} 105 </View> 106 107 <Dialog.Close /> 108 </Dialog.ScrollableInner> 109 ) 110}