Skip to content

Commit c67dcc6

Browse files
committed
Multi-round UAT fixes
#1414
1 parent 50f34ba commit c67dcc6

File tree

5 files changed

+43
-47
lines changed

5 files changed

+43
-47
lines changed

src/components/ChallengeEditor/CheckpointPrizes-Field/CheckpointPrizes-Field.module.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
width: 271px;
5151
}
5252
input:last-of-type {
53-
width: 187px;
53+
width: 70px;
5454
margin-right: 10px;
5555
}
5656
}
@@ -63,13 +63,12 @@
6363
}
6464

6565
.dollarIcon {
66-
margin-left: 10px;
6766
color: $tc-black;
6867
cursor: pointer;
6968
}
7069

7170
.checkpointPrizeContainer {
72-
margin: 30px 0 0 60px;
71+
margin: 0 0 0 60px;
7372
}
7473

7574
.checkpointLabel {
@@ -100,3 +99,7 @@
10099
width: 50px;
101100
border-right-width: 0;
102101
}
102+
103+
.checkpointSelect {
104+
max-width: 85px;
105+
}

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

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
PRIZE_SETS_TYPE,
1010
CHALLENGE_PRIZE_TYPE,
1111
MAX_CHECKPOINT_PRIZE_COUNT,
12-
DEFAULT_CHECKPOINT_PRIZE
12+
DEFAULT_CHECKPOINT_PRIZE,
13+
DEFAULT_CHECKPOINT_PRIZE_COUNT
1314
} from '../../../config/constants'
1415
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
1516
import { faDollarSign } from '@fortawesome/free-solid-svg-icons'
@@ -19,7 +20,7 @@ const CheckpointPrizesField = ({ challenge, onUpdateOthers, readOnly }) => {
1920
const type = PRIZE_SETS_TYPE.CHECKPOINT_PRIZES
2021
const prizeSets = _.get(challenge, 'prizeSets') || []
2122
const checkpointPrize = prizeSets.find(p => p.type === type) || { type: PRIZE_SETS_TYPE.CHECKPOINT_PRIZES, prizes: [], 'description': 'Checkpoint Prizes' }
22-
const number = _.get(checkpointPrize, 'prizes.length') || MAX_CHECKPOINT_PRIZE_COUNT
23+
const number = _.get(checkpointPrize, 'prizes.length') || DEFAULT_CHECKPOINT_PRIZE_COUNT
2324
const amount = _.get(checkpointPrize, 'prizes.length') ? checkpointPrize.prizes[0].value : DEFAULT_CHECKPOINT_PRIZE
2425

2526
// update the check point prize with default values if it's not already defined
@@ -39,42 +40,41 @@ const CheckpointPrizesField = ({ challenge, onUpdateOthers, readOnly }) => {
3940
<div className={cn(styles.field, styles.col1)}>
4041
<label htmlFor={`checkpointPrizes`} className={styles.checkpointLabel}>Checkpoint Prizes :</label>
4142
</div>
42-
</div>
43-
{
44-
readOnly ? (
45-
<div className={styles.checkpointPrizeContainer}>
43+
{
44+
readOnly ? (
45+
<div className={cn(styles.field, styles.col2)}>
4646
${amount} for each submission up to {number} submissions
47-
</div>
48-
) : (
49-
<div className={styles.checkpointPrizeContainer}>
50-
<div>
51-
Pay
5247
</div>
53-
<div>
54-
<div className={styles.checkpointPrizeInputContainer}>
55-
<div className={styles.checkpointPrizeAmountContainer}>
56-
<FontAwesomeIcon className={styles.dollarIcon} icon={faDollarSign} />
48+
) : (
49+
<div className={cn(styles.field, styles.col2)}>
50+
<div>
51+
Pay&nbsp;&nbsp;
52+
</div>
53+
<div>
54+
<div className={styles.checkpointPrizeInputContainer}>
55+
<div className={styles.checkpointPrizeAmountContainer}>
56+
<FontAwesomeIcon className={styles.dollarIcon} icon={faDollarSign} />
57+
</div>
58+
<input id='checkpointPrize' name='checkpointPrize' type='text' placeholder='' value={amount} maxLength='7' required onChange={(e) => onChange(number, e.target.value)} />
5759
</div>
58-
<input id='checkpointPrize' name='checkpointPrize' type='text' placeholder='' value={amount} maxLength='7' required onChange={(e) => onChange(number, e.target.value)} />
60+
</div>
61+
<div>
62+
for each submission up to&nbsp;&nbsp;
63+
</div>
64+
<div className={styles.checkpointSelect}>
65+
<Select
66+
name='submissions'
67+
options={_.range(1, MAX_CHECKPOINT_PRIZE_COUNT + 1).map((v) => ({ label: v, value: v }))}
68+
value={{ label: number, value: number }}
69+
isClearable={false}
70+
onChange={e => onChange(e.value, amount)}
71+
isDisabled={false}
72+
/>
5973
</div>
6074
</div>
61-
<div>
62-
for each submission up to
63-
</div>
64-
<div>
65-
<Select
66-
name='submissions'
67-
options={_.range(1, MAX_CHECKPOINT_PRIZE_COUNT + 1).map((v) => ({ label: v, value: v }))}
68-
value={{ label: number, value: number }}
69-
isClearable={false}
70-
onChange={e => onChange(e.value, amount)}
71-
isDisabled={false}
72-
/>
73-
</div>
74-
75-
</div>
76-
)
77-
}
75+
)
76+
}
77+
</div>
7878
</>
7979
)
8080
}

src/components/ChallengeEditor/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -949,17 +949,9 @@ class ChallengeEditor extends Component {
949949
async createNewChallenge () {
950950
if (!this.props.isNew) return
951951
const { metadata, createChallenge, projectDetail } = this.props
952-
const { showDesignChallengeWarningModel, challenge: { name, trackId, typeId, milestoneId, roundType, challengeType } } = this.state
952+
const { challenge: { name, trackId, typeId, milestoneId, roundType, challengeType } } = this.state
953953
const { timelineTemplates } = metadata
954954
const isDesignChallenge = trackId === DES_TRACK_ID
955-
const isChallengeType = typeId === CHALLENGE_TYPE_ID
956-
957-
if (!showDesignChallengeWarningModel && isDesignChallenge && isChallengeType) {
958-
this.setState({
959-
showDesignChallengeWarningModel: true
960-
})
961-
return
962-
}
963955

964956
// indicate that creating process has started
965957
this.setState({ isSaving: true })

src/components/Select/styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default {
5555
paddingLeft: '10px',
5656
border: 'none',
5757
input: {
58-
width: 'auto !important',
58+
width: '100% !important',
5959
height: 'auto !important',
6060
lineHeight: 'normal !important'
6161
}

src/config/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,5 +297,6 @@ export const MULTI_ROUND_CHALLENGE_DESC_TEMPLATE = '## Challenge Introduction\n'
297297
'\n' +
298298
'## Challenge Description'
299299

300-
export const MAX_CHECKPOINT_PRIZE_COUNT = 5
300+
export const MAX_CHECKPOINT_PRIZE_COUNT = 8
301301
export const DEFAULT_CHECKPOINT_PRIZE = 50
302+
export const DEFAULT_CHECKPOINT_PRIZE_COUNT = 5

0 commit comments

Comments
 (0)