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.

AvailableRoomScreen.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // @flow
  2. import * as React from 'react';
  3. import WebViewScreen from "../components/WebViewScreen";
  4. import i18n from "i18n-js";
  5. type Props = {
  6. navigation: Object,
  7. }
  8. const ROOM_URL = 'http://planex.insa-toulouse.fr/salles.php';
  9. const PC_URL = 'http://planex.insa-toulouse.fr/sallesInfo.php';
  10. const BIB_URL = 'https://bibbox.insa-toulouse.fr/';
  11. const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/rooms/customMobile.css';
  12. const CUSTOM_CSS_Bib = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/rooms/customBibMobile.css';
  13. /**
  14. * Class defining the app's planex screen.
  15. * This screen uses a webview to render the planex page
  16. */
  17. export default class AvailableRoomScreen extends React.Component<Props> {
  18. customInjectedJS: string;
  19. customBibInjectedJS: string;
  20. constructor() {
  21. super();
  22. this.customInjectedJS =
  23. 'document.querySelector(\'head\').innerHTML += \'<meta name="viewport" content="width=device-width, initial-scale=1.0">\';' +
  24. 'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_GENERAL + '" type="text/css"/>\';' +
  25. 'let header = $(".table tbody tr:first");' +
  26. '$("table").prepend("<thead></thead>");true;' + // Fix for crash on ios
  27. '$("thead").append(header);true;';
  28. this.customBibInjectedJS =
  29. 'document.querySelector(\'head\').innerHTML += \'<meta name="viewport" content="width=device-width, initial-scale=1.0">\';' +
  30. 'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_Bib + '" type="text/css"/>\';' +
  31. 'if ($(".hero-unit-form").length > 0 && $("#customBackButton").length === 0)' +
  32. '$(".hero-unit-form").append("' +
  33. '<div style=\'width: 100%; display: flex\'>' +
  34. '<a style=\'margin: auto\' href=\'' + BIB_URL + '\'>' +
  35. '<button id=\'customBackButton\' class=\'btn btn-primary\'>Retour</button>' +
  36. '</a>' +
  37. '</div>");true;';
  38. }
  39. render() {
  40. const nav = this.props.navigation;
  41. return (
  42. <WebViewScreen
  43. navigation={nav}
  44. data={[
  45. {
  46. url: ROOM_URL,
  47. icon: 'file-document-outline',
  48. name: i18n.t('availableRoomScreen.normalRoom'),
  49. customJS: this.customInjectedJS
  50. },
  51. {
  52. url: PC_URL,
  53. icon: 'monitor',
  54. name: i18n.t('availableRoomScreen.computerRoom'),
  55. customJS: this.customInjectedJS
  56. },
  57. {
  58. url: BIB_URL,
  59. icon: 'book',
  60. name: i18n.t('availableRoomScreen.bibRoom'),
  61. customJS: this.customBibInjectedJS
  62. },
  63. ]}
  64. customInjectedJS={this.customInjectedJS}
  65. headerTitle={i18n.t('screens.availableRooms')}
  66. hasHeaderBackButton={true}
  67. hasSideMenu={false}
  68. hasFooter={false}/>
  69. );
  70. }
  71. }