Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PlanexScreen.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @flow
  2. import * as React from 'react';
  3. import ThemeManager from "../utils/ThemeManager";
  4. import WebViewScreen from "../components/WebViewScreen";
  5. import i18n from "i18n-js";
  6. type Props = {
  7. navigation: Object,
  8. }
  9. const PLANEX_URL = 'http://planex.insa-toulouse.fr/';
  10. const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/planex/customMobile2.css';
  11. const CUSTOM_CSS_NIGHTMODE = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/planex/customDark2.css';
  12. /**
  13. * Class defining the app's planex screen.
  14. * This screen uses a webview to render the planex page
  15. */
  16. export default class PlanexScreen extends React.Component<Props> {
  17. customInjectedJS: string;
  18. constructor() {
  19. super();
  20. this.customInjectedJS =
  21. 'document.querySelector(\'head\').innerHTML += \'<meta name="viewport" content="width=device-width, initial-scale=1.0">\';' +
  22. 'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_GENERAL + '" type="text/css"/>\';' +
  23. '$(".fc-toolbar .fc-center").append(\'<p id="rotateToLandscape">' + i18n.t("planexScreen.rotateToLandscape") + '</p>\');' +
  24. '$(".fc-toolbar .fc-center").append(\'<p id="rotateToPortrait">' + i18n.t("planexScreen.rotateToPortrait") + '</p>\');';
  25. if (ThemeManager.getNightMode())
  26. this.customInjectedJS += 'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_NIGHTMODE + '" type="text/css"/>\';';
  27. }
  28. render() {
  29. const nav = this.props.navigation;
  30. return (
  31. <WebViewScreen
  32. navigation={nav}
  33. data={[
  34. {
  35. url: PLANEX_URL,
  36. icon: '',
  37. name: '',
  38. customJS: this.customInjectedJS
  39. },
  40. ]}
  41. customInjectedJS={this.customInjectedJS}
  42. headerTitle={'Planex'}
  43. hasHeaderBackButton={false}
  44. hasFooter={false}/>
  45. );
  46. }
  47. }