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 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // @flow
  2. import * as React from 'react';
  3. import WebViewScreen from "../../components/Screens/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 CUSTOM_CSS_GENERAL = 'https://etud.insa-toulouse.fr/~amicale_app/custom_css/rooms/customMobile.css';
  11. /**
  12. * Class defining the app's available rooms screen.
  13. * This screen uses a webview to render the page
  14. */
  15. export default class AvailableRoomScreen extends React.Component<Props> {
  16. customInjectedJS: string;
  17. /**
  18. * Defines custom injected JavaScript to improve the page display on mobile
  19. */
  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. }
  29. render() {
  30. const nav = this.props.navigation;
  31. return (
  32. <WebViewScreen
  33. navigation={nav}
  34. data={[
  35. {
  36. url: ROOM_URL,
  37. icon: 'file-document-outline',
  38. name: i18n.t('availableRoomScreen.normalRoom'),
  39. customJS: this.customInjectedJS
  40. },
  41. {
  42. url: PC_URL,
  43. icon: 'monitor',
  44. name: i18n.t('availableRoomScreen.computerRoom'),
  45. customJS: this.customInjectedJS
  46. },
  47. ]}
  48. customInjectedJS={this.customInjectedJS}
  49. headerTitle={i18n.t('screens.availableRooms')}
  50. hasHeaderBackButton={true}
  51. hasSideMenu={false}
  52. hasFooter={false}/>
  53. );
  54. }
  55. }