Skip to content

Revert "Add an option to select a timeline template" #1120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ workflows:
branches:
only:
- develop
- feature/timeline-template

# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,16 @@
}
}

.challengeName {
&::-moz-placeholder { /* Mozilla Firefox 19+ */
line-height: 38px;
color: $tc-gray-80;
}
&::-webkit-input-placeholder { /* Webkit */
line-height: 38px;
color: $tc-gray-80;
}
&:-ms-input-placeholder { /* IE */
line-height: 38px;
color: $tc-gray-80;
@-moz-document url-prefix() {
.challengeName {
&::-moz-placeholder { /* Mozilla Firefox 19+ */
line-height: 38px;
}
&::-webkit-input-placeholder { /* Webkit */
line-height: 38px;
}
&:-ms-input-placeholder { /* IE */
line-height: 38px;
}
}
}

8 changes: 0 additions & 8 deletions src/components/ChallengeEditor/ChallengeView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { isBetaMode } from '../../../util/cookie'
import { loadGroupDetails } from '../../../actions/challenges'
import Tooltip from '../../Tooltip'
import { MESSAGE, REVIEW_TYPES } from '../../../config/constants'
import TimelineTemplateField from '../TimelineTemplate-Field'

const ChallengeView = ({
projectDetail,
Expand Down Expand Up @@ -201,13 +200,6 @@ const ChallengeView = ({
{isBetaMode() && (
<UseSchedulingAPIField challenge={challenge} readOnly />
)}
<TimelineTemplateField
challengeTimelines={metadata.challengeTimelines}
timelineTemplates={metadata.timelineTemplates}
challenge={challenge}
onUpdateSelect={() => {}}
readOnly
/>
</>
)}
{
Expand Down

This file was deleted.

126 changes: 0 additions & 126 deletions src/components/ChallengeEditor/TimelineTemplate-Field/index.js

This file was deleted.

23 changes: 3 additions & 20 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import Tooltip from '../Tooltip'
import UseSchedulingAPIField from './UseSchedulingAPIField'
import { getResourceRoleByName } from '../../util/tc'
import { isBetaMode } from '../../util/cookie'
import TimelineTemplateField from './TimelineTemplate-Field'

const theme = {
container: styles.modalContainer
Expand Down Expand Up @@ -839,7 +838,7 @@ class ChallengeEditor extends Component {
const STD_DEV_TIMELINE_TEMPLATE = _.find(timelineTemplates, { name: 'Standard Development' })
const avlTemplates = this.getAvailableTimelineTemplates()
// chooses first available timeline template or fallback template for the new challenge
const defaultTemplate = _.find(avlTemplates || [], t => t.isDefault) || STD_DEV_TIMELINE_TEMPLATE
const defaultTemplate = avlTemplates && avlTemplates.length > 0 ? avlTemplates[0] : STD_DEV_TIMELINE_TEMPLATE
const isTask = _.find(metadata.challengeTypes, { id: typeId, isTask: true })
const newChallenge = {
status: 'New',
Expand All @@ -852,7 +851,7 @@ class ChallengeEditor extends Component {
reviewType: isTask || isDesignChallenge ? REVIEW_TYPES.INTERNAL : REVIEW_TYPES.COMMUNITY
},
descriptionFormat: 'markdown',
timelineTemplateId: _.get(this.getCurrentTemplate(), 'id', defaultTemplate.id),
timelineTemplateId: defaultTemplate.id,
terms: [{ id: DEFAULT_TERM_UUID, roleId: SUBMITTER_ROLE_UUID }],
groups: []
// prizeSets: this.getDefaultPrizeSets()
Expand Down Expand Up @@ -1141,10 +1140,8 @@ class ChallengeEditor extends Component {

// all timeline template ids available for the challenge type
const availableTemplateIds = _.filter(challengeTimelines, ct => ct.typeId === challenge.typeId && ct.trackId === challenge.trackId).map(tt => tt.timelineTemplateId)
const defaultChallengeTimeline = _.find(challengeTimelines, ct => ct.typeId === challenge.typeId && ct.trackId === challenge.trackId && ct.isDefault)
// filter and return timeline templates that are available for this challenge type
const avlTemplates = _.filter(timelineTemplates, tt => availableTemplateIds.indexOf(tt.id) !== -1)
return _.map(avlTemplates, tt => tt.id === defaultChallengeTimeline.timelineTemplateId ? { ...tt, isDefault: true } : tt)
return _.filter(timelineTemplates, tt => availableTemplateIds.indexOf(tt.id) !== -1)
}

render () {
Expand Down Expand Up @@ -1363,13 +1360,6 @@ class ChallengeEditor extends Component {
<div className={styles.newFormContainer}>
<TrackField tracks={metadata.challengeTracks} challenge={challenge} onUpdateOthers={this.onUpdateOthers} />
<TypeField types={metadata.challengeTypes} onUpdateSelect={this.onUpdateSelect} challenge={challenge} />
<TimelineTemplateField
currentTemplate={this.state.currentTemplate}
challengeTimelines={metadata.challengeTimelines}
timelineTemplates={metadata.timelineTemplates}
challenge={challenge}
onUpdateSelect={this.resetPhase}
/>
<ChallengeNameField challenge={challenge} onUpdateInput={this.onUpdateInput} />
</div>
{ errorContainer }
Expand Down Expand Up @@ -1447,13 +1437,6 @@ class ChallengeEditor extends Component {
{isBetaMode() && (
<UseSchedulingAPIField challenge={challenge} toggleUseSchedulingAPI={this.toggleUseSchedulingAPI} />
)}
<TimelineTemplateField
challengeTimelines={metadata.challengeTimelines}
timelineTemplates={metadata.timelineTemplates}
challenge={challenge}
currentTemplate={this.state.currentTemplate}
onUpdateSelect={this.resetPhase}
/>
</React.Fragment>
)}
{!isTask && (
Expand Down
2 changes: 1 addition & 1 deletion src/services/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function fetchTimelineTemplates () {
* @returns {Promise<*>}
*/
export async function fetchChallengeTimelines () {
const response = await axiosInstance.get(`${CHALLENGE_TIMELINES_URL}?page=1&perPage=100`)
const response = await axiosInstance.get(`${CHALLENGE_TIMELINES_URL}?isDefault=true&page=1&perPage=100`)
return _.get(response, 'data', [])
}

Expand Down