IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

56 lignes
1.6KB

  1. import { h, Component } from 'preact';
  2. import { Router, route } from 'preact-router';
  3. import WBBrowse from 'wb-browse';
  4. import WBSignIn from 'wb-sign-in';
  5. import WBLandingPage from 'wb-landing-page';
  6. class WBApp extends Component {
  7. constructor(...args) {
  8. super(...args);
  9. this.state.arvHost = window.localStorage['arvHost'];
  10. this.state.arvToken = window.localStorage['arvToken'];
  11. if ('currentUser' in window.localStorage)
  12. this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
  13. this.appCallbacks = {
  14. 'navbarItemClicked': item => this.navbarItemClicked(item)
  15. };
  16. this.appState = {
  17. 'arvHost': this.state.arvHost,
  18. 'arvToken': this.state.arvToken,
  19. 'currentUser': this.state.currentUser
  20. };
  21. }
  22. navbarItemClicked(item) {
  23. if (item['id'] === 'sign-out') {
  24. delete window.localStorage['arvHost'];
  25. delete window.localStorage['arvToken'];
  26. delete window.localStorage['currentUser'];
  27. route('/sign-in');
  28. } else if (item['id'] === 'home') {
  29. route('/browse/' + this.appState.currentUser.uuid);
  30. } else if (item['id'] === 'all-projects') {
  31. route('/browse');
  32. }
  33. }
  34. render() {
  35. return (
  36. <Router>
  37. <WBLandingPage path="/" />
  38. <WBSignIn path="/sign-in" appState={ this.appState } />
  39. <WBBrowse path="/browse/:ownerUuid?/:activePage?/:objTypeTab?/:collectionPage?/:processPage?/:workflowPage?"
  40. appCallbacks={ this.appCallbacks }
  41. appState={ this.appState } />
  42. </Router>
  43. );
  44. }
  45. }
  46. export default WBApp;