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!
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

55 Zeilen
1.5KB

  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. this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
  12. this.appCallbacks = {
  13. 'navbarItemClicked': item => this.navbarItemClicked(item)
  14. };
  15. this.appState = {
  16. 'arvHost': this.state.arvHost,
  17. 'arvToken': this.state.arvToken,
  18. 'currentUser': this.state.currentUser
  19. };
  20. }
  21. navbarItemClicked(item) {
  22. if (item['id'] === 'sign-out') {
  23. delete window.localStorage['arvHost'];
  24. delete window.localStorage['arvToken'];
  25. delete window.localStorage['currentUser'];
  26. route('/sign-in');
  27. } else if (item['id'] === 'home') {
  28. route('/browse/' + this.appState.currentUser.uuid);
  29. } else if (item['id'] === 'all-projects') {
  30. route('/browse');
  31. }
  32. }
  33. render() {
  34. return (
  35. <Router>
  36. <WBLandingPage path="/" />
  37. <WBSignIn path="/sign-in" appState={ this.appState } />
  38. <WBBrowse path="/browse/:ownerUuid?/:activePage?"
  39. appCallbacks={ this.appCallbacks }
  40. appState={ this.appState } />
  41. </Router>
  42. );
  43. }
  44. }
  45. export default WBApp;