Thread.jsx 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import React from 'react'
  2. import ThreadComponent from '../component/Thread.jsx'
  3. import {
  4. PopinFixed,
  5. PopinFixedHeader,
  6. PopinFixedOption,
  7. PopinFixedContent,
  8. Timeline
  9. } from 'tracim_lib'
  10. class pageHtml extends React.Component {
  11. constructor (props) {
  12. super(props)
  13. this.state = {
  14. appName: 'Thread',
  15. data: props.data
  16. ? props.data
  17. : { // for debugg purpose
  18. file: {
  19. version: '3',
  20. text: 'Bonjour ?'
  21. },
  22. appData: {
  23. name: 'Thread',
  24. componentLeft: 'Thread',
  25. componentRight: undefined,
  26. customClass: 'wsFileThread',
  27. icon: 'fa fa-comments-o'
  28. }
  29. }
  30. }
  31. document.addEventListener('appCustomEvent', this.customEventReducer, false)
  32. }
  33. customEventReducer = ({detail}) => {
  34. switch (detail.type) {
  35. case 'Thread_showMsg': // unused for now, for testing purpose
  36. this.setState({inputText: detail.content})
  37. break
  38. }
  39. }
  40. handleClickBtnCloseApp = () => {
  41. GLOBAL_unmountApp(this.state.appName)
  42. }
  43. render () {
  44. const { file, appData } = this.state.data
  45. return (
  46. <PopinFixed customClass={`${appData.customClass}`}>
  47. <PopinFixedHeader
  48. customClass={`${appData.customClass}`}
  49. icon={appData.icon}
  50. name={file.title}
  51. onClickCloseBtn={this.handleClickBtnCloseApp}
  52. />
  53. <PopinFixedOption customClass={`${appData.customClass}`} />
  54. <PopinFixedContent customClass={`${appData.customClass}__contentpage`}>
  55. <ThreadComponent
  56. // version={file.version}
  57. // text={file.text}
  58. key={'PageHtml'}
  59. />
  60. <Timeline
  61. customClass={`${appData.customClass}__contentpage`}
  62. key={'pageHtml__timeline'}
  63. />
  64. </PopinFixedContent>
  65. </PopinFixed>
  66. )
  67. }
  68. }
  69. export default pageHtml