From c37e052aa2c4bf80c2af703f1651ad2c9983752c Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Tue, 21 Apr 2020 09:50:13 +0200 Subject: [PATCH] Removed drawer and put all links in home screen --- src/components/Home/ActionsDashboardItem.js | 78 ++--- src/navigation/DrawerNavigator.js | 220 ++++---------- src/navigation/MainTabNavigator.js | 306 +++++++++++--------- src/screens/Amicale/AmicaleHomeScreen.js | 85 ++++++ src/screens/Home/HomeScreen.js | 25 +- src/screens/Insa/InsaHomeScreen.js | 85 ++++++ src/screens/Websites/WebsitesHomeScreen.js | 79 +++++ src/utils/URLHandler.js | 2 +- 8 files changed, 503 insertions(+), 377 deletions(-) create mode 100644 src/screens/Amicale/AmicaleHomeScreen.js create mode 100644 src/screens/Insa/InsaHomeScreen.js create mode 100644 src/screens/Websites/WebsitesHomeScreen.js diff --git a/src/components/Home/ActionsDashboardItem.js b/src/components/Home/ActionsDashboardItem.js index 6c7f466..00175b2 100644 --- a/src/components/Home/ActionsDashboardItem.js +++ b/src/components/Home/ActionsDashboardItem.js @@ -1,12 +1,13 @@ // @flow import * as React from 'react'; -import {Button, Card, withTheme} from 'react-native-paper'; -import {Platform, StyleSheet} from "react-native"; -import i18n from 'i18n-js'; +import {Avatar, Card, List, withTheme} from 'react-native-paper'; +import {StyleSheet} from "react-native"; import {DrawerNavigationProp} from "@react-navigation/drawer"; import type {CustomTheme} from "../../managers/ThemeManager"; +const ICON_AMICALE = require("../../../assets/amicale.png"); + type Props = { navigation: DrawerNavigationProp, theme: CustomTheme, @@ -18,45 +19,37 @@ class ActionsDashBoardItem extends React.Component { return (nextProps.theme.dark !== this.props.theme.dark) } - openDrawer = () => this.props.navigation.openDrawer(); - - gotToSettings = () => this.props.navigation.navigate("settings"); - render() { return ( - - - { - // Leave space to fix ios icon position - Platform.OS === 'ios' - ? - : + + + + + + ); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + }, + card: { + margin: 10, + }, + header: { + fontSize: 36, + marginBottom: 48 + }, + textInput: {}, + btnContainer: { + marginTop: 5, + marginBottom: 10, + } +}); + +export default withTheme(AmicaleHomeScreen); diff --git a/src/screens/Home/HomeScreen.js b/src/screens/Home/HomeScreen.js index f1a75fc..c205526 100644 --- a/src/screens/Home/HomeScreen.js +++ b/src/screens/Home/HomeScreen.js @@ -11,7 +11,6 @@ import SquareDashboardItem from "../../components/Home/SmallDashboardItem"; import PreviewEventDashboardItem from "../../components/Home/PreviewEventDashboardItem"; import {stringToDate} from "../../utils/Planning"; import ActionsDashBoardItem from "../../components/Home/ActionsDashboardItem"; -import ConnectionManager from "../../managers/ConnectionManager"; import {CommonActions} from '@react-navigation/native'; import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton"; import AnimatedFAB from "../../components/Animations/AnimatedFAB"; @@ -103,14 +102,11 @@ class HomeScreen extends React.Component { colors: Object; - isLoggedIn: boolean | null; - fabRef: { current: null | AnimatedFAB }; constructor(props) { super(props); this.colors = props.theme.colors; - this.isLoggedIn = null; this.fabRef = React.createRef(); } @@ -132,12 +128,9 @@ class HomeScreen extends React.Component { } onScreenFocus = () => { - if (this.isLoggedIn !== ConnectionManager.getInstance().isLoggedIn()) { - this.isLoggedIn = ConnectionManager.getInstance().isLoggedIn(); - this.props.navigation.setOptions({ - headerRight: this.getHeaderButton, - }); - } + this.props.navigation.setOptions({ + headerRight: this.getHeaderButton, + }); // handle link open when home is not focused or created this.handleNavigationParams(); }; @@ -153,15 +146,11 @@ class HomeScreen extends React.Component { }; getHeaderButton = () => { - const screen = this.isLoggedIn - ? "profile" - : "login"; - const icon = this.isLoggedIn - ? "account" - : "login"; - const onPress = () => this.props.navigation.navigate(screen); + const onPressSettings = () => this.props.navigation.navigate("settings"); + const onPressAbout = () => this.props.navigation.navigate("about"); return - + + ; }; diff --git a/src/screens/Insa/InsaHomeScreen.js b/src/screens/Insa/InsaHomeScreen.js new file mode 100644 index 0000000..18ce834 --- /dev/null +++ b/src/screens/Insa/InsaHomeScreen.js @@ -0,0 +1,85 @@ +// @flow + +import * as React from 'react'; +import {ScrollView, StyleSheet} from "react-native"; +import {Button, withTheme} from 'react-native-paper'; + +type Props = { + navigation: Object, + route: Object, +} + +type State = {} + +class InsaHomeScreen extends React.Component { + + state = {}; + + colors: Object; + + constructor(props) { + super(props); + + this.colors = props.theme.colors; + } + + render() { + const nav = this.props.navigation; + return ( + + + + + + + + ); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + }, + card: { + margin: 10, + }, + header: { + fontSize: 36, + marginBottom: 48 + }, + textInput: {}, + btnContainer: { + marginTop: 5, + marginBottom: 10, + } +}); + +export default withTheme(InsaHomeScreen); diff --git a/src/screens/Websites/WebsitesHomeScreen.js b/src/screens/Websites/WebsitesHomeScreen.js new file mode 100644 index 0000000..afac6be --- /dev/null +++ b/src/screens/Websites/WebsitesHomeScreen.js @@ -0,0 +1,79 @@ +// @flow + +import * as React from 'react'; +import {ScrollView, StyleSheet} from "react-native"; +import {Button, withTheme} from 'react-native-paper'; + +type Props = { + navigation: Object, + route: Object, +} + +type State = {} + +class WebsitesHomeScreen extends React.Component { + + state = {}; + + colors: Object; + + constructor(props) { + super(props); + + this.colors = props.theme.colors; + } + + render() { + const nav = this.props.navigation; + return ( + + + + + + + ); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + }, + card: { + margin: 10, + }, + header: { + fontSize: 36, + marginBottom: 48 + }, + textInput: {}, + btnContainer: { + marginTop: 5, + marginBottom: 10, + } +}); + +export default withTheme(WebsitesHomeScreen); diff --git a/src/utils/URLHandler.js b/src/utils/URLHandler.js index eb83e16..a6e73c2 100644 --- a/src/utils/URLHandler.js +++ b/src/utils/URLHandler.js @@ -7,7 +7,7 @@ export default class URLHandler { static CLUB_INFO_URL_PATH = "club"; static EVENT_INFO_URL_PATH = "event"; - static CLUB_INFO_ROUTE = "home-club-information"; + static CLUB_INFO_ROUTE = "club-information"; static EVENT_INFO_ROUTE = "home-planning-information"; onInitialURLParsed: Function;