Skip to content

Commit 4c60f19

Browse files
author
vikasrohit
authored
Merge pull request #935 from topcoder-platform/develop
Prod update
2 parents 483579a + b41bb0f commit 4c60f19

File tree

3 files changed

+37
-21
lines changed

3 files changed

+37
-21
lines changed

src/components/Buttons/PrimaryButton/PrimaryButton.module.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
border: none;
1515
padding: 0 20px;
1616

17+
// don't underline if button is done as a link
18+
&:hover {
19+
text-decoration: none;
20+
}
21+
22+
// hide outline for buttons and links
23+
&:focus,
24+
&:active,
25+
&:visited {
26+
outline: none;
27+
}
28+
1729
span {
1830
color: $white;
1931
}

src/components/ChallengeEditor/index.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import AlertModal from '../Modal/AlertModal'
4444
import PhaseInput from '../PhaseInput'
4545
import LegacyLinks from '../LegacyLinks'
4646
import AssignedMemberField from './AssignedMember-Field'
47+
import Tooltip from '../Tooltip'
4748

4849
const theme = {
4950
container: styles.modalContainer
@@ -639,15 +640,24 @@ class ChallengeEditor extends Component {
639640
return false
640641
}
641642

642-
return !(Object.values(pick([
643+
const requiredFields = [
643644
'trackId',
644645
'typeId',
645646
'name',
646647
'description',
647648
'tags',
648649
'prizeSets'
649-
], challenge)).filter(v => !v.length).length ||
650-
_.isEmpty(this.state.currentTemplate))
650+
]
651+
let isRequiredMissing = false
652+
653+
requiredFields.forEach((key) => {
654+
const value = challenge[key]
655+
656+
// this check works for string and array values
657+
isRequiredMissing = isRequiredMissing || !value || !value.length
658+
})
659+
660+
return !(isRequiredMissing || _.isEmpty(this.state.currentTemplate))
651661
}
652662

653663
validateChallenge () {
@@ -1184,9 +1194,18 @@ class ChallengeEditor extends Component {
11841194
<div className={styles.button}>
11851195
<PrimaryButton text={'Save Draft'} type={'info'} onClick={this.createDraftHandler} />
11861196
</div>
1187-
{ isDraft && <div className={styles.button}>
1188-
<PrimaryButton text={'Launch as Active'} type={'info'} onClick={this.toggleLaunch} />
1189-
</div>}
1197+
{isDraft && (
1198+
<div className={styles.button}>
1199+
{challenge.legacyId ? (
1200+
<PrimaryButton text={'Launch as Active'} type={'info'} onClick={this.toggleLaunch} />
1201+
) : (
1202+
<Tooltip content='Legacy project is not yet created'>
1203+
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
1204+
<PrimaryButton text={'Launch as Active'} type={'disabled'} />
1205+
</Tooltip>
1206+
)}
1207+
</div>
1208+
)}
11901209
</div>}
11911210
{!isLoading && isActive && <div className={styles.buttonContainer}>
11921211
{/* <div className={styles.button}>

src/components/LegacyLinks/LegacyLinks.module.scss

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,4 @@
1313
outline: none;
1414
white-space: nowrap;
1515
}
16-
17-
a {
18-
&:hover {
19-
text-decoration: none;
20-
}
21-
&:focus,
22-
&:active,
23-
&:visited {
24-
outline: none;
25-
}
26-
27-
button:focus {
28-
outline: none;
29-
}
30-
}
3116
}

0 commit comments

Comments
 (0)