App.jsx 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. Copyright (C) 2017 Cloudbase Solutions SRL
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. // @flow
  15. import React from 'react'
  16. import { Switch, Route } from 'react-router-dom'
  17. import styled, { injectGlobal } from 'styled-components'
  18. import Fonts from './atoms/Fonts'
  19. import Notifications from './organisms/Notifications'
  20. import LoginPage from './pages/LoginPage'
  21. import ReplicasPage from './pages/ReplicasPage'
  22. import NotFoundPage from './pages/NotFoundPage'
  23. import ReplicaDetailsPage from './pages/ReplicaDetailsPage'
  24. import MigrationsPage from './pages/MigrationsPage'
  25. import MigrationDetailsPage from './pages/MigrationDetailsPage'
  26. import EndpointsPage from './pages/EndpointsPage'
  27. import EndpointDetailsPage from './pages/EndpointDetailsPage'
  28. import WizardPage from './pages/WizardPage'
  29. import UserStore from '../stores/UserStore'
  30. import Palette from './styleUtils/Palette'
  31. import StyleProps from './styleUtils/StyleProps'
  32. injectGlobal`
  33. ${Fonts}
  34. body {
  35. margin: 0;
  36. color: ${Palette.black};
  37. font-family: Rubik;
  38. font-size: 14px;
  39. font-weight: ${StyleProps.fontWeights.regular};
  40. -webkit-font-smoothing: antialiased;
  41. -moz-osx-font-smoothing: grayscale;
  42. }
  43. `
  44. const Wrapper = styled.div``
  45. class App extends React.Component<{}> {
  46. componentWillMount() {
  47. UserStore.tokenLogin()
  48. }
  49. render() {
  50. return (
  51. <Wrapper>
  52. <Switch>
  53. <Route path="/" component={LoginPage} exact />
  54. <Route path="/login" component={LoginPage} />
  55. <Route path="/replicas" component={ReplicasPage} />
  56. <Route path="/replica/:id" component={ReplicaDetailsPage} exact />
  57. <Route path="/replica/:page/:id" component={ReplicaDetailsPage} />
  58. <Route path="/migrations" component={MigrationsPage} />
  59. <Route path="/migration/:id" component={MigrationDetailsPage} exact />
  60. <Route path="/migration/:page/:id" component={MigrationDetailsPage} />
  61. <Route path="/endpoints" component={EndpointsPage} />
  62. <Route path="/endpoint/:id" component={EndpointDetailsPage} />
  63. <Route path="/wizard/:type" component={WizardPage} />
  64. <Route component={NotFoundPage} />
  65. </Switch>
  66. <Notifications />
  67. </Wrapper>
  68. )
  69. }
  70. }
  71. export default App