UserOverview.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. import React, { PropTypes } from 'react';
  15. import Reflux from 'reflux';
  16. import withStyles from 'isomorphic-style-loader/lib/withStyles';
  17. import s from './UserOverview.scss';
  18. import Moment from 'react-moment';
  19. import UserStore from '../../stores/UserStore';
  20. import Modal from '../NewModal';
  21. import EditProfile from '../EditProfile';
  22. const title = 'User Overview';
  23. class UserOverview extends Reflux.Component {
  24. constructor(props) {
  25. super(props)
  26. this.store = UserStore
  27. this.state = {
  28. showModal: false
  29. }
  30. }
  31. static contextTypes = {
  32. onSetTitle: PropTypes.func.isRequired,
  33. };
  34. componentWillMount() {
  35. super.componentWillMount.call(this)
  36. this.context.onSetTitle(title);
  37. }
  38. handleChangeNotifications() {
  39. }
  40. closeModal() {
  41. this.setState({ showModal: false })
  42. }
  43. openModal() {
  44. this.setState({ showModal: true })
  45. }
  46. render() {
  47. let item = this.state.currentUser
  48. return (
  49. <div className={s.root}>
  50. <div className={s.container}>
  51. <div className={s.columnLeft}>
  52. <div className={s.formGroup}>
  53. <div className={s.title}>
  54. Name
  55. </div>
  56. <div className={s.value}>
  57. {item.name}
  58. </div>
  59. </div>
  60. <div className={s.formGroup}>
  61. <div className={s.title}>
  62. Member Since
  63. </div>
  64. <div className={s.value}>
  65. <Moment format="MM/DD/YYYY HH:MM" date={item.created} />
  66. </div>
  67. </div>
  68. <div className={s.formGroup}>
  69. <button className="gray" onClick={(e) => this.openModal(e)}>Edit Profile</button>
  70. </div>
  71. {/* <div className={s.formGroup}>
  72. <div className={s.title}>
  73. Project Membership (4)
  74. </div>
  75. <div className={s.value}>
  76. My_Project, PRO-1, Coriolis-test, lala-land
  77. <br /> <br />
  78. <button className="gray">Edit Project Membership</button>
  79. </div>
  80. </div>*/}
  81. </div>
  82. <div className={s.columnRight}>
  83. <div className={s.formGroup}>
  84. <div className={s.title}>
  85. Email
  86. </div>
  87. <div className={s.value}>
  88. {item.email}
  89. </div>
  90. </div>
  91. {/* <div className={s.formGroup}>
  92. <div className={s.title}>
  93. Email Notifications
  94. </div>
  95. <div className={s.value}>
  96. <label className={s.notificationsSwitch}>
  97. <input
  98. type="checkbox"
  99. checked={this.state.currentUser.settings.notifications}
  100. className="ios-switch migrationType tinyswitch"
  101. onChange={(e) => this.handleChangeNotifications(e)}
  102. />
  103. <div><div></div></div>
  104. </label> Receive notifications
  105. </div>
  106. </div>*/}
  107. {/* <div className={s.formGroup}>
  108. <button className="wire">Edit Login Methods</button>
  109. </div>*/}
  110. </div>
  111. </div>
  112. <Modal
  113. isOpen={this.state.showModal}
  114. contentLabel="Edit Profile"
  115. contentStyle={{ width: '576px' }}
  116. onRequestClose={this.closeModal.bind(this)}
  117. >
  118. <EditProfile
  119. closeHandle={(e) => this.closeModal(e)}
  120. user={this.state.currentUser}
  121. />
  122. </Modal>
  123. </div>
  124. );
  125. }
  126. }
  127. export default withStyles(UserOverview, s);