Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add search button to logged out view (#2237)

authored by

Eric Bailey and committed by
GitHub
726bbd2b 699749cb

+44 -3
+44 -3
src/view/com/auth/LoggedOut.tsx
··· 3 3 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' 4 4 import {useLingui} from '@lingui/react' 5 5 import {msg} from '@lingui/macro' 6 + import {useNavigation} from '@react-navigation/native' 6 7 7 - import {isIOS} from 'platform/detection' 8 + import {isIOS, isNative} from 'platform/detection' 8 9 import {Login} from 'view/com/auth/login/Login' 9 10 import {CreateAccount} from 'view/com/auth/create/CreateAccount' 10 11 import {ErrorBoundary} from 'view/com/util/ErrorBoundary' ··· 18 19 useLoggedOutView, 19 20 useLoggedOutViewControls, 20 21 } from '#/state/shell/logged-out' 22 + import {useSession} from '#/state/session' 23 + import {Text} from '#/view/com/util/text/Text' 24 + import {NavigationProp} from 'lib/routes/types' 21 25 22 26 enum ScreenState { 23 27 S_LoginOrCreateAccount, ··· 26 30 } 27 31 28 32 export function LoggedOut({onDismiss}: {onDismiss?: () => void}) { 33 + const {hasSession} = useSession() 29 34 const {_} = useLingui() 30 35 const pal = usePalette('default') 31 36 const setMinimalShellMode = useSetMinimalShellMode() ··· 40 45 ) 41 46 const {isMobile} = useWebMediaQueries() 42 47 const {clearRequestedAccount} = useLoggedOutViewControls() 48 + const navigation = useNavigation<NavigationProp>() 49 + const isFirstScreen = screenState === ScreenState.S_LoginOrCreateAccount 43 50 44 51 React.useEffect(() => { 45 52 screen('Login') ··· 53 60 clearRequestedAccount() 54 61 }, [clearRequestedAccount, onDismiss]) 55 62 63 + const onPressSearch = React.useCallback(() => { 64 + navigation.navigate(`SearchTab`) 65 + }, [navigation]) 66 + 56 67 return ( 57 68 <View 58 69 testID="noSessionView" ··· 65 76 }, 66 77 ]}> 67 78 <ErrorBoundary> 68 - {onDismiss && ( 79 + {onDismiss ? ( 69 80 <Pressable 70 81 accessibilityHint={_(msg`Go back`)} 71 82 accessibilityLabel={_(msg`Go back`)} ··· 88 99 }} 89 100 /> 90 101 </Pressable> 91 - )} 102 + ) : isNative && !hasSession && isFirstScreen ? ( 103 + <Pressable 104 + accessibilityHint={_(msg`Search for users`)} 105 + accessibilityLabel={_(msg`Search for users`)} 106 + accessibilityRole="button" 107 + style={{ 108 + flexDirection: 'row', 109 + alignItems: 'center', 110 + gap: 4, 111 + position: 'absolute', 112 + top: 20, 113 + right: 20, 114 + paddingHorizontal: 16, 115 + paddingVertical: 8, 116 + zIndex: 100, 117 + backgroundColor: pal.btn.backgroundColor, 118 + borderRadius: 100, 119 + }} 120 + onPress={onPressSearch}> 121 + <Text type="lg-bold" style={[pal.text]}> 122 + Search{' '} 123 + </Text> 124 + <FontAwesomeIcon 125 + icon="search" 126 + size={16} 127 + style={{ 128 + color: String(pal.text.color), 129 + }} 130 + /> 131 + </Pressable> 132 + ) : null} 92 133 93 134 {screenState === ScreenState.S_LoginOrCreateAccount ? ( 94 135 <SplashScreen