mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at samuel/exp-cli 190 lines 5.4 kB view raw
1import React from 'react' 2import {Pressable, View} from 'react-native' 3import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' 4import {msg, Trans} from '@lingui/macro' 5import {useLingui} from '@lingui/react' 6 7import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' 8import {useKawaiiMode} from '#/state/preferences/kawaii' 9import {ErrorBoundary} from '#/view/com/util/ErrorBoundary' 10import {Logo} from '#/view/icons/Logo' 11import {Logotype} from '#/view/icons/Logotype' 12import { 13 AppClipOverlay, 14 postAppClipMessage, 15} from '#/screens/StarterPack/StarterPackLandingScreen' 16import {atoms as a, useTheme} from '#/alf' 17import {AppLanguageDropdown} from '#/components/AppLanguageDropdown' 18import {Button, ButtonText} from '#/components/Button' 19import * as Layout from '#/components/Layout' 20import {InlineLinkText} from '#/components/Link' 21import {Text} from '#/components/Typography' 22 23export const SplashScreen = ({ 24 onDismiss, 25 onPressSignin, 26 onPressCreateAccount, 27}: { 28 onDismiss?: () => void 29 onPressSignin: () => void 30 onPressCreateAccount: () => void 31}) => { 32 const {_} = useLingui() 33 const t = useTheme() 34 const {isTabletOrMobile: isMobileWeb} = useWebMediaQueries() 35 const [showClipOverlay, setShowClipOverlay] = React.useState(false) 36 37 React.useEffect(() => { 38 const getParams = new URLSearchParams(window.location.search) 39 const clip = getParams.get('clip') 40 if (clip === 'true') { 41 setShowClipOverlay(true) 42 postAppClipMessage({ 43 action: 'present', 44 }) 45 } 46 }, []) 47 48 const kawaii = useKawaiiMode() 49 50 return ( 51 <> 52 {onDismiss && ( 53 <Pressable 54 accessibilityRole="button" 55 style={{ 56 position: 'absolute', 57 top: 20, 58 right: 20, 59 padding: 20, 60 zIndex: 100, 61 }} 62 onPress={onDismiss}> 63 <FontAwesomeIcon 64 icon="x" 65 size={24} 66 style={{ 67 color: String(t.atoms.text.color), 68 }} 69 /> 70 </Pressable> 71 )} 72 73 <Layout.Center style={[a.h_full, a.flex_1]} ignoreTabletLayoutOffset> 74 <View 75 testID="noSessionView" 76 style={[ 77 a.h_full, 78 a.justify_center, 79 // @ts-expect-error web only 80 {paddingBottom: '20vh'}, 81 isMobileWeb && a.pb_5xl, 82 t.atoms.border_contrast_medium, 83 a.align_center, 84 a.gap_5xl, 85 a.flex_1, 86 ]}> 87 <ErrorBoundary> 88 <View style={[a.justify_center, a.align_center]}> 89 <Logo width={kawaii ? 300 : 92} fill="sky" /> 90 91 {!kawaii && ( 92 <View style={[a.pb_sm, a.pt_5xl]}> 93 <Logotype width={161} fill={t.atoms.text.color} /> 94 </View> 95 )} 96 97 <Text 98 style={[a.text_md, a.font_bold, t.atoms.text_contrast_medium]}> 99 <Trans>What's up?</Trans> 100 </Text> 101 </View> 102 103 <View 104 testID="signinOrCreateAccount" 105 style={[a.w_full, a.px_xl, a.gap_md, a.pb_2xl, {maxWidth: 320}]}> 106 <Button 107 testID="createAccountButton" 108 onPress={onPressCreateAccount} 109 label={_(msg`Create new account`)} 110 accessibilityHint={_( 111 msg`Opens flow to create a new Bluesky account`, 112 )} 113 size="large" 114 variant="solid" 115 color="primary"> 116 <ButtonText> 117 <Trans>Create account</Trans> 118 </ButtonText> 119 </Button> 120 <Button 121 testID="signInButton" 122 onPress={onPressSignin} 123 label={_(msg`Sign in`)} 124 accessibilityHint={_( 125 msg`Opens flow to sign in to your existing Bluesky account`, 126 )} 127 size="large" 128 variant="solid" 129 color="secondary"> 130 <ButtonText> 131 <Trans>Sign in</Trans> 132 </ButtonText> 133 </Button> 134 </View> 135 </ErrorBoundary> 136 </View> 137 <Footer /> 138 </Layout.Center> 139 <AppClipOverlay 140 visible={showClipOverlay} 141 setIsVisible={setShowClipOverlay} 142 /> 143 </> 144 ) 145} 146 147function Footer() { 148 const t = useTheme() 149 const {_} = useLingui() 150 151 return ( 152 <View 153 style={[ 154 a.absolute, 155 a.inset_0, 156 {top: 'auto'}, 157 a.px_xl, 158 a.py_lg, 159 a.border_t, 160 a.flex_row, 161 a.align_center, 162 a.flex_wrap, 163 a.gap_xl, 164 a.flex_1, 165 t.atoms.border_contrast_medium, 166 ]}> 167 <InlineLinkText 168 label={_(msg`Learn more about Bluesky`)} 169 to="https://bsky.social"> 170 <Trans>Business</Trans> 171 </InlineLinkText> 172 <InlineLinkText 173 label={_(msg`Read the Bluesky blog`)} 174 to="https://bsky.social/about/blog"> 175 <Trans>Blog</Trans> 176 </InlineLinkText> 177 <InlineLinkText 178 label={_(msg`See jobs at Bluesky`)} 179 to="https://bsky.social/about/join"> 180 <Trans comment="Link to a page with job openings at Bluesky"> 181 Jobs 182 </Trans> 183 </InlineLinkText> 184 185 <View style={a.flex_1} /> 186 187 <AppLanguageDropdown /> 188 </View> 189 ) 190}