Improved bluemind display and added ent webview screen

This commit is contained in:
keplyx 2020-01-31 16:00:22 +01:00
parent 628f36df24
commit b62ad1fd4a
6 changed files with 107 additions and 8 deletions

View file

@ -48,7 +48,7 @@ export default class SideBar extends React.Component<Props, State> {
{
name: "Amicale",
route: "AmicaleScreen",
icon: "web",
icon: "alpha-a-box",
},
{
name: "Élus Étudiants",
@ -74,6 +74,11 @@ export default class SideBar extends React.Component<Props, State> {
route: "BlueMindScreen",
icon: "email",
},
{
name: i18n.t('screens.ent'),
route: "EntScreen",
icon: "notebook",
},
{
name: i18n.t('screens.availableRooms'),
route: "AvailableRoomScreen",

View file

@ -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},

View file

@ -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<Props> {
export default class BlueMindScreen extends React.Component<Props> {
customInjectedJS: string;
constructor() {
super();
this.customInjectedJS =
'$(document).ready(function() {' +
'$("head").append(\'<meta name="viewport" content="width=device-width, initial-scale=1.0">\');' +
'$("head").append(\'<link rel="stylesheet" href="' + CUSTOM_CSS_GENERAL + '" type="text/css"/>\');true;';
}
@ -41,10 +40,10 @@ export default class AmicaleScreen extends React.Component<Props> {
url: URL,
icon: '',
name: '',
customJS: ''
customJS: this.customInjectedJS
},
]}
headerTitle={'Mails BlueMind'}
headerTitle={i18n.t('screens.bluemind')}
hasHeaderBackButton={true}
hasSideMenu={false}/>
);

View file

@ -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<Props> {
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 (
<WebViewScreen
navigation={nav}
data={[
{
url: URL,
icon: '',
name: '',
customJS: this.customInjectedJS
},
]}
headerTitle={i18n.t('screens.ent')}
hasHeaderBackButton={true}
hasSideMenu={false}/>
);
}
}

View file

@ -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"
},

View file

@ -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"
},