AppLayout.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import React from 'react'
  2. import { Tabs, Tab } from 'react-bootstrap'
  3. class AppLayout extends React.Component {
  4. constructor () {
  5. super()
  6. this.handleSubmit = this.handleSubmit.bind(this)
  7. }
  8. handleSubmit (event) {
  9. event.preventDefault()
  10. console.log(this.props.state.usersActions)
  11. const { loginRequest } = this.props.state.usersActions
  12. const data = {
  13. username: this.username.value,
  14. password: this.password.value
  15. }
  16. console.log(data)
  17. loginRequest(data)
  18. //const { fileUploadStart } = this.props.actions
  19. //const { files } = this.playerListFile
  20. // if (files.length === 0) {
  21. // alertAdd({ type: 'info', text: 'Datei entfernt' })
  22. // return
  23. // }
  24. // if (files.length > 1) {
  25. // alertAdd({ type: 'warning', text: 'Mehrere Dateien gesendet. Nur die erste wird verarbeitet.' })
  26. // }
  27. }
  28. render () {
  29. const { state } = this.props
  30. const { activeTab } = this.props.state.layout
  31. const { changeTab } = this.props.state.layoutActions
  32. const { PlayerList, MatchList, StartPage, UserList } = this.props.components
  33. const { token, tokenData } = state.users
  34. return (
  35. <div>
  36. {(tokenData) ? (
  37. <Tabs activeKey={activeTab} onSelect={changeTab} id='layout-tabs'>
  38. <Tab eventKey={0} title='Setup'>
  39. <StartPage {...state} />
  40. </Tab>
  41. <Tab eventKey={1} title='Users'>
  42. <UserList state={state.users} actions={state.usersActions} />
  43. </Tab>
  44. <Tab eventKey={2} title='PlayerList' >
  45. <PlayerList state={state.playerList} actions={state.playerListActions} />
  46. </Tab>
  47. <Tab eventKey={3} title='Calendar' >
  48. <MatchList state={state.calendar} actions={state.calendarActions} />
  49. </Tab>
  50. <Tab eventKey={4} title='Spielplan' />
  51. <Tab eventKey={5} title='Zahlliste' />
  52. </Tabs>
  53. ) : (
  54. <div>
  55. <form ref='loginForm' onSubmit={this.handleSubmit}>
  56. <label>Benutzername</label>
  57. <input type='text' id='username' ref={(input) => {this.username = input}}/>
  58. <label>Passwort</label>
  59. <input type='password' id='password' ref={(input) => {this.password = input}}/>
  60. <input type='submit' />
  61. </form>
  62. </div>
  63. )}
  64. </div>
  65. )
  66. }
  67. }
  68. export default AppLayout