Skip to content

Commit a5b366a

Browse files
author
vikasrohit
authored
Merge pull request #1055 from topcoder-platform/develop
[PROD] Beta Release 0.5.0
2 parents e58d734 + 0c8b878 commit a5b366a

File tree

10 files changed

+288
-51
lines changed

10 files changed

+288
-51
lines changed

src/components/ChallengeEditor/ChallengeView/index.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import PhaseInput from '../../PhaseInput'
2121
import LegacyLinks from '../../LegacyLinks'
2222
import AssignedMemberField from '../AssignedMember-Field'
2323
import { getResourceRoleByName } from '../../../util/tc'
24+
import { isBetaMode } from '../../../util/cookie'
2425
import { loadGroupDetails } from '../../../actions/challenges'
2526
import Tooltip from '../../Tooltip'
2627
import { MESSAGE, REVIEW_TYPES } from '../../../config/constants'
@@ -37,7 +38,8 @@ const ChallengeView = ({
3738
assignedMemberDetails,
3839
enableEdit,
3940
onLaunchChallenge,
40-
onCloseTask }) => {
41+
onCloseTask
42+
}) => {
4143
const selectedType = _.find(metadata.challengeTypes, { id: challenge.typeId })
4244
const challengeTrack = _.find(metadata.challengeTracks, { id: challenge.trackId })
4345

@@ -148,7 +150,6 @@ const ChallengeView = ({
148150
<span><span className={styles.fieldTitle}>Challenge Name:</span> {challenge.name}</span>
149151
</div>
150152
</div>
151-
<NDAField challenge={challenge} readOnly />
152153
{isTask && <AssignedMemberField challenge={challenge} assignedMemberDetails={assignedMemberDetails} readOnly /> }
153154
<CopilotField challenge={{
154155
copilot
@@ -179,11 +180,26 @@ const ChallengeView = ({
179180
</label>
180181
</div>
181182
</div>
182-
{openAdvanceSettings && (<div className={cn(styles.row, styles.topRow)}>
183-
<div className={styles.col}>
184-
<span><span className={styles.fieldTitle}>Groups:</span> {groups}</span>
185-
</div>
186-
</div>)}
183+
{openAdvanceSettings && (
184+
<>
185+
<NDAField beta challenge={challenge} readOnly />
186+
<div className={cn(styles.row, styles.topRow)}>
187+
<div className={styles.col}>
188+
<span><span className={styles.fieldTitle}>Groups:</span> {groups}</span>
189+
</div>
190+
</div>
191+
{isBetaMode() && (
192+
<div className={styles.row}>
193+
<div className={styles.col}>
194+
<span>
195+
<span className={styles.fieldTitle}>Billing Account Id:</span>
196+
{projectDetail.billingAccountId}
197+
</span>
198+
</div>
199+
</div>
200+
)}
201+
</>
202+
)}
187203
{
188204
<div className={styles.PhaseRow}>
189205
<PhaseInput

src/components/ChallengeEditor/NDAField/NDAField.module.scss

Lines changed: 117 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,114 @@
88
align-content: space-between;
99
justify-content: flex-start;
1010

11-
.tcCheckbox {
12-
@include tc-checkbox;
11+
.fieldTitle {
12+
@include roboto-bold();
13+
font-size: 16px;
14+
line-height: 19px;
15+
font-weight: 500;
16+
color: $tc-gray-80;
17+
margin-right: 10px;
18+
}
19+
20+
.field {
21+
@include upto-sm {
22+
display: block;
23+
padding-bottom: 10px;
24+
}
25+
26+
label {
27+
@include roboto-bold();
28+
29+
font-size: 16px;
30+
line-height: 19px;
31+
font-weight: 500;
32+
color: $tc-gray-80;
33+
}
34+
35+
&.col1 {
36+
max-width: 185px;
37+
min-width: 185px;
38+
margin-right: 14px;
39+
margin-bottom: auto;
40+
margin-top: auto;
41+
padding-top: 10px;
42+
white-space: nowrap;
43+
display: flex;
44+
align-items: center;
45+
46+
span {
47+
color: $tc-red;
48+
}
49+
}
50+
51+
&.col2 {
52+
align-self: flex-end;
53+
width: 80%;
54+
margin-bottom: auto;
55+
margin-top: auto;
56+
display: flex;
57+
flex-direction: row;
58+
max-width: 600px;
59+
min-width: 600px;
60+
}
61+
}
62+
63+
.col1 {
64+
display: flex;
65+
flex-grow: 1;
66+
align-items: center;
67+
max-width: 0;
68+
min-width: 0;
69+
margin-right: 0;
70+
width: auto;
71+
margin-top: 0 !important;
72+
margin-bottom: 0 !important;
73+
padding-top: 0 !important;
74+
}
75+
76+
.col2 {
77+
width: auto;
78+
79+
.subGroup {
80+
width: 100%;
81+
display: flex;
82+
flex-direction: column;
83+
84+
.subRow {
85+
display: flex;
86+
align-items: center;
87+
margin-bottom: 18px;
88+
}
89+
90+
.subRow:last-of-type {
91+
margin-bottom: 0;
92+
}
93+
}
94+
}
95+
96+
.tcRadioButton {
97+
.tc-radioButton-label {
98+
@include roboto-light();
99+
100+
line-height: 17px;
101+
font-weight: 300;
102+
margin-left: 21px;
103+
user-select: none;
104+
cursor: pointer;
105+
width: 195px;
106+
font-size: 14px;
107+
color: #3d3d3d;
108+
}
13109

14110
height: 18px;
15-
width: 210px;
111+
width: 80px;
16112
margin: 0;
17113
padding: 0;
18114
vertical-align: bottom;
19115
position: relative;
20116
display: inline-block;
21117

22-
input[type='checkbox'] {
118+
input[type=radio] {
23119
display: none;
24120
}
25121

@@ -31,54 +127,52 @@
31127
cursor: pointer;
32128
position: absolute;
33129
display: inline-block;
34-
width: 14px;
35-
height: 14px;
130+
width: 16px;
131+
height: 16px;
132+
border-radius: 8px;
36133
top: 0;
37134
left: 0;
38135
border: none;
39136
box-shadow: none;
40137
background: $tc-gray-30;
41138
transition: all 0.15s ease-in-out;
42139

43-
44-
&.readOnly {
45-
cursor: auto;
46-
}
47-
48140
&::after {
49141
opacity: 0;
50142
content: '';
51143
position: absolute;
52-
width: 9px;
53-
height: 5px;
144+
width: 8px;
145+
height: 8px;
54146
background: transparent;
55-
top: 2px;
56-
left: 2px;
57-
border-top: none;
58-
border-right: none;
59-
transform: rotate(-45deg);
147+
top: 4px;
148+
left: 4px;
149+
border: 4px solid $tc-blue-20;
150+
border-radius: 4px;
60151
transition: all 0.15s ease-in-out;
61152
}
62153

63154
&:hover::after {
64155
opacity: 0.3;
65156
}
66-
&:hover:read-only::after {
67-
opacity: 0;
68-
}
69157

70158
div {
71159
margin-left: 24px;
72160
width: 300px;
73161
}
74162
}
75163

76-
input[type='checkbox']:checked ~ label {
164+
input[type=radio]:checked ~ label {
77165
background: $tc-blue-20;
78166
}
79167

80-
input[type='checkbox']:checked + label::after {
168+
input[type=radio]:checked + label::after {
169+
opacity: 1;
81170
border-color: $white;
82171
}
83172
}
173+
174+
&.error {
175+
color: $tc-red;
176+
margin-top: -25px;
177+
}
84178
}

src/components/ChallengeEditor/NDAField/index.js

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,52 @@
11
import _ from 'lodash'
22
import React from 'react'
33
import PropTypes from 'prop-types'
4+
import cn from 'classnames'
45
import styles from './NDAField.module.scss'
56
import { DEFAULT_NDA_UUID } from '../../../config/constants'
67

78
const NDAField = ({ challenge, toggleNdaRequire, readOnly }) => {
89
const isRequiredNda = challenge.terms && _.some(challenge.terms, { id: DEFAULT_NDA_UUID })
10+
11+
if (readOnly) {
12+
return (
13+
<div className={styles.row}>
14+
<div className={cn(styles.field, styles.col1, styles.fieldTitle)}>NDA Required :</div>
15+
<div className={cn(styles.field, styles.col2)}>
16+
{ isRequiredNda ? 'Yes' : 'No' }
17+
</div>
18+
</div>
19+
)
20+
}
21+
922
return (
1023
<div className={styles.row}>
11-
<div className={styles.tcCheckbox}>
12-
<input
13-
name='isRequiredNda'
14-
type='checkbox'
15-
id='isRequiredNda'
16-
checked={isRequiredNda}
17-
onChange={toggleNdaRequire}
18-
readOnly={readOnly}
19-
/>
20-
<label htmlFor='isRequiredNda' className={readOnly ? styles.readOnly : ''}>
21-
<div>NDA Required</div>
22-
<input type='hidden' />
23-
</label>
24+
<div className={cn(styles.field, styles.col1, styles.fieldTitle)}>NDA Required :</div>
25+
<div className={cn(styles.field, styles.col2)}>
26+
<div className={styles.tcRadioButton}>
27+
<input
28+
name='nda'
29+
type='radio'
30+
id='nda-yes'
31+
checked={isRequiredNda}
32+
onChange={toggleNdaRequire}
33+
/>
34+
<label className={styles['tc-RadioButton-label']} htmlFor='nda-yes'>
35+
<div>Yes</div>
36+
</label>
37+
</div>
38+
<div className={styles.tcRadioButton}>
39+
<input
40+
name='nda'
41+
type='radio'
42+
id='nda-no'
43+
checked={!isRequiredNda}
44+
onChange={toggleNdaRequire}
45+
/>
46+
<label className={styles['tc-RadioButton-label']} htmlFor='nda-no'>
47+
<div>No</div>
48+
</label>
49+
</div>
2450
</div>
2551
</div>
2652
)

src/components/ChallengeEditor/index.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import LegacyLinks from '../LegacyLinks'
5050
import AssignedMemberField from './AssignedMember-Field'
5151
import Tooltip from '../Tooltip'
5252
import { getResourceRoleByName } from '../../util/tc'
53+
import { isBetaMode } from '../../util/cookie'
5354

5455
const theme = {
5556
container: styles.modalContainer
@@ -195,7 +196,8 @@ class ChallengeEditor extends Component {
195196
challengeData.copilot = copilot || copilotFromResources
196197
challengeData.reviewer = reviewer || reviewerFromResources
197198
const challengeDetail = { ...challengeData }
198-
const isOpenAdvanceSettings = challengeDetail.groups.length > 0
199+
const isRequiredNda = challengeDetail.terms && _.some(challengeDetail.terms, { id: DEFAULT_NDA_UUID })
200+
const isOpenAdvanceSettings = challengeDetail.groups.length > 0 || isRequiredNda
199201
setState({
200202
challenge: challengeDetail,
201203
assignedMemberDetails,
@@ -809,7 +811,7 @@ class ChallengeEditor extends Component {
809811

810812
async createNewChallenge () {
811813
if (!this.props.isNew) return
812-
const { metadata, createChallenge } = this.props
814+
const { metadata, createChallenge, projectDetail } = this.props
813815
const { name, trackId, typeId } = this.state.challenge
814816
const { timelineTemplates } = metadata
815817
const isDesignChallenge = trackId === DES_TRACK_ID
@@ -838,6 +840,14 @@ class ChallengeEditor extends Component {
838840
terms: [{ id: DEFAULT_TERM_UUID, roleId: SUBMITTER_ROLE_UUID }]
839841
// prizeSets: this.getDefaultPrizeSets()
840842
}
843+
if (isBetaMode() && projectDetail.terms) {
844+
const currTerms = new Set(newChallenge.terms.map(term => term.id))
845+
newChallenge.terms.push(
846+
...projectDetail.terms
847+
.filter(term => !currTerms.has(term))
848+
.map(term => ({ id: term, roleId: SUBMITTER_ROLE_UUID }))
849+
)
850+
}
841851
const discussions = this.getDiscussionsConfig(newChallenge)
842852
if (discussions) {
843853
newChallenge.discussions = discussions
@@ -1359,7 +1369,6 @@ class ChallengeEditor extends Component {
13591369
</div>
13601370
</div>
13611371
<ChallengeNameField challenge={challenge} onUpdateInput={this.onUpdateInput} />
1362-
<NDAField challenge={challenge} toggleNdaRequire={this.toggleNdaRequire} />
13631372
{isTask && (
13641373
<AssignedMemberField
13651374
challenge={challenge}
@@ -1392,9 +1401,20 @@ class ChallengeEditor extends Component {
13921401
</div>
13931402
{ isOpenAdvanceSettings && (
13941403
<React.Fragment>
1404+
<NDAField challenge={challenge} toggleNdaRequire={this.toggleNdaRequire} />
13951405
{/* remove terms field and use default term */}
13961406
{false && (<TermsField terms={metadata.challengeTerms} challenge={challenge} onUpdateMultiSelect={this.onUpdateMultiSelect} />)}
13971407
<GroupsField onUpdateMultiSelect={this.onUpdateMultiSelect} challenge={challenge} />
1408+
{isBetaMode() && (
1409+
<div className={styles.row}>
1410+
<div className={styles.col}>
1411+
<span>
1412+
<span className={styles.fieldTitle}>Billing Account Id:</span>
1413+
{projectDetail.billingAccountId}
1414+
</span>
1415+
</div>
1416+
</div>
1417+
)}
13981418
</React.Fragment>
13991419
)}
14001420
{!isTask && (

0 commit comments

Comments
 (0)