diff --git a/components/Sidebar.js b/components/Sidebar.js index f4acf73..09216e5 100644 --- a/components/Sidebar.js +++ b/components/Sidebar.js @@ -48,7 +48,7 @@ export default class SideBar extends React.Component { { name: "Amicale", route: "AmicaleScreen", - icon: "web", + icon: "alpha-a-box", }, { name: "Élus Étudiants", @@ -74,6 +74,11 @@ export default class SideBar extends React.Component { route: "BlueMindScreen", icon: "email", }, + { + name: i18n.t('screens.ent'), + route: "EntScreen", + icon: "notebook", + }, { name: i18n.t('screens.availableRooms'), route: "AvailableRoomScreen", diff --git a/navigation/AppNavigator.js b/navigation/AppNavigator.js index fb54342..6a89682 100644 --- a/navigation/AppNavigator.js +++ b/navigation/AppNavigator.js @@ -14,6 +14,7 @@ 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 EntScreen from "../screens/Websites/EntScreen"; import AvailableRoomScreen from "../screens/Websites/AvailableRoomScreen"; import DebugScreen from '../screens/DebugScreen'; import {fromRight} from "react-navigation-transitions"; @@ -37,6 +38,7 @@ function createAppContainerWithInitialRoute(initialRoute: string) { WiketudScreen: {screen: WiketudScreen}, ElusEtudScreen: {screen: ElusEtudScreen}, BlueMindScreen: {screen: BlueMindScreen}, + EntScreen: {screen: EntScreen}, AvailableRoomScreen: {screen: AvailableRoomScreen}, ProxiwashAboutScreen: {screen: ProxiwashAboutScreen}, ProximoAboutScreen: {screen: ProximoAboutScreen}, diff --git a/screens/Websites/BlueMindScreen.js b/screens/Websites/BlueMindScreen.js index 8031463..afcabaa 100644 --- a/screens/Websites/BlueMindScreen.js +++ b/screens/Websites/BlueMindScreen.js @@ -12,21 +12,20 @@ type Props = { const URL = 'https://etud-mel.insa-toulouse.fr/webmail/'; -const CUSTOM_CSS_GENERAL = ''; +const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/bluemind/customMobile.css'; /** * Class defining the app's planex screen. * This screen uses a webview to render the planex page */ -export default class AmicaleScreen extends React.Component { +export default class BlueMindScreen extends React.Component { customInjectedJS: string; constructor() { super(); this.customInjectedJS = - '$(document).ready(function() {' + '$("head").append(\'\');' + '$("head").append(\'\');true;'; } @@ -41,10 +40,10 @@ export default class AmicaleScreen extends React.Component { url: URL, icon: '', name: '', - customJS: '' + customJS: this.customInjectedJS }, ]} - headerTitle={'Mails BlueMind'} + headerTitle={i18n.t('screens.bluemind')} hasHeaderBackButton={true} hasSideMenu={false}/> ); diff --git a/screens/Websites/EntScreen.js b/screens/Websites/EntScreen.js new file mode 100644 index 0000000..8df8e49 --- /dev/null +++ b/screens/Websites/EntScreen.js @@ -0,0 +1,91 @@ +// @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://ent.insa-toulouse.fr/'; + +const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/ent/customMobile.css'; + +// let stylesheet = document.createElement('link'); +// stylesheet.type = 'text/css'; +// stylesheet.rel = 'stylesheet'; +// stylesheet.href = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/ent/customMobile.css'; +// let mobileSpec = document.createElement('meta'); +// mobileSpec.name = 'viewport'; +// mobileSpec.content = 'width=device-width, initial-scale=1.0'; +// document.getElementsByTagName('head')[0].appendChild(mobileSpec); +// // document.getElementsByTagName('head')[0].appendChild(stylesheet); +// document.getElementsByClassName('preference-items')[0].style.display = 'none'; +// document.getElementsByClassName('logoInsa')[0].style.display = 'none'; +// document.getElementsByClassName('logoPress')[0].style.display = 'none'; +// document.getElementsByClassName('ent')[0].style.display = 'none'; +// document.getElementById('portal-page-header').style.margin = 0; +// document.querySelectorAll('.uportal-navigation-category').forEach(element => { +// element.style.cssText = "width: 100%; display: flex; height: 50px;"; +// if (element.children.length > 0) +// element.children[0].style.margin = 'auto'; +// }); +// true; + + +/** + * Class defining the app's ent screen. + * This screen uses a webview to render the ent page + */ +export default class EntScreen extends React.Component { + + customInjectedJS: string; + + constructor() { + super(); + this.customInjectedJS = + 'let stylesheet = document.createElement(\'link\');\n' + + 'stylesheet.type = \'text/css\';\n' + + 'stylesheet.rel = \'stylesheet\';\n' + + 'stylesheet.href = \'' + CUSTOM_CSS_GENERAL +'\';\n' + + 'let mobileSpec = document.createElement(\'meta\');\n' + + 'mobileSpec.name = \'viewport\';\n' + + 'mobileSpec.content = \'width=device-width, initial-scale=1.0\';\n' + + 'document.getElementsByTagName(\'head\')[0].appendChild(mobileSpec);\n' + + 'document.getElementsByTagName(\'head\')[0].appendChild(stylesheet);\n' + + 'document.getElementsByClassName(\'preference-items\')[0].style.display = \'none\';\n' + + 'document.getElementsByClassName(\'logoInsa\')[0].style.display = \'none\';\n' + + 'document.getElementsByClassName(\'logoPress\')[0].style.display = \'none\';\n' + + 'document.getElementsByClassName(\'ent\')[0].style.display = \'none\';\n' + + 'document.getElementById(\'portal-page-header\').style.margin = 0;\n' + + 'document.querySelectorAll(\'.uportal-navigation-category\').forEach(element => {\n' + + ' element.style.cssText = "width: 100%; display: flex; height: 50px;";\n' + + ' if (element.children.length > 0)\n' + + ' element.children[0].style.margin = \'auto\';\n' + + '});' + + 'true;'; + } + + render() { + const nav = this.props.navigation; + return ( + + ); + } +} + diff --git a/translations/en.json b/translations/en.json index 0f22092..4e6f0cf 100644 --- a/translations/en.json +++ b/translations/en.json @@ -8,11 +8,12 @@ "settings": "Settings", "availableRooms": "Available rooms", "bluemind": "INSA Mails", + "ent": "INSA ENT", "about": "About", "debug": "Debug" }, "sidenav": { - "divider1": "Useful websites", + "divider1": "Student websites", "divider2": "Services", "divider3": "Personalisation" }, diff --git a/translations/fr.json b/translations/fr.json index 21abadb..72ec3c3 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -8,11 +8,12 @@ "settings": "Paramètres", "availableRooms": "Salles dispo", "bluemind": "Mails INSA", + "ent": "ENT INSA", "about": "À Propos", "debug": "Debug" }, "sidenav": { - "divider1": "Sites utiles", + "divider1": "Sites étudiants", "divider2": "Services", "divider3": "Personnalisation" },