From 1816175659d80c4fa655267c1c8ae72826d2e24e Mon Sep 17 00:00:00 2001 From: keplyx Date: Thu, 30 Jan 2020 17:42:11 +0100 Subject: [PATCH] Added bluemind screen, reworked sidemenu and changed planex default zoom --- components/CustomHeader.js | 8 -- components/Sidebar.js | 110 ++++++++++++------ native-base-theme/variables/platform.js | 2 +- native-base-theme/variables/platformDark.js | 2 +- navigation/AppNavigator.js | 12 +- navigation/MainDrawerNavigator.js | 2 +- navigation/MainTabNavigator.js | 2 +- screens/About/AboutScreen.js | 2 +- screens/{ => Websites}/AmicaleScreen.js | 4 +- screens/{ => Websites}/AvailableRoomScreen.js | 2 +- screens/Websites/BlueMindScreen.js | 53 +++++++++ screens/{ => Websites}/ElusEtudScreen.js | 4 +- screens/{ => Websites}/PlanexScreen.js | 6 +- screens/{ => Websites}/TutorInsaScreen.js | 4 +- screens/{ => Websites}/WiketudScreen.js | 4 +- translations/en.json | 5 + translations/fr.json | 5 + 17 files changed, 160 insertions(+), 67 deletions(-) rename screens/{ => Websites}/AmicaleScreen.js (87%) rename screens/{ => Websites}/AvailableRoomScreen.js (98%) create mode 100644 screens/Websites/BlueMindScreen.js rename screens/{ => Websites}/ElusEtudScreen.js (88%) rename screens/{ => Websites}/PlanexScreen.js (96%) rename screens/{ => Websites}/TutorInsaScreen.js (88%) rename screens/{ => Websites}/WiketudScreen.js (87%) diff --git a/components/CustomHeader.js b/components/CustomHeader.js index 7bf9669..ea10dcf 100644 --- a/components/CustomHeader.js +++ b/components/CustomHeader.js @@ -98,14 +98,6 @@ export default class CustomHeader extends React.Component { {this.props.rightButton} - {this.props.hasBackButton ? : - this.props.navigation.navigate('SettingsScreen')}> - - } ); } diff --git a/components/Sidebar.js b/components/Sidebar.js index 42eb3f0..cb744fa 100644 --- a/components/Sidebar.js +++ b/components/Sidebar.js @@ -41,6 +41,10 @@ export default class SideBar extends React.Component { // Dataset used to render the drawer // If the link field is defined, clicking on the item will open the link this.dataSet = [ + { + name: i18n.t('sidenav.divider1'), + route: "Divider1" + }, { name: "Amicale", route: "AmicaleScreen", @@ -61,6 +65,15 @@ export default class SideBar extends React.Component { route: "TutorInsaScreen", icon: "school", }, + { + name: "Mails BlueMind", + route: "BlueMindScreen", + icon: "email", + }, + { + name: i18n.t('sidenav.divider2'), + route: "Divider2" + }, { name: i18n.t('screens.availableRooms'), route: "AvailableRoomScreen", @@ -71,9 +84,68 @@ export default class SideBar extends React.Component { route: "SelfMenuScreen", icon: "silverware-fork-knife", }, + { + name: i18n.t('sidenav.divider3'), + route: "Divider3" + }, + { + name: i18n.t('screens.settings'), + route: "SettingsScreen", + icon: "settings", + }, ]; } + getRenderItem(item: Object) { + if (item.icon !== undefined) { + return ( + { + if (item.link !== undefined) + Linking.openURL(item.link).catch((err) => console.error('Error opening link', err)); + else + this.navigateToScreen(item.route); + }} + > + + + + {item.name} + + + {item.types && + + + {`${item.types} Types`} + + } + + ); + } else { + return ( + + {item.name} + + ); + } + + } + /** * Navigate to the selected route * @param route {string} The route name to navigate to @@ -92,43 +164,7 @@ export default class SideBar extends React.Component { data={this.dataSet} extraData={this.state} keyExtractor={(item) => item.route} - renderItem={({item}) => - { - if (item.link !== undefined) - Linking.openURL(item.link).catch((err) => console.error('Error opening link', err)); - else - this.navigateToScreen(item.route); - }} - > - - - - {item.name} - - - {item.types && - - - {`${item.types} Types`} - - } - } + renderItem={({item}) => this.getRenderItem(item)} /> ); diff --git a/native-base-theme/variables/platform.js b/native-base-theme/variables/platform.js index b458413..159a4b1 100644 --- a/native-base-theme/variables/platform.js +++ b/native-base-theme/variables/platform.js @@ -250,7 +250,7 @@ export default { // List listBg: 'transparent', listBorderColor: '#c9c9c9', - listDividerBg: '#f4f4f4', + listDividerBg: '#e2e2e2', listBtnUnderlayColor: '#DDD', listItemPadding: platform === PLATFORM.IOS ? 10 : 12, listNoteColor: '#808080', diff --git a/native-base-theme/variables/platformDark.js b/native-base-theme/variables/platformDark.js index cce16c1..5d640ee 100644 --- a/native-base-theme/variables/platformDark.js +++ b/native-base-theme/variables/platformDark.js @@ -250,7 +250,7 @@ export default { // List listBg: 'transparent', listBorderColor: '#3e3e3e', - listDividerBg: '#f4f4f4', + listDividerBg: '#222222', listBtnUnderlayColor: '#3a3a3a', listItemPadding: platform === PLATFORM.IOS ? 10 : 12, listNoteColor: '#acacac', diff --git a/navigation/AppNavigator.js b/navigation/AppNavigator.js index 3327e4a..fb54342 100644 --- a/navigation/AppNavigator.js +++ b/navigation/AppNavigator.js @@ -9,11 +9,12 @@ import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen'; import ProxiwashAboutScreen from '../screens/Proxiwash/ProxiwashAboutScreen'; import ProximoAboutScreen from '../screens/Proximo/ProximoAboutScreen'; import SelfMenuScreen from '../screens/SelfMenuScreen'; -import TutorInsaScreen from "../screens/TutorInsaScreen"; -import AmicaleScreen from "../screens/AmicaleScreen"; -import WiketudScreen from "../screens/WiketudScreen"; -import ElusEtudScreen from "../screens/ElusEtudScreen"; -import AvailableRoomScreen from "../screens/AvailableRoomScreen"; +import TutorInsaScreen from "../screens/Websites/TutorInsaScreen"; +import AmicaleScreen from "../screens/Websites/AmicaleScreen"; +import WiketudScreen from "../screens/Websites/WiketudScreen"; +import ElusEtudScreen from "../screens/Websites/ElusEtudScreen"; +import BlueMindScreen from "../screens/Websites/BlueMindScreen"; +import AvailableRoomScreen from "../screens/Websites/AvailableRoomScreen"; import DebugScreen from '../screens/DebugScreen'; import {fromRight} from "react-navigation-transitions"; @@ -35,6 +36,7 @@ function createAppContainerWithInitialRoute(initialRoute: string) { AmicaleScreen: {screen: AmicaleScreen}, WiketudScreen: {screen: WiketudScreen}, ElusEtudScreen: {screen: ElusEtudScreen}, + BlueMindScreen: {screen: BlueMindScreen}, AvailableRoomScreen: {screen: AvailableRoomScreen}, ProxiwashAboutScreen: {screen: ProxiwashAboutScreen}, ProximoAboutScreen: {screen: ProximoAboutScreen}, diff --git a/navigation/MainDrawerNavigator.js b/navigation/MainDrawerNavigator.js index 9449c8a..a2f291a 100644 --- a/navigation/MainDrawerNavigator.js +++ b/navigation/MainDrawerNavigator.js @@ -7,7 +7,7 @@ import HomeScreen from '../screens/HomeScreen'; import PlanningScreen from '../screens/PlanningScreen'; import ProxiwashScreen from '../screens/Proxiwash/ProxiwashScreen'; import ProximoMainScreen from '../screens/Proximo/ProximoMainScreen'; -import PlanexScreen from '../screens/PlanexScreen'; +import PlanexScreen from '../screens/Websites/PlanexScreen'; import SettingsScreen from '../screens/SettingsScreen'; import AboutScreen from '../screens/About/AboutScreen'; import Sidebar from "../components/Sidebar"; diff --git a/navigation/MainTabNavigator.js b/navigation/MainTabNavigator.js index 33ec229..5bfa445 100644 --- a/navigation/MainTabNavigator.js +++ b/navigation/MainTabNavigator.js @@ -5,7 +5,7 @@ import HomeScreen from '../screens/HomeScreen'; import PlanningScreen from '../screens/PlanningScreen'; import ProxiwashScreen from '../screens/Proxiwash/ProxiwashScreen'; import ProximoMainScreen from '../screens/Proximo/ProximoMainScreen'; -import PlanexScreen from '../screens/PlanexScreen'; +import PlanexScreen from '../screens/Websites/PlanexScreen'; import CustomMaterialIcon from "../components/CustomMaterialIcon"; import ThemeManager from "../utils/ThemeManager"; import AsyncStorageManager from "../utils/AsyncStorageManager"; diff --git a/screens/About/AboutScreen.js b/screens/About/AboutScreen.js index 0c361ca..ee5457b 100644 --- a/screens/About/AboutScreen.js +++ b/screens/About/AboutScreen.js @@ -39,7 +39,7 @@ const links = { "Application Amicale INSA Toulouse" + "&body=" + "Coucou !\n\n", - yohanLinkedin: 'https://www.linkedin.com/in/yohan-simard', // TODO set real link + yohanLinkedin: 'https://www.linkedin.com/in/yohan-simard', react: 'https://facebook.github.io/react-native/', }; diff --git a/screens/AmicaleScreen.js b/screens/Websites/AmicaleScreen.js similarity index 87% rename from screens/AmicaleScreen.js rename to screens/Websites/AmicaleScreen.js index 8abfafb..38b5bfc 100644 --- a/screens/AmicaleScreen.js +++ b/screens/Websites/AmicaleScreen.js @@ -1,8 +1,8 @@ // @flow import * as React from 'react'; -import ThemeManager from "../utils/ThemeManager"; -import WebViewScreen from "../components/WebViewScreen"; +import ThemeManager from "../../utils/ThemeManager"; +import WebViewScreen from "../../components/WebViewScreen"; type Props = { navigation: Object, diff --git a/screens/AvailableRoomScreen.js b/screens/Websites/AvailableRoomScreen.js similarity index 98% rename from screens/AvailableRoomScreen.js rename to screens/Websites/AvailableRoomScreen.js index a3448e1..04294c2 100644 --- a/screens/AvailableRoomScreen.js +++ b/screens/Websites/AvailableRoomScreen.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; -import WebViewScreen from "../components/WebViewScreen"; +import WebViewScreen from "../../components/WebViewScreen"; import i18n from "i18n-js"; type Props = { diff --git a/screens/Websites/BlueMindScreen.js b/screens/Websites/BlueMindScreen.js new file mode 100644 index 0000000..8031463 --- /dev/null +++ b/screens/Websites/BlueMindScreen.js @@ -0,0 +1,53 @@ +// @flow + +import * as React from 'react'; +import ThemeManager from "../../utils/ThemeManager"; +import WebViewScreen from "../../components/WebViewScreen"; +import i18n from "i18n-js"; + +type Props = { + navigation: Object, +} + + +const URL = 'https://etud-mel.insa-toulouse.fr/webmail/'; + +const CUSTOM_CSS_GENERAL = ''; + + +/** + * Class defining the app's planex screen. + * This screen uses a webview to render the planex page + */ +export default class AmicaleScreen extends React.Component { + + customInjectedJS: string; + + constructor() { + super(); + this.customInjectedJS = + '$(document).ready(function() {' + + '$("head").append(\'\');' + + '$("head").append(\'\');true;'; + } + + render() { + const nav = this.props.navigation; + return ( + + ); + } +} + diff --git a/screens/ElusEtudScreen.js b/screens/Websites/ElusEtudScreen.js similarity index 88% rename from screens/ElusEtudScreen.js rename to screens/Websites/ElusEtudScreen.js index 2843f6d..1151851 100644 --- a/screens/ElusEtudScreen.js +++ b/screens/Websites/ElusEtudScreen.js @@ -1,8 +1,8 @@ // @flow import * as React from 'react'; -import ThemeManager from "../utils/ThemeManager"; -import WebViewScreen from "../components/WebViewScreen"; +import ThemeManager from "../../utils/ThemeManager"; +import WebViewScreen from "../../components/WebViewScreen"; type Props = { navigation: Object, diff --git a/screens/PlanexScreen.js b/screens/Websites/PlanexScreen.js similarity index 96% rename from screens/PlanexScreen.js rename to screens/Websites/PlanexScreen.js index e7cf8d3..e47f6ad 100644 --- a/screens/PlanexScreen.js +++ b/screens/Websites/PlanexScreen.js @@ -1,8 +1,8 @@ // @flow import * as React from 'react'; -import ThemeManager from "../utils/ThemeManager"; -import WebViewScreen from "../components/WebViewScreen"; +import ThemeManager from "../../utils/ThemeManager"; +import WebViewScreen from "../../components/WebViewScreen"; import i18n from "i18n-js"; type Props = { @@ -73,7 +73,7 @@ export default class PlanexScreen extends React.Component { this.customInjectedJS = '$(document).ready(function() {' + OBSERVE_MUTATIONS_INJECTED + - '$("head").append(\'\');' + + '$("head").append(\'\');' + '$("head").append(\'\');'; if (ThemeManager.getNightMode()) diff --git a/screens/TutorInsaScreen.js b/screens/Websites/TutorInsaScreen.js similarity index 88% rename from screens/TutorInsaScreen.js rename to screens/Websites/TutorInsaScreen.js index 94965e8..53c2101 100644 --- a/screens/TutorInsaScreen.js +++ b/screens/Websites/TutorInsaScreen.js @@ -1,8 +1,8 @@ // @flow import * as React from 'react'; -import ThemeManager from "../utils/ThemeManager"; -import WebViewScreen from "../components/WebViewScreen"; +import ThemeManager from "../../utils/ThemeManager"; +import WebViewScreen from "../../components/WebViewScreen"; type Props = { navigation: Object, diff --git a/screens/WiketudScreen.js b/screens/Websites/WiketudScreen.js similarity index 87% rename from screens/WiketudScreen.js rename to screens/Websites/WiketudScreen.js index c817cdb..98353b0 100644 --- a/screens/WiketudScreen.js +++ b/screens/Websites/WiketudScreen.js @@ -1,8 +1,8 @@ // @flow import * as React from 'react'; -import ThemeManager from "../utils/ThemeManager"; -import WebViewScreen from "../components/WebViewScreen"; +import ThemeManager from "../../utils/ThemeManager"; +import WebViewScreen from "../../components/WebViewScreen"; type Props = { navigation: Object, diff --git a/translations/en.json b/translations/en.json index 406b29a..e9413df 100644 --- a/translations/en.json +++ b/translations/en.json @@ -10,6 +10,11 @@ "about": "About", "debug": "Debug" }, + "sidenav": { + "divider1": "Nice websites", + "divider2": "Useful services", + "divider3": "Personalisation" + }, "intro": { "slide1": { "title": "Welcome to CAMPUS", diff --git a/translations/fr.json b/translations/fr.json index 44a5868..ca0c0ea 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -10,6 +10,11 @@ "about": "À Propos", "debug": "Debug" }, + "sidenav": { + "divider1": "Sites bien", + "divider2": "Services utiles", + "divider3": "Personnalisation" + }, "intro": { "slide1": { "title": "Bienvenue sur CAMPUS",