diff options
Diffstat (limited to 'src/view/screens/tabroots')
-rw-r--r-- | src/view/screens/tabroots/Home.tsx | 59 | ||||
-rw-r--r-- | src/view/screens/tabroots/Login.tsx | 31 | ||||
-rw-r--r-- | src/view/screens/tabroots/Menu.tsx | 16 | ||||
-rw-r--r-- | src/view/screens/tabroots/NotFound.tsx | 15 | ||||
-rw-r--r-- | src/view/screens/tabroots/Notifications.tsx | 16 | ||||
-rw-r--r-- | src/view/screens/tabroots/Search.tsx | 14 | ||||
-rw-r--r-- | src/view/screens/tabroots/Signup.tsx | 34 |
7 files changed, 185 insertions, 0 deletions
diff --git a/src/view/screens/tabroots/Home.tsx b/src/view/screens/tabroots/Home.tsx new file mode 100644 index 000000000..446a5a7e9 --- /dev/null +++ b/src/view/screens/tabroots/Home.tsx @@ -0,0 +1,59 @@ +import React, {useEffect, useLayoutEffect} from 'react' +import {Image, StyleSheet, TouchableOpacity, View} from 'react-native' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {Shell} from '../../shell' +import {Feed} from '../../com/feed/Feed' +import type {RootTabsScreenProps} from '../../routes/types' +import {useStores} from '../../../state' +import {AVIS} from '../../lib/assets' + +export function Home({navigation}: RootTabsScreenProps<'HomeTab'>) { + const store = useStores() + useEffect(() => { + console.log('Fetching home feed') + store.homeFeed.setup() + }, [store.homeFeed]) + + const onNavigateContent = (screen: string, props: Record<string, string>) => { + // @ts-ignore it's up to the callers to supply correct params -prf + navigation.navigate(screen, props) + } + + useLayoutEffect(() => { + navigation.setOptions({ + headerShown: true, + headerTitle: 'V I B E', + headerLeft: () => ( + <TouchableOpacity + onPress={() => navigation.push('Profile', {name: 'alice.com'})}> + <Image source={AVIS['alice.com']} style={styles.avi} /> + </TouchableOpacity> + ), + headerRight: () => ( + <TouchableOpacity + onPress={() => { + navigation.push('Composer', {}) + }}> + <FontAwesomeIcon icon="plus" style={{color: '#006bf7'}} /> + </TouchableOpacity> + ), + }) + }, [navigation]) + + return ( + <Shell> + <View> + <Feed feed={store.homeFeed} onNavigateContent={onNavigateContent} /> + </View> + </Shell> + ) +} + +const styles = StyleSheet.create({ + avi: { + width: 20, + height: 20, + borderRadius: 10, + resizeMode: 'cover', + }, +}) diff --git a/src/view/screens/tabroots/Login.tsx b/src/view/screens/tabroots/Login.tsx new file mode 100644 index 000000000..a5f670bdd --- /dev/null +++ b/src/view/screens/tabroots/Login.tsx @@ -0,0 +1,31 @@ +import React from 'react' +import {Text, View} from 'react-native' +import {observer} from 'mobx-react-lite' +import {Shell} from '../../shell' +// import type {RootTabsScreenProps} from '../routes/types' +// import {useStores} from '../../state' + +export const Login = observer( + (/*{navigation}: RootTabsScreenProps<'Login'>*/) => { + // const store = useStores() + return ( + <Shell> + <View style={{justifyContent: 'center', alignItems: 'center'}}> + <Text style={{fontSize: 20, fontWeight: 'bold'}}>Sign In</Text> + {/*store.session.uiError && <Text>{store.session.uiError}</Text>} + {!store.session.uiIsProcessing ? ( + <> + <Button title="Login" onPress={() => store.session.login()} /> + <Button + title="Sign Up" + onPress={() => navigation.navigate('Signup')} + /> + </> + ) : ( + <ActivityIndicator /> + )*/} + </View> + </Shell> + ) + }, +) diff --git a/src/view/screens/tabroots/Menu.tsx b/src/view/screens/tabroots/Menu.tsx new file mode 100644 index 000000000..dca5ad33b --- /dev/null +++ b/src/view/screens/tabroots/Menu.tsx @@ -0,0 +1,16 @@ +import React from 'react' +import {Shell} from '../../shell' +import {ScrollView, Text, View} from 'react-native' +import type {RootTabsScreenProps} from '../../routes/types' + +export const Menu = (_props: RootTabsScreenProps<'MenuTab'>) => { + return ( + <Shell> + <ScrollView contentInsetAdjustmentBehavior="automatic"> + <View style={{justifyContent: 'center', alignItems: 'center'}}> + <Text style={{fontSize: 20, fontWeight: 'bold'}}>Menu</Text> + </View> + </ScrollView> + </Shell> + ) +} diff --git a/src/view/screens/tabroots/NotFound.tsx b/src/view/screens/tabroots/NotFound.tsx new file mode 100644 index 000000000..a35808cbc --- /dev/null +++ b/src/view/screens/tabroots/NotFound.tsx @@ -0,0 +1,15 @@ +import React from 'react' +import {Shell} from '../../shell' +import {Text, Button, View} from 'react-native' +import type {RootTabsScreenProps} from '../../routes/types' + +export const NotFound = ({navigation}: RootTabsScreenProps<'NotFound'>) => { + return ( + <Shell> + <View style={{justifyContent: 'center', alignItems: 'center'}}> + <Text style={{fontSize: 20, fontWeight: 'bold'}}>Page not found</Text> + <Button title="Home" onPress={() => navigation.navigate('HomeTab')} /> + </View> + </Shell> + ) +} diff --git a/src/view/screens/tabroots/Notifications.tsx b/src/view/screens/tabroots/Notifications.tsx new file mode 100644 index 000000000..091410ad8 --- /dev/null +++ b/src/view/screens/tabroots/Notifications.tsx @@ -0,0 +1,16 @@ +import React from 'react' +import {Shell} from '../../shell' +import {Text, View} from 'react-native' +import type {RootTabsScreenProps} from '../../routes/types' + +export const Notifications = ( + _props: RootTabsScreenProps<'NotificationsTab'>, +) => { + return ( + <Shell> + <View style={{justifyContent: 'center', alignItems: 'center'}}> + <Text style={{fontSize: 20, fontWeight: 'bold'}}>Notifications</Text> + </View> + </Shell> + ) +} diff --git a/src/view/screens/tabroots/Search.tsx b/src/view/screens/tabroots/Search.tsx new file mode 100644 index 000000000..044ca749c --- /dev/null +++ b/src/view/screens/tabroots/Search.tsx @@ -0,0 +1,14 @@ +import React from 'react' +import {Shell} from '../../shell' +import {Text, View} from 'react-native' +import type {RootTabsScreenProps} from '../../routes/types' + +export const Search = (_props: RootTabsScreenProps<'SearchTab'>) => { + return ( + <Shell> + <View style={{justifyContent: 'center', alignItems: 'center'}}> + <Text style={{fontSize: 20, fontWeight: 'bold'}}>Search</Text> + </View> + </Shell> + ) +} diff --git a/src/view/screens/tabroots/Signup.tsx b/src/view/screens/tabroots/Signup.tsx new file mode 100644 index 000000000..dc2af2b1e --- /dev/null +++ b/src/view/screens/tabroots/Signup.tsx @@ -0,0 +1,34 @@ +import React from 'react' +import {Text, View} from 'react-native' +import {observer} from 'mobx-react-lite' +import {Shell} from '../../shell' +// import type {RootTabsScreenProps} from '../routes/types' +// import {useStores} from '../../state' + +export const Signup = observer( + (/*{navigation}: RootTabsScreenProps<'Signup'>*/) => { + // const store = useStores() + return ( + <Shell> + <View style={{justifyContent: 'center', alignItems: 'center'}}> + <Text style={{fontSize: 20, fontWeight: 'bold'}}>Create Account</Text> + {/*store.session.uiError ?? <Text>{store.session.uiError}</Text>} + {!store.session.uiIsProcessing ? ( + <> + <Button + title="Create new account" + onPress={() => store.session.login()} + /> + <Button + title="Log in to an existing account" + onPress={() => navigation.navigate('Login')} + /> + </> + ) : ( + <ActivityIndicator /> + )*/} + </View> + </Shell> + ) + }, +) |