Fix auth flow, FAB, and and load latest button

This commit is contained in:
Samuel Newman
2024-04-10 15:52:30 +01:00
parent 0bbfe966d8
commit ea7a672ae8
5 changed files with 25 additions and 20 deletions
+3 -1
View File
@@ -58,7 +58,9 @@ export const SplashScreen = ({
<Trans>What's up?</Trans> <Trans>What's up?</Trans>
</Text> </Text>
</View> </View>
<View testID="signinOrCreateAccount"> <View
testID="signinOrCreateAccount"
style={[a.w_full, a.mx_auto, {maxWidth: 450}]}>
<Button <Button
testID="createAccountButton" testID="createAccountButton"
onPress={onPressCreateAccount} onPress={onPressCreateAccount}
+10 -8
View File
@@ -1,11 +1,12 @@
import React, {useRef, useMemo, useEffect, useState, useCallback} from 'react' import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
import {StyleSheet, View, ScrollView, LayoutChangeEvent} from 'react-native' import {LayoutChangeEvent, ScrollView, StyleSheet, View} from 'react-native'
import {Text} from '../util/text/Text'
import {PressableWithHover} from '../util/PressableWithHover' import {isNative, isNativeTablet} from '#/platform/detection'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
import {PressableWithHover} from '../util/PressableWithHover'
import {Text} from '../util/text/Text'
import {DraggableScrollView} from './DraggableScrollView' import {DraggableScrollView} from './DraggableScrollView'
import {isNative} from '#/platform/detection'
export interface TabBarProps { export interface TabBarProps {
testID?: string testID?: string
@@ -36,8 +37,9 @@ export function TabBar({
() => ({borderBottomColor: indicatorColor || pal.colors.link}), () => ({borderBottomColor: indicatorColor || pal.colors.link}),
[indicatorColor, pal], [indicatorColor, pal],
) )
const {isDesktop, isTablet} = useWebMediaQueries() const {isTabletOrDesktop} = useWebMediaQueries()
const styles = isDesktop || isTablet ? desktopStyles : mobileStyles const styles =
isTabletOrDesktop && !isNativeTablet ? desktopStyles : mobileStyles
useEffect(() => { useEffect(() => {
if (isNative) { if (isNative) {
@@ -137,7 +139,7 @@ export function TabBar({
onPress={() => onPressItem(i)}> onPress={() => onPressItem(i)}>
<View style={[styles.itemInner, selected && indicatorStyle]}> <View style={[styles.itemInner, selected && indicatorStyle]}>
<Text <Text
type={isDesktop || isTablet ? 'xl-bold' : 'lg-bold'} type={isTabletOrDesktop ? 'xl-bold' : 'lg-bold'}
testID={testID ? `${testID}-${item}` : undefined} testID={testID ? `${testID}-${item}` : undefined}
style={selected ? pal.text : pal.textLight}> style={selected ? pal.text : pal.textLight}>
{item} {item}
+2 -2
View File
@@ -4,7 +4,7 @@ import Animated from 'react-native-reanimated'
import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {LinearGradient} from 'expo-linear-gradient' import {LinearGradient} from 'expo-linear-gradient'
import {isWeb} from '#/platform/detection' import {isNativeTablet, isWeb} from '#/platform/detection'
import {useMinimalShellMode} from 'lib/hooks/useMinimalShellMode' import {useMinimalShellMode} from 'lib/hooks/useMinimalShellMode'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
import {clamp} from 'lib/numbers' import {clamp} from 'lib/numbers'
@@ -40,7 +40,7 @@ export function FABInner({testID, icon, ...props}: FABProps) {
styles.outer, styles.outer,
size, size,
tabletSpacing, tabletSpacing,
isMobile && fabMinimalShellTransform, (isMobile || isNativeTablet) && fabMinimalShellTransform,
]}> ]}>
<LinearGradient <LinearGradient
colors={[gradients.blueLight.start, gradients.blueLight.end]} colors={[gradients.blueLight.start, gradients.blueLight.end]}
@@ -1,7 +1,6 @@
import React from 'react' import React from 'react'
import {ScrollView, StyleSheet, View} from 'react-native' import {ScrollView, StyleSheet, View} from 'react-native'
import {isWeb} from '#/platform/detection'
import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle' import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
@@ -73,9 +72,7 @@ export const LoggedOutLayout = ({
contentContainerStyle={styles.scrollViewContentContainer} contentContainerStyle={styles.scrollViewContentContainer}
keyboardShouldPersistTaps="handled" keyboardShouldPersistTaps="handled"
keyboardDismissMode="on-drag"> keyboardDismissMode="on-drag">
<View style={[styles.contentWrapper, isWeb && a.my_auto]}> <View style={[styles.contentWrapper]}>{children}</View>
{children}
</View>
</ScrollView> </ScrollView>
</View> </View>
) : ( ) : (
@@ -92,6 +89,7 @@ const styles = StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
// @ts-ignore web only // @ts-ignore web only
height: '100vh', height: '100vh',
flex: 1,
}, },
side: { side: {
flex: 1, flex: 1,
@@ -111,8 +109,9 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
}, },
scrollViewContentContainer: { scrollViewContentContainer: {
flex: 1, flexGrow: 1,
paddingHorizontal: 40, paddingHorizontal: 40,
justifyContent: 'center',
}, },
leadinText: { leadinText: {
fontSize: 36, fontSize: 36,
@@ -11,7 +11,7 @@ import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
import {colors} from 'lib/styles' import {colors} from 'lib/styles'
const AnimatedTouchableOpacity = const AnimatedTouchableOpacity =
Animated.createAnimatedComponent(TouchableOpacity) Animated.createAnimatedComponent(TouchableOpacity)
import {isWeb} from 'platform/detection' import {isNativeTablet, isWeb} from 'platform/detection'
import {useSession} from 'state/session' import {useSession} from 'state/session'
export function LoadLatestBtn({ export function LoadLatestBtn({
@@ -33,7 +33,9 @@ export function LoadLatestBtn({
// Adjust height of the fab if we have a session only on mobile web. If we don't have a session, we want to adjust // Adjust height of the fab if we have a session only on mobile web. If we don't have a session, we want to adjust
// it on both tablet and mobile since we are showing the bottom bar (see createNativeStackNavigatorWithAuth) // it on both tablet and mobile since we are showing the bottom bar (see createNativeStackNavigatorWithAuth)
const showBottomBar = hasSession ? isMobile : isTabletOrMobile const showBottomBar = hasSession
? isMobile || isNativeTablet
: isTabletOrMobile
return ( return (
<AnimatedTouchableOpacity <AnimatedTouchableOpacity
@@ -43,7 +45,7 @@ export function LoadLatestBtn({
(isTallViewport (isTallViewport
? styles.loadLatestOutOfLine ? styles.loadLatestOutOfLine
: styles.loadLatestInline), : styles.loadLatestInline),
isTablet && styles.loadLatestInline, isTablet && !isNativeTablet && styles.loadLatestInline,
pal.borderDark, pal.borderDark,
pal.view, pal.view,
showBottomBar && fabMinimalShellTransform, showBottomBar && fabMinimalShellTransform,
@@ -73,9 +75,9 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
}, },
// @ts-ignore web only
loadLatestInline: isWeb loadLatestInline: isWeb
? { ? {
// @ts-ignore web only
left: 'calc(50vw - 282px)', left: 'calc(50vw - 282px)',
} }
: {}, : {},