Skip to content

Commit 056f08d

Browse files
Add ability to view the timeline template on view mode
1 parent e2e87f3 commit 056f08d

File tree

2 files changed

+14
-4
lines changed
  • src/components/ChallengeEditor

2 files changed

+14
-4
lines changed

src/components/ChallengeEditor/ChallengeView/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { isBetaMode } from '../../../util/cookie'
2626
import { loadGroupDetails } from '../../../actions/challenges'
2727
import Tooltip from '../../Tooltip'
2828
import { MESSAGE, REVIEW_TYPES } from '../../../config/constants'
29+
import TimelineTemplateField from '../TimelineTemplate-Field'
2930

3031
const ChallengeView = ({
3132
projectDetail,
@@ -202,6 +203,13 @@ const ChallengeView = ({
202203
{isBetaMode() && (
203204
<UseSchedulingAPIField challenge={challenge} readOnly />
204205
)}
206+
<TimelineTemplateField
207+
challengeTimelines={metadata.challengeTimelines}
208+
timelineTemplates={metadata.timelineTemplates}
209+
challenge={challenge}
210+
onUpdateSelect={() => {}}
211+
readOnly
212+
/>
205213
</>
206214
)}
207215
{

src/components/ChallengeEditor/TimelineTemplate-Field/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class TimelineTemplateField extends Component {
8080
<>
8181
<div className={styles.row}>
8282
<div className={cn(styles.field, styles.col1)}>
83-
<label htmlFor='type'>Timeline Template <span>*</span> :</label>
83+
<label htmlFor='type'>Timeline Template {!this.props.readOnly && <span>*</span>} :</label>
8484
</div>
8585
<div className={cn(styles.field, styles.col2, { [styles.disabled]: this.state.validOptions.length === 0 })}>
8686
<Select
@@ -90,7 +90,7 @@ class TimelineTemplateField extends Component {
9090
placeholder='Timeline Template'
9191
isClearable={false}
9292
onChange={(e) => this.props.onUpdateSelect(e.value, false, 'timelineTemplateId')}
93-
isDisabled={this.state.validOptions.length === 0}
93+
isDisabled={this.state.validOptions.length === 0 || this.props.readOnly}
9494
/>
9595
</div>
9696
</div>
@@ -107,14 +107,16 @@ class TimelineTemplateField extends Component {
107107

108108
TimelineTemplateField.defaultProps = {
109109
challengeTimelines: [],
110-
timelineTemplates: []
110+
timelineTemplates: [],
111+
readOnly: false
111112
}
112113

113114
TimelineTemplateField.propTypes = {
114115
challengeTimelines: PropTypes.arrayOf(PropTypes.shape()).isRequired,
115116
timelineTemplates: PropTypes.arrayOf(PropTypes.shape()).isRequired,
116117
challenge: PropTypes.shape().isRequired,
117-
onUpdateSelect: PropTypes.func.isRequired
118+
onUpdateSelect: PropTypes.func.isRequired,
119+
readOnly: PropTypes.bool
118120
}
119121

120122
export default TimelineTemplateField

0 commit comments

Comments
 (0)