Handle logged out mobile web better

zio/stable
Paul Frazee 2023-03-14 14:59:37 -05:00
parent 41f4385db9
commit 528e14fe90
4 changed files with 118 additions and 52 deletions

View File

@ -1,11 +1,14 @@
import React from 'react' import React from 'react'
import {StyleSheet, TouchableOpacity, View} from 'react-native' import {StyleSheet, TouchableOpacity, View} from 'react-native'
import {Text} from 'view/com/util/text/Text' import {Text} from 'view/com/util/text/Text'
import {TextLink} from '../util/Link'
import {ErrorBoundary} from 'view/com/util/ErrorBoundary' import {ErrorBoundary} from 'view/com/util/ErrorBoundary'
import {s, colors} from 'lib/styles' import {s, colors} from 'lib/styles'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {CenteredView} from '../util/Views' import {CenteredView} from '../util/Views'
import {isDesktopWeb, isMobileWeb} from 'platform/detection'
import {HelpTip} from './util/HelpTip'
export const SplashScreen = ({ export const SplashScreen = ({
onPressSignin, onPressSignin,
@ -23,10 +26,21 @@ export const SplashScreen = ({
return ( return (
<CenteredView style={[styles.container, pal.view]}> <CenteredView style={[styles.container, pal.view]}>
<View testID="noSessionView" style={[styles.containerInner, pal.border]}> <View
testID="noSessionView"
style={[
styles.containerInner,
isMobileWeb && styles.containerInnerMobile,
pal.border,
]}>
<ErrorBoundary> <ErrorBoundary>
<Text style={styles.title}>Bluesky</Text> <Text style={isMobileWeb ? styles.titleMobile : styles.title}>
<Text style={styles.subtitle}>See what's next</Text> Bluesky
</Text>
<Text style={isMobileWeb ? styles.subtitleMobile : styles.subtitle}>
See what's next
</Text>
{isDesktopWeb && (
<View testID="signinOrCreateAccount" style={styles.btns}> <View testID="signinOrCreateAccount" style={styles.btns}>
<TouchableOpacity <TouchableOpacity
testID="createAccountButton" testID="createAccountButton"
@ -43,6 +57,7 @@ export const SplashScreen = ({
<Text style={[pal.text, styles.btnLabel]}>Sign in</Text> <Text style={[pal.text, styles.btnLabel]}>Sign in</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
)}
<Text <Text
type="xl" type="xl"
style={[styles.notice, pal.textLight]} style={[styles.notice, pal.textLight]}
@ -55,22 +70,56 @@ export const SplashScreen = ({
</TouchableOpacity>{' '} </TouchableOpacity>{' '}
to try the beta before it's publicly available. to try the beta before it's publicly available.
</Text> </Text>
{isMobileWeb && (
<>
<View style={[s.p20, s.mt10]}>
<HelpTip text="Beta testers: the mobile web app isn't quite ready yet. Log in on desktop web or using the iPhone app." />
</View>
</>
)}
</ErrorBoundary> </ErrorBoundary>
</View> </View>
<Footer />
</CenteredView> </CenteredView>
) )
} }
function Footer() {
const pal = usePalette('default')
return (
<View style={[styles.footer, pal.view, pal.border]}>
<TextLink
href="https://blueskyweb.xyz"
text="Business"
style={[styles.footerLink, pal.link]}
/>
<TextLink
href="https://blueskyweb.xyz/blog"
text="Blog"
style={[styles.footerLink, pal.link]}
/>
<TextLink
href="https://blueskyweb.xyz/join"
text="Jobs"
style={[styles.footerLink, pal.link]}
/>
</View>
)
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
height: '100%', height: '100%',
}, },
containerInner: { containerInner: {
borderBottomWidth: 1, height: '100%',
paddingVertical: 40, justifyContent: 'center',
paddingBottom: 50, paddingBottom: '20vh',
paddingHorizontal: 20, paddingHorizontal: 20,
}, },
containerInnerMobile: {
paddingBottom: 50,
},
title: { title: {
textAlign: 'center', textAlign: 'center',
color: colors.blue3, color: colors.blue3,
@ -78,6 +127,12 @@ const styles = StyleSheet.create({
fontWeight: 'bold', fontWeight: 'bold',
paddingBottom: 10, paddingBottom: 10,
}, },
titleMobile: {
textAlign: 'center',
color: colors.blue3,
fontSize: 58,
fontWeight: 'bold',
},
subtitle: { subtitle: {
textAlign: 'center', textAlign: 'center',
color: colors.gray5, color: colors.gray5,
@ -85,6 +140,13 @@ const styles = StyleSheet.create({
fontWeight: 'bold', fontWeight: 'bold',
paddingBottom: 30, paddingBottom: 30,
}, },
subtitleMobile: {
textAlign: 'center',
color: colors.gray5,
fontSize: 42,
fontWeight: 'bold',
paddingBottom: 30,
},
btns: { btns: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'center', justifyContent: 'center',
@ -105,4 +167,16 @@ const styles = StyleSheet.create({
paddingHorizontal: 40, paddingHorizontal: 40,
textAlign: 'center', textAlign: 'center',
}, },
footer: {
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
padding: 20,
borderTopWidth: 1,
flexDirection: 'row',
},
footerLink: {
marginRight: 20,
},
}) })

View File

@ -13,8 +13,10 @@ export function HelpTip({text}: {text: string}) {
const fg = useColorSchemeStyle({color: colors.gray5}, {color: colors.gray4}) const fg = useColorSchemeStyle({color: colors.gray5}, {color: colors.gray4})
return ( return (
<View style={[styles.helptip, bg]}> <View style={[styles.helptip, bg]}>
<View style={styles.icon}>
<InfoCircleIcon size={18} style={fg} strokeWidth={1.5} /> <InfoCircleIcon size={18} style={fg} strokeWidth={1.5} />
<Text type="xs-medium" style={[fg, s.ml5]}> </View>
<Text type="xs-medium" style={[fg, s.ml5, s.flex1]}>
{text} {text}
</Text> </Text>
</View> </View>
@ -22,9 +24,12 @@ export function HelpTip({text}: {text: string}) {
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
icon: {
width: 18,
},
helptip: { helptip: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'flex-start',
borderRadius: 6, borderRadius: 6,
paddingHorizontal: 10, paddingHorizontal: 10,
paddingVertical: 8, paddingVertical: 8,

View File

@ -4,6 +4,7 @@ import {observer} from 'mobx-react-lite'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import type {Modal as ModalIface} from 'state/models/ui/shell' import type {Modal as ModalIface} from 'state/models/ui/shell'
import {isMobileWeb} from 'platform/detection'
import * as ConfirmModal from './Confirm' import * as ConfirmModal from './Confirm'
import * as EditProfileModal from './EditProfile' import * as EditProfileModal from './EditProfile'
@ -79,7 +80,14 @@ function Modal({modal}: {modal: ModalIface}) {
<TouchableWithoutFeedback onPress={onPressMask}> <TouchableWithoutFeedback onPress={onPressMask}>
<View style={styles.mask}> <View style={styles.mask}>
<TouchableWithoutFeedback onPress={onInnerPress}> <TouchableWithoutFeedback onPress={onInnerPress}>
<View style={[styles.container, pal.view]}>{element}</View> <View
style={[
styles.container,
isMobileWeb && styles.containerMobile,
pal.view,
]}>
{element}
</View>
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
</View> </View>
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
@ -99,8 +107,13 @@ const styles = StyleSheet.create({
}, },
container: { container: {
width: 500, width: 500,
maxWidth: '100vw',
paddingVertical: 20, paddingVertical: 20,
paddingHorizontal: 24, paddingHorizontal: 24,
borderRadius: 8, borderRadius: 8,
}, },
containerMobile: {
borderRadius: 0,
paddingHorizontal: 0,
},
}) })

View File

@ -12,7 +12,6 @@ import {Composer} from './Composer.web'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle' import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle'
import {s, colors} from 'lib/styles' import {s, colors} from 'lib/styles'
import {isMobileWeb} from 'platform/detection'
import {RoutesContainer, FlatNavigator} from '../../Navigation' import {RoutesContainer, FlatNavigator} from '../../Navigation'
const ShellInner = observer(() => { const ShellInner = observer(() => {
@ -44,10 +43,6 @@ const ShellInner = observer(() => {
export const Shell: React.FC = observer(() => { export const Shell: React.FC = observer(() => {
const pageBg = useColorSchemeStyle(styles.bgLight, styles.bgDark) const pageBg = useColorSchemeStyle(styles.bgLight, styles.bgDark)
if (isMobileWeb) {
return <NoMobileWeb />
}
return ( return (
<View style={[s.hContentRegion, pageBg]}> <View style={[s.hContentRegion, pageBg]}>
<RoutesContainer> <RoutesContainer>
@ -57,21 +52,6 @@ export const Shell: React.FC = observer(() => {
) )
}) })
function NoMobileWeb() {
const pal = usePalette('default')
return (
<View style={[pal.view, styles.noMobileWeb]}>
<Text type="title-2xl" style={s.pb20}>
We're so sorry!
</Text>
<Text type="lg">
This app is not available for mobile Web yet. Please open it on your
desktop or download the iOS app.
</Text>
</View>
)
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
bgLight: { bgLight: {
backgroundColor: colors.white, backgroundColor: colors.white,
@ -92,10 +72,4 @@ const styles = StyleSheet.create({
viewBorderRight: { viewBorderRight: {
left: 'calc(50vw + 300px)', left: 'calc(50vw + 300px)',
}, },
noMobileWeb: {
height: '100%',
justifyContent: 'center',
paddingHorizontal: 20,
paddingBottom: 40,
},
}) })