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