Dashboard.jsx 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. import React from 'react'
  2. import { connect } from 'react-redux'
  3. import Sidebar from './Sidebar.jsx'
  4. import imgProfil from '../img/imgProfil.png'
  5. import {
  6. getAppList,
  7. getContentTypeList, getWorkspaceList
  8. } from '../action-creator.async.js'
  9. import {
  10. setAppList,
  11. setContentTypeList, setWorkspaceListIsOpenInSidebar, updateWorkspaceListData
  12. } from '../action-creator.sync.js'
  13. import { translate } from 'react-i18next'
  14. class Dashboard extends React.Component {
  15. constructor (props) {
  16. super(props)
  17. this.state = {
  18. workspaceIdInUrl: props.match.params.idws ? parseInt(props.match.params.idws) : null, // this is used to avoid handling the parseInt everytime
  19. displayNewMemberDashboard: false,
  20. displayNotifBtn: false,
  21. displayWebdavBtn: false,
  22. displayCalendarBtn: false
  23. }
  24. }
  25. async componentDidMount () {
  26. const { workspaceIdInUrl } = this.state
  27. const { user, workspaceList, app, contentType, dispatch } = this.props
  28. console.log('<Dashboard> componentDidMount')
  29. if (app.length === 0) {
  30. const fetchGetAppList = await dispatch(getAppList(user))
  31. if (fetchGetAppList.status === 200) dispatch(setAppList(fetchGetAppList.json))
  32. }
  33. if (contentType.length === 0) {
  34. const fetchGetContentTypeList = await dispatch(getContentTypeList(user))
  35. if (fetchGetContentTypeList.status === 200) dispatch(setContentTypeList(fetchGetContentTypeList.json))
  36. }
  37. if (user.user_id !== -1 && workspaceList.length === 0) {
  38. const fetchGetWorkspaceList = await dispatch(getWorkspaceList(user))
  39. if (fetchGetWorkspaceList.status === 200) {
  40. dispatch(updateWorkspaceListData(fetchGetWorkspaceList.json))
  41. dispatch(setWorkspaceListIsOpenInSidebar(workspaceIdInUrl || fetchGetWorkspaceList.json[0].workspace_id, true))
  42. }
  43. }
  44. }
  45. handleToggleNewMemberDashboard = () => this.setState(prevState => ({
  46. displayNewMemberDashboard: !prevState.displayNewMemberDashboard
  47. }))
  48. handleToggleNotifBtn = () => this.setState(prevState => ({
  49. displayNotifBtn: !prevState.displayNotifBtn
  50. }))
  51. handleToggleWebdavBtn = () => this.setState(prevState => ({
  52. displayWebdavBtn: !prevState.displayWebdavBtn
  53. }))
  54. handleToggleCalendarBtn = () => this.setState(prevState => ({
  55. displayCalendarBtn: !prevState.displayCalendarBtn
  56. }))
  57. render () {
  58. return (
  59. <div className='sidebarpagecontainer'>
  60. <Sidebar />
  61. <div className='dashboard'>
  62. <div className='container-fluid nopadding'>
  63. <div className='dashboard__header mb-5'>
  64. <div className='pageTitleGeneric dashboard__header__title d-flex align-items-center'>
  65. <div className='pageTitleGeneric__title dashboard__header__title__text mr-3'>
  66. {this.props.t('Dashboard')}
  67. </div>
  68. <div className='dashboard__header__acces' />
  69. </div>
  70. <div className='dashboard__header__advancedmode mr-3'>
  71. <button type='button' className='btn btn-primary'>
  72. {this.props.t('Active advanced Dashboard')}
  73. </button>
  74. </div>
  75. </div>
  76. <div className='dashboard__wkswrapper'>
  77. <div className='dashboard__workspace'>
  78. <div className='dashboard__workspace__title'>
  79. Développement tracim
  80. </div>
  81. <div className='dashboard__workspace__detail'>
  82. Ligne directive pour le prochain design de Tracim et des futurs fonctionnalités.
  83. </div>
  84. </div>
  85. <div className='dashboard__userstatut'>
  86. <div className='dashboard__userstatut__role'>
  87. <div className='dashboard__userstatut__role__text'>
  88. Hi ! Alexi, vous êtes actuellement
  89. </div>
  90. <div className='dashboard__userstatut__role__rank'>
  91. <div className='dashboard__userstatut__role__rank__icon'>
  92. <i className='fa fa-graduation-cap' />
  93. </div>
  94. <div className='dashboard__userstatut__role__rank__rolename'>
  95. Gestionnaire de projet
  96. </div>
  97. </div>
  98. </div>
  99. <div className='dashboard__userstatut__notification'>
  100. <div className='dashboard__userstatut__notification__text'>
  101. Vous êtes abonné(e) aux notifications de ce workspace
  102. </div>
  103. {this.state.displayNotifBtn === false &&
  104. <div
  105. className='dashboard__userstatut__notification__btn btn btn-outline-primary'
  106. onClick={this.handleToggleNotifBtn}
  107. >
  108. {this.props.t('Change your status')}
  109. </div>
  110. }
  111. {this.state.displayNotifBtn === true &&
  112. <div className='dashboard__userstatut__notification__subscribe dropdown'>
  113. <button className='dashboard__userstatut__notification__subscribe__btn btn btn-outline-primary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
  114. Abonné(e)
  115. </button>
  116. <div className='dashboard__userstatut__notification__subscribe__submenu dropdown-menu'>
  117. <div className='dashboard__userstatut__notification__subscribe__submenu__item dropdown-item'>
  118. {this.props.t('subscriber')}
  119. </div>
  120. <div className='dashboard__userstatut__notification__subscribe__submenu__item dropdown-item dropdown-item'>
  121. {this.props.t('unsubscribed')}
  122. </div>
  123. </div>
  124. </div>
  125. }
  126. </div>
  127. </div>
  128. </div>
  129. <div className='dashboard__calltoaction justify-content-xl-center'>
  130. <div className='dashboard__calltoaction__button btnaction btnthread'>
  131. <div className='dashboard__calltoaction__button__text'>
  132. <div className='dashboard__calltoaction__button__text__icon'>
  133. <i className='fa fa-comments-o' />
  134. </div>
  135. <div className='dashboard__calltoaction__button__text__title'>
  136. {this.props.t('Start a new Thread')}
  137. </div>
  138. </div>
  139. </div>
  140. <div className='dashboard__calltoaction__button btnaction writefile'>
  141. <div className='dashboard__calltoaction__button__text'>
  142. <div className='dashboard__calltoaction__button__text__icon'>
  143. <i className='fa fa-file-text-o' />
  144. </div>
  145. <div className='dashboard__calltoaction__button__text__title'>
  146. {this.props.t('Writing a document')}
  147. </div>
  148. </div>
  149. </div>
  150. <div className='dashboard__calltoaction__button btnaction importfile'>
  151. <div className='dashboard__calltoaction__button__text'>
  152. <div className='dashboard__calltoaction__button__text__icon'>
  153. <i className='fa fa-paperclip' />
  154. </div>
  155. <div className='dashboard__calltoaction__button__text__title'>
  156. {this.props.t('Upload a file')}
  157. </div>
  158. </div>
  159. </div>
  160. {/*
  161. <div className='dashboard__calltoaction__button btnaction visioconf'>
  162. <div className='dashboard__calltoaction__button__text'>
  163. <div className='dashboard__calltoaction__button__text__icon'>
  164. <i className='fa fa-video-camera' />
  165. </div>
  166. <div className='dashboard__calltoaction__button__text__title'>
  167. {this.props.t('Start a videoconference')}
  168. </div>
  169. </div>
  170. </div>
  171. <div className='dashboard__calltoaction__button btnaction calendar'>
  172. <div className='dashboard__calltoaction__button__text'>
  173. <div className='dashboard__calltoaction__button__text__icon'>
  174. <i className='fa fa-calendar' />
  175. </div>
  176. <div className='dashboard__calltoaction__button__text__title'>
  177. {this.props.t('View the Calendar')}
  178. </div>
  179. </div>
  180. </div>
  181. */ }
  182. <div className='dashboard__calltoaction__button btnaction explore'>
  183. <div className='dashboard__calltoaction__button__text'>
  184. <div className='dashboard__calltoaction__button__text__icon'>
  185. <i className='fa fa-folder-open-o' />
  186. </div>
  187. <div className='dashboard__calltoaction__button__text__title'>
  188. {this.props.t('Explore the workspace')}
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. <div className='dashboard__wksinfo'>
  194. <div className='dashboard__activity'>
  195. <div className='dashboard__activity__header'>
  196. <div className='dashboard__activity__header__title subTitle'>
  197. {this.props.t('Recent activity')}
  198. </div>
  199. <div className='dashboard__activity__header__allread btn btn-outline-primary'>
  200. {this.props.t('Mark everything as read')}
  201. </div>
  202. </div>
  203. <div className='dashboard__activity__wrapper'>
  204. <div className='dashboard__activity__workspace'>
  205. <div className='dashboard__activity__workspace__icon'>
  206. <i className='fa fa-comments-o' />
  207. </div>
  208. <div className='dashboard__activity__workspace__name'>
  209. <span>Développement Tracim</span>
  210. </div>
  211. </div>
  212. <div className='dashboard__activity__workspace'>
  213. <div className='dashboard__activity__workspace__icon'>
  214. <i className='fa fa-list-ul' />
  215. </div>
  216. <div className='dashboard__activity__workspace__name'>
  217. Mission externe
  218. </div>
  219. </div>
  220. <div className='dashboard__activity__workspace'>
  221. <div className='dashboard__activity__workspace__icon'>
  222. <i className='fa fa-list-ul' />
  223. </div>
  224. <div className='dashboard__activity__workspace__name'>
  225. Recherche et developpement
  226. </div>
  227. </div>
  228. <div className='dashboard__activity__workspace'>
  229. <div className='dashboard__activity__workspace__icon'>
  230. <i className='fa fa-file-text-o' />
  231. </div>
  232. <div className='dashboard__activity__workspace__name'>
  233. <span>Marketing</span>
  234. </div>
  235. </div>
  236. <div className='dashboard__activity__workspace'>
  237. <div className='dashboard__activity__workspace__icon'>
  238. <i className='fa fa-comments-o' />
  239. </div>
  240. <div className='dashboard__activity__workspace__name'>
  241. <span>Évolution</span>
  242. </div>
  243. </div>
  244. <div className='dashboard__activity__workspace'>
  245. <div className='dashboard__activity__workspace__icon'>
  246. <i className='fa fa-file-text-o' />
  247. </div>
  248. <div className='dashboard__activity__workspace__name'>
  249. Commercialisation
  250. </div>
  251. </div>
  252. <div className='dashboard__activity__more d-flex flex-row-reverse'>
  253. <div className='dashboard__activity__more__btn btn btn-outline-primary'>
  254. {this.props.t('See more')}
  255. </div>
  256. </div>
  257. </div>
  258. </div>
  259. <div className='dashboard__memberlist'>
  260. <div className='dashboard__memberlist__title subTitle'>
  261. {this.props.t('Member List')}
  262. </div>
  263. <div className='dashboard__memberlist__wrapper'>
  264. {this.state.displayNewMemberDashboard === false &&
  265. <div>
  266. <ul className='dashboard__memberlist__list'>
  267. <li className='dashboard__memberlist__list__item'>
  268. <div className='dashboard__memberlist__list__item__avatar'>
  269. <img src={imgProfil} alt='avatar' />
  270. </div>
  271. <div className='dashboard__memberlist__list__item__info mr-auto'>
  272. <div className='dashboard__memberlist__list__item__info__name'>
  273. Jean Dupont
  274. </div>
  275. <div className='dashboard__memberlist__list__item__info__role'>
  276. Responsable
  277. </div>
  278. </div>
  279. <div className='dashboard__memberlist__list__item__delete d-flex justify-content-end'>
  280. <i className='fa fa-trash-o' />
  281. </div>
  282. </li>
  283. <li className='dashboard__memberlist__list__item'>
  284. <div className='dashboard__memberlist__list__item__avatar'>
  285. <img src={imgProfil} alt='avatar' />
  286. </div>
  287. <div className='dashboard__memberlist__list__item__info mr-auto'>
  288. <div className='dashboard__memberlist__list__item__info__name'>
  289. Aldwin Vinel
  290. </div>
  291. <div className='dashboard__memberlist__list__item__info__role'>
  292. Lecteur
  293. </div>
  294. </div>
  295. <div className='dashboard__memberlist__list__item__delete d-flex justify-content-end'>
  296. <i className='fa fa-trash-o' />
  297. </div>
  298. </li>
  299. <li className='dashboard__memberlist__list__item'>
  300. <div className='dashboard__memberlist__list__item__avatar'>
  301. <img src={imgProfil} alt='avatar' />
  302. </div>
  303. <div className='dashboard__memberlist__list__item__info mr-auto'>
  304. <div className='dashboard__memberlist__list__item__info__name'>
  305. William Himme
  306. </div>
  307. <div className='dashboard__memberlist__list__item__info__role'>
  308. Contributeur
  309. </div>
  310. </div>
  311. <div className='dashboard__memberlist__list__item__delete d-flex justify-content-end'>
  312. <i className='fa fa-trash-o' />
  313. </div>
  314. </li>
  315. <li className='dashboard__memberlist__list__item'>
  316. <div className='dashboard__memberlist__list__item__avatar'>
  317. <img src={imgProfil} alt='avatar' />
  318. </div>
  319. <div className='dashboard__memberlist__list__item__info mr-auto'>
  320. <div className='dashboard__memberlist__list__item__info__name'>
  321. Yacine Lite
  322. </div>
  323. <div className='dashboard__memberlist__list__item__info__role'>
  324. Contributeur
  325. </div>
  326. </div>
  327. <div className='dashboard__memberlist__list__item__delete d-flex justify-content-end'>
  328. <i className='fa fa-trash-o' />
  329. </div>
  330. </li>
  331. <li className='dashboard__memberlist__list__item'>
  332. <div className='dashboard__memberlist__list__item__avatar'>
  333. <img src={imgProfil} alt='avatar' />
  334. </div>
  335. <div className='dashboard__memberlist__list__item__info mr-auto'>
  336. <div className='dashboard__memberlist__list__item__info__name'>
  337. Alexi Falcin
  338. </div>
  339. <div className='dashboard__memberlist__list__item__info__role'>
  340. Gestionnaire
  341. </div>
  342. </div>
  343. <div className='dashboard__memberlist__list__item__delete d-flex justify-content-end'>
  344. <i className='fa fa-trash-o' />
  345. </div>
  346. </li>
  347. <li className='dashboard__memberlist__list__item'>
  348. <div className='dashboard__memberlist__list__item__avatar'>
  349. <img src={imgProfil} alt='avatar' />
  350. </div>
  351. <div className='dashboard__memberlist__list__item__info mr-auto'>
  352. <div className='dashboard__memberlist__list__item__info__name'>
  353. Mickaël Fonati
  354. </div>
  355. <div className='dashboard__memberlist__list__item__info__role'>
  356. Gestionnaire
  357. </div>
  358. </div>
  359. <div className='dashboard__memberlist__list__item__delete d-flex justify-content-end'>
  360. <i className='fa fa-trash-o' />
  361. </div>
  362. </li>
  363. <li className='dashboard__memberlist__list__item'>
  364. <div className='dashboard__memberlist__list__item__avatar'>
  365. <img src={imgProfil} alt='avatar' />
  366. </div>
  367. <div className='dashboard__memberlist__list__item__info mr-auto'>
  368. <div className='dashboard__memberlist__list__item__info__name'>
  369. Eva Lonbard
  370. </div>
  371. <div className='dashboard__memberlist__list__item__info__role'>
  372. Gestionnaire
  373. </div>
  374. </div>
  375. <div className='dashboard__memberlist__list__item__delete d-flex justify-content-end'>
  376. <i className='fa fa-trash-o' />
  377. </div>
  378. </li>
  379. </ul>
  380. <div
  381. className='dashboard__memberlist__btnadd'
  382. onClick={this.handleToggleNewMemberDashboard}
  383. >
  384. <div className='dashboard__memberlist__btnadd__button'>
  385. <div className='dashboard__memberlist__btnadd__button__avatar'>
  386. <div className='dashboard__memberlist__btnadd__button__avatar__icon'>
  387. <i className='fa fa-plus' />
  388. </div>
  389. </div>
  390. <div
  391. className='dashboard__memberlist__btnadd__button__text'
  392. >
  393. {this.props.t('Add a member')}
  394. </div>
  395. </div>
  396. </div>
  397. </div>
  398. }
  399. {this.state.displayNewMemberDashboard === true &&
  400. <form className='dashboard__memberlist__form'>
  401. <div
  402. className='dashboard__memberlist__form__close d-flex justify-content-end'
  403. >
  404. <i className='fa fa-times' onClick={this.handleToggleNewMemberDashboard} />
  405. </div>
  406. <div className='dashboard__memberlist__form__member'>
  407. <div className='dashboard__memberlist__form__member__name'>
  408. <label className='name__label' htmlFor='addmember'>
  409. {this.props.t('Enter the name or email of the member')}
  410. </label>
  411. <input type='text' id='addmember' className='name__input form-control' placeholder='Nom ou Email' />
  412. </div>
  413. <div className='dashboard__memberlist__form__member__create'>
  414. <div className='create__radiobtn mr-3'>
  415. <input type='radio' />
  416. </div>
  417. <div className='create__text'>
  418. {this.props.t('Create an account')}
  419. </div>
  420. </div>
  421. </div>
  422. <div className='dashboard__memberlist__form__role'>
  423. <div className='dashboard__memberlist__form__role__text'>
  424. {this.props.t('Choose the role of the member')}
  425. </div>
  426. <ul className='dashboard__memberlist__form__role__list'>
  427. <li className='dashboard__memberlist__form__role__list__item'>
  428. <div className='item__radiobtn mr-3'>
  429. <input type='radio' name='role' value='responsable' />
  430. </div>
  431. <div className='item__text'>
  432. <div className='item_text_icon mr-2'>
  433. <i className='fa fa-gavel' />
  434. </div>
  435. <div className='item__text__name'>
  436. {this.props.t('Supervisor')}
  437. </div>
  438. </div>
  439. </li>
  440. <li className='dashboard__memberlist__form__role__list__item'>
  441. <div className='item__radiobtn mr-3'>
  442. <input type='radio' name='role' value='gestionnaire' />
  443. </div>
  444. <div className='item__text'>
  445. <div className='item_text_icon mr-2'>
  446. <i className='fa fa-graduation-cap' />
  447. </div>
  448. <div className='item__text__name'>
  449. {this.props.t('Content Manager')}
  450. </div>
  451. </div>
  452. </li>
  453. <li className='dashboard__memberlist__form__role__list__item'>
  454. <div className='item__radiobtn mr-3'>
  455. <input type='radio' name='role' value='contributeur' />
  456. </div>
  457. <div className='item__text'>
  458. <div className='item_text_icon mr-2'>
  459. <i className='fa fa-pencil' />
  460. </div>
  461. <div className='item__text__name'>
  462. {this.props.t('Contributor')}
  463. </div>
  464. </div>
  465. </li>
  466. <li className='dashboard__memberlist__form__role__list__item'>
  467. <div className='item__radiobtn mr-3'>
  468. <input type='radio' name='role' value='lecteur' />
  469. </div>
  470. <div className='item__text'>
  471. <div className='item_text_icon mr-2'>
  472. <i className='fa fa-eye' />
  473. </div>
  474. <div className='item__text__name'>
  475. {this.props.t('Reader')}
  476. </div>
  477. </div>
  478. </li>
  479. </ul>
  480. </div>
  481. <div className='dashboard__memberlist__form__submitbtn'>
  482. <button className='btn btn-outline-primary'>
  483. {this.props.t('Validate')}
  484. </button>
  485. </div>
  486. </form>
  487. }
  488. </div>
  489. </div>
  490. </div>
  491. <div className='dashboard__moreinfo'>
  492. <div className='dashboard__moreinfo__webdav genericBtnInfoDashboard'>
  493. <div
  494. className='dashboard__moreinfo__webdav__btn genericBtnInfoDashboard__btn'
  495. onClick={this.handleToggleWebdavBtn}
  496. >
  497. <div className='dashboard__moreinfo__webdav__btn__icon genericBtnInfoDashboard__btn__icon'>
  498. <i className='fa fa-windows' />
  499. </div>
  500. <div className='dashboard__moreinfo__webdav__btn__text genericBtnInfoDashboard__btn__text'>
  501. {this.props.t('Implement Tracim in your explorer')}
  502. </div>
  503. </div>
  504. {this.state.displayWebdavBtn === true &&
  505. <div>
  506. <div className='dashboard__moreinfo__webdav__information genericBtnInfoDashboard__info'>
  507. <div className='dashboard__moreinfo__webdav__information__text genericBtnInfoDashboard__info__text'>
  508. {this.props.t('Find all your documents deposited online directly on your computer via the workstation, without going through the software.')}'
  509. </div>
  510. <div className='dashboard__moreinfo__webdav__information__link genericBtnInfoDashboard__info__link'>
  511. http://algoo.trac.im/webdav/
  512. </div>
  513. </div>
  514. </div>
  515. }
  516. </div>
  517. <div className='dashboard__moreinfo__calendar genericBtnInfoDashboard'>
  518. <div className='dashboard__moreinfo__calendar__wrapperBtn'>
  519. <div
  520. className='dashboard__moreinfo__calendar__btn genericBtnInfoDashboard__btn'
  521. onClick={this.handleToggleCalendarBtn}
  522. >
  523. <div className='dashboard__moreinfo__calendar__btn__icon genericBtnInfoDashboard__btn__icon'>
  524. <i className='fa fa-calendar' />
  525. </div>
  526. <div className='dashboard__moreinfo__calendar__btn__text genericBtnInfoDashboard__btn__text'>
  527. {this.props.t('Workspace Calendar')}
  528. </div>
  529. </div>
  530. </div>
  531. <div className='dashboard__moreinfo__calendar__wrapperText'>
  532. {this.state.displayCalendarBtn === true &&
  533. <div>
  534. <div className='dashboard__moreinfo__calendar__information genericBtnInfoDashboard__info'>
  535. <div className='dashboard__moreinfo__calendar__information__text genericBtnInfoDashboard__info__text'>
  536. {this.props.t('Each workspace has its own calendar.')}
  537. </div>
  538. <div className='dashboard__moreinfo__calendar__information__link genericBtnInfoDashboard__info__link'>
  539. http://algoo.trac.im/calendar/
  540. </div>
  541. </div>
  542. </div>
  543. }
  544. </div>
  545. </div>
  546. </div>
  547. </div>
  548. </div>
  549. </div>
  550. )
  551. }
  552. }
  553. const mapStateToProps = ({ user, app, contentType, workspaceList }) => ({ user, app, contentType, workspaceList })
  554. export default connect(mapStateToProps)(translate()(Dashboard))