|
@@ -13,14 +13,18 @@ import { FETCH_CONFIG } from '../helper.js'
|
13
|
13
|
import i18n from '../i18n.js'
|
14
|
14
|
|
15
|
15
|
const debug = {
|
16
|
|
- workspace: {
|
17
|
|
- id: -1,
|
18
|
|
- title: 'Test debug workspace'
|
19
|
|
- },
|
20
|
|
- appConfig: {
|
|
16
|
+ config: {
|
21
|
17
|
name: 'PageHtml',
|
|
18
|
+ label: {
|
|
19
|
+ fr: 'Page Html',
|
|
20
|
+ en: 'Html page'
|
|
21
|
+ },
|
|
22
|
+ componentLeft: 'PageHtml',
|
|
23
|
+ componentRight: 'Timeline',
|
22
|
24
|
customClass: 'wsContentPageHtml',
|
23
|
25
|
icon: 'fa fa-file-word-o',
|
|
26
|
+ color: '#65c7f2',
|
|
27
|
+ domContainer: 'appContainer',
|
24
|
28
|
apiUrl: 'http://localhost:3001'
|
25
|
29
|
},
|
26
|
30
|
loggedUser: {
|
|
@@ -37,7 +41,12 @@ const debug = {
|
37
|
41
|
title: 'Test debug pageHtml',
|
38
|
42
|
status: 'validated',
|
39
|
43
|
version: '-1',
|
40
|
|
- text: 'This is the default pageHtml content for debug purpose'
|
|
44
|
+ text: 'This is the default pageHtml content for debug purpose',
|
|
45
|
+ workspace: {
|
|
46
|
+ id: -1,
|
|
47
|
+ title: 'Test debug workspace',
|
|
48
|
+ ownerId: 5
|
|
49
|
+ }
|
41
|
50
|
},
|
42
|
51
|
timeline: timelineDebugData
|
43
|
52
|
}
|
|
@@ -48,8 +57,7 @@ class pageHtml extends React.Component {
|
48
|
57
|
this.state = {
|
49
|
58
|
appName: 'PageHtml',
|
50
|
59
|
isVisible: true,
|
51
|
|
- workspace: props.data ? props.data.workspace : debug.workspace,
|
52
|
|
- appConfig: props.data ? props.data.appConfig : debug.appConfig,
|
|
60
|
+ config: props.data ? props.data.config : debug.config,
|
53
|
61
|
loggedUser: props.data ? props.data.loggedUser : debug.loggedUser,
|
54
|
62
|
content: props.data ? props.data.content : debug.content,
|
55
|
63
|
timeline: props.data ? [] : debug.timeline
|
|
@@ -70,14 +78,14 @@ class pageHtml extends React.Component {
|
70
|
78
|
}
|
71
|
79
|
|
72
|
80
|
async componentDidMount () {
|
73
|
|
- const { workspace, content, appConfig } = this.state
|
|
81
|
+ const { content, config } = this.state
|
74
|
82
|
if (content.id === '-1') return // debug case
|
75
|
83
|
|
76
|
|
- const fetchResultPageHtml = await fetch(`${appConfig.apiUrl}/workspace/${workspace.id}/content/${content.id}`, {
|
|
84
|
+ const fetchResultPageHtml = await fetch(`${config.apiUrl}/workspace/${content.workspace.id}/content/${content.id}`, {
|
77
|
85
|
...FETCH_CONFIG,
|
78
|
86
|
method: 'GET'
|
79
|
87
|
})
|
80
|
|
- const fetchResultTimeline = await fetch(`${appConfig.apiUrl}/workspace/${workspace.id}/content/${content.id}/timeline`, {
|
|
88
|
+ const fetchResultTimeline = await fetch(`${config.apiUrl}/workspace/${content.workspace.id}/content/${content.id}/timeline`, {
|
81
|
89
|
...FETCH_CONFIG,
|
82
|
90
|
method: 'GET'
|
83
|
91
|
})
|
|
@@ -96,22 +104,22 @@ class pageHtml extends React.Component {
|
96
|
104
|
}
|
97
|
105
|
|
98
|
106
|
render () {
|
99
|
|
- const { isVisible, loggedUser, content, timeline, appConfig } = this.state
|
|
107
|
+ const { isVisible, loggedUser, content, timeline, config } = this.state
|
100
|
108
|
|
101
|
109
|
if (!isVisible) return null
|
102
|
110
|
|
103
|
111
|
return (
|
104
|
|
- <PopinFixed customClass={`${appConfig.customClass}`}>
|
|
112
|
+ <PopinFixed customClass={`${config.customClass}`}>
|
105
|
113
|
<PopinFixedHeader
|
106
|
|
- customClass={`${appConfig.customClass}`}
|
107
|
|
- icon={appConfig.icon}
|
|
114
|
+ customClass={`${config.customClass}`}
|
|
115
|
+ icon={config.icon}
|
108
|
116
|
name={content.title}
|
109
|
117
|
onClickCloseBtn={this.handleClickBtnCloseApp}
|
110
|
118
|
/>
|
111
|
119
|
|
112
|
|
- <PopinFixedOption customClass={`${appConfig.customClass}`} i18n={i18n} />
|
|
120
|
+ <PopinFixedOption customClass={`${config.customClass}`} i18n={i18n} />
|
113
|
121
|
|
114
|
|
- <PopinFixedContent customClass={`${appConfig.customClass}__contentpage`}>
|
|
122
|
+ <PopinFixedContent customClass={`${config.customClass}__contentpage`}>
|
115
|
123
|
<PageHtmlComponent
|
116
|
124
|
version={content.version}
|
117
|
125
|
text={content.text}
|
|
@@ -119,7 +127,7 @@ class pageHtml extends React.Component {
|
119
|
127
|
/>
|
120
|
128
|
|
121
|
129
|
<Timeline
|
122
|
|
- customClass={`${appConfig.customClass}__contentpage`}
|
|
130
|
+ customClass={`${config.customClass}__contentpage`}
|
123
|
131
|
loggedUser={loggedUser}
|
124
|
132
|
timelineData={timeline}
|
125
|
133
|
/>
|