diff --git a/src/navigation/MainNavigator.js b/src/navigation/MainNavigator.js index ce401b4..9c2dc3a 100644 --- a/src/navigation/MainNavigator.js +++ b/src/navigation/MainNavigator.js @@ -9,6 +9,27 @@ import {createStackNavigator, TransitionPresets} from "@react-navigation/stack"; import i18n from "i18n-js"; import TabNavigator from "./TabNavigator"; import TetrisScreen from "../screens/Tetris/TetrisScreen"; +import VoteScreen from "../screens/Amicale/VoteScreen"; +import LoginScreen from "../screens/Amicale/LoginScreen"; +import {useTheme} from "react-native-paper"; +import {createCollapsibleStack} from "react-navigation-collapsible"; +import {Platform} from "react-native"; +import AvailableRoomScreen from "../screens/Websites/AvailableRoomScreen"; +import BibScreen from "../screens/Websites/BibScreen"; +import SelfMenuScreen from "../screens/Services/SelfMenuScreen"; +import ProximoMainScreen from "../screens/Proximo/ProximoMainScreen"; +import ProximoListScreen from "../screens/Proximo/ProximoListScreen"; +import ProximoAboutScreen from "../screens/Proximo/ProximoAboutScreen"; +import {AmicaleWebsiteScreen} from "../screens/Websites/AmicaleWebsiteScreen"; +import {ElusEtudiantsWebsiteScreen} from "../screens/Websites/ElusEtudiantsWebsiteScreen"; +import {WiketudWebsiteScreen} from "../screens/Websites/WiketudWebsiteScreen"; +import {TutorInsaWebsiteScreen} from "../screens/Websites/TutorInsaWebsiteScreen"; +import {ENTWebsiteScreen} from "../screens/Websites/ENTWebsiteScreen"; +import {BlueMindWebsiteScreen} from "../screens/Websites/BlueMindWebsiteScreen"; +import ProfileScreen from "../screens/Amicale/ProfileScreen"; +import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen"; +import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen"; +import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen"; const defaultScreenOptions = { gestureEnabled: true, @@ -16,6 +37,42 @@ const defaultScreenOptions = { ...TransitionPresets.SlideFromRightIOS, }; +const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS; + +const screenTransition = Platform.OS === 'ios' ? TransitionPresets.SlideFromRightIOS : TransitionPresets.ScaleFromCenterAndroid; + +function createScreenCollapsibleStack( + name: string, + Stack: any, + component: any, + title: string, + useNativeDriver?: boolean, + options?: { [key: string]: any }) { + const {colors} = useTheme(); + const screenOptions = options != null ? options : {}; + return createCollapsibleStack( + , + { + collapsedColor: 'transparent', + useNativeDriver: useNativeDriver != null ? useNativeDriver : true, // native driver does not work with webview + } + ) +} + +function getWebsiteStack(name: string, Stack: any, component: any, title: string) { + return createScreenCollapsibleStack(name, Stack, component, title, false); +} + const MainStack = createStackNavigator(); function MainStackComponent(props: { createTabNavigator: () => React.Node }) { @@ -67,6 +124,70 @@ function MainStackComponent(props: { createTabNavigator: () => React.Node }) { title: i18n.t("game.title"), }} /> + + + {/* INSA */} + {getWebsiteStack("available-rooms", MainStack, AvailableRoomScreen, i18n.t('screens.availableRooms'))} + {getWebsiteStack("bib", MainStack, BibScreen, i18n.t('screens.bib'))} + {createScreenCollapsibleStack("self-menu", MainStack, SelfMenuScreen, i18n.t('screens.menuSelf'))} + + {/* STUDENTS */} + {createScreenCollapsibleStack("proximo", MainStack, ProximoMainScreen, i18n.t('screens.proximo'))} + {createScreenCollapsibleStack( + "proximo-list", + MainStack, + ProximoListScreen, + i18n.t('screens.proximoArticles'), + true, + {...screenTransition}, + )} + + {getWebsiteStack("amicale-website", MainStack, AmicaleWebsiteScreen, i18n.t('screens.amicaleWebsite'))} + {getWebsiteStack("elus-etudiants", MainStack, ElusEtudiantsWebsiteScreen, "Élus Étudiants")} + {getWebsiteStack("wiketud", MainStack, WiketudWebsiteScreen, "Wiketud")} + {getWebsiteStack("tutorinsa", MainStack, TutorInsaWebsiteScreen, "Tutor'INSA")} + {getWebsiteStack("ent", MainStack, ENTWebsiteScreen, i18n.t('screens.ent'))} + {getWebsiteStack("bluemind", MainStack, BlueMindWebsiteScreen, i18n.t('screens.bluemind'))} + + + {/* AMICALE */} + {createScreenCollapsibleStack("profile", MainStack, ProfileScreen, i18n.t('screens.profile'))} + {createScreenCollapsibleStack("club-list", MainStack, ClubListScreen, i18n.t('clubs.clubList'))} + + + ); } diff --git a/src/navigation/TabNavigator.js b/src/navigation/TabNavigator.js index 4ee468b..13f9e76 100644 --- a/src/navigation/TabNavigator.js +++ b/src/navigation/TabNavigator.js @@ -7,9 +7,6 @@ import PlanningScreen from '../screens/Planning/PlanningScreen'; import PlanningDisplayScreen from '../screens/Planning/PlanningDisplayScreen'; import ProxiwashScreen from '../screens/Proxiwash/ProxiwashScreen'; import ProxiwashAboutScreen from '../screens/Proxiwash/ProxiwashAboutScreen'; -import ProximoMainScreen from '../screens/Proximo/ProximoMainScreen'; -import ProximoListScreen from "../screens/Proximo/ProximoListScreen"; -import ProximoAboutScreen from "../screens/Proximo/ProximoAboutScreen"; import PlanexScreen from '../screens/Planex/PlanexScreen'; import AsyncStorageManager from "../managers/AsyncStorageManager"; import {useTheme} from 'react-native-paper'; @@ -21,21 +18,6 @@ import FeedItemScreen from "../screens/Home/FeedItemScreen"; import {createCollapsibleStack} from "react-navigation-collapsible"; import GroupSelectionScreen from "../screens/Planex/GroupSelectionScreen"; import CustomTabBar from "../components/Tabbar/CustomTabBar"; -import SelfMenuScreen from "../screens/Services/SelfMenuScreen"; -import AvailableRoomScreen from "../screens/Websites/AvailableRoomScreen"; -import BibScreen from "../screens/Websites/BibScreen"; -import {AmicaleWebsiteScreen} from "../screens/Websites/AmicaleWebsiteScreen"; -import {ElusEtudiantsWebsiteScreen} from "../screens/Websites/ElusEtudiantsWebsiteScreen"; -import {WiketudWebsiteScreen} from "../screens/Websites/WiketudWebsiteScreen"; -import {TutorInsaWebsiteScreen} from "../screens/Websites/TutorInsaWebsiteScreen"; -import {ENTWebsiteScreen} from "../screens/Websites/ENTWebsiteScreen"; -import {BlueMindWebsiteScreen} from "../screens/Websites/BlueMindWebsiteScreen"; -import LoginScreen from "../screens/Amicale/LoginScreen"; -import ProfileScreen from "../screens/Amicale/ProfileScreen"; -import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen"; -import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen"; -import VoteScreen from "../screens/Amicale/VoteScreen"; -import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen"; import WebsitesHomeScreen from "../screens/Services/ServicesScreen"; import ServicesSectionScreen from "../screens/Services/ServicesSectionScreen"; @@ -47,8 +29,6 @@ const defaultScreenOptions = { const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS; -const screenTransition = Platform.OS === 'ios' ? TransitionPresets.SlideFromRightIOS : TransitionPresets.ScaleFromCenterAndroid; - function createScreenCollapsibleStack( name: string, Stack: any, @@ -93,64 +73,6 @@ function ServicesStackComponent() { > {createScreenCollapsibleStack("index", ServicesStack, WebsitesHomeScreen, i18n.t('screens.services'))} {createScreenCollapsibleStack("services-section", ServicesStack, ServicesSectionScreen, "SECTION")} - - {/* INSA */} - {getWebsiteStack("available-rooms", ServicesStack, AvailableRoomScreen, i18n.t('screens.availableRooms'))} - {getWebsiteStack("bib", ServicesStack, BibScreen, i18n.t('screens.bib'))} - {createScreenCollapsibleStack("self-menu", ServicesStack, SelfMenuScreen, i18n.t('screens.menuSelf'))} - - {/* STUDENTS */} - {createScreenCollapsibleStack("proximo", ServicesStack, ProximoMainScreen, i18n.t('screens.proximo'))} - {createScreenCollapsibleStack( - "proximo-list", - ServicesStack, - ProximoListScreen, - i18n.t('screens.proximoArticles'), - true, - {...screenTransition}, - )} - - {getWebsiteStack("amicale-website", ServicesStack, AmicaleWebsiteScreen, i18n.t('screens.amicaleWebsite'))} - {getWebsiteStack("elus-etudiants", ServicesStack, ElusEtudiantsWebsiteScreen, "Élus Étudiants")} - {getWebsiteStack("wiketud", ServicesStack, WiketudWebsiteScreen, "Wiketud")} - {getWebsiteStack("tutorinsa", ServicesStack, TutorInsaWebsiteScreen, "Tutor'INSA")} - {getWebsiteStack("ent", ServicesStack, ENTWebsiteScreen, i18n.t('screens.ent'))} - {getWebsiteStack("bluemind", ServicesStack, BlueMindWebsiteScreen, i18n.t('screens.bluemind'))} - - - {/* AMICALE */} - {createScreenCollapsibleStack("login", ServicesStack, LoginScreen, i18n.t('screens.login'))} - {createScreenCollapsibleStack("profile", ServicesStack, ProfileScreen, i18n.t('screens.profile'))} - {createScreenCollapsibleStack("club-list", ServicesStack, ClubListScreen, i18n.t('clubs.clubList'))} - - - ); } @@ -267,8 +189,6 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st ...modalTransition, }} /> - {createScreenCollapsibleStack("self-menu", HomeStack, SelfMenuScreen, i18n.t('screens.menuSelf'), true, {...modalTransition})} - {createScreenCollapsibleStack("login", HomeStack, LoginScreen, i18n.t('screens.login'))} ); } diff --git a/src/screens/Home/HomeScreen.js b/src/screens/Home/HomeScreen.js index b87fede..22f2da3 100644 --- a/src/screens/Home/HomeScreen.js +++ b/src/screens/Home/HomeScreen.js @@ -192,11 +192,11 @@ class HomeScreen extends React.Component { }; onProximoClick = () => { - this.props.navigation.navigate('services', {screen: "index"}); + this.props.navigation.navigate("proximo"); }; onTutorInsaClick = () => { - this.props.navigation.navigate('services', {screen: "index"}); + this.props.navigation.navigate("tutorinsa"); }; onMenuClick = () => {