Skip to content

Prod update #935

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 4 commits into from
Dec 4, 2020
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
12 changes: 12 additions & 0 deletions src/components/Buttons/PrimaryButton/PrimaryButton.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
border: none;
padding: 0 20px;

// don't underline if button is done as a link
&:hover {
text-decoration: none;
}

// hide outline for buttons and links
&:focus,
&:active,
&:visited {
outline: none;
}

span {
color: $white;
}
Expand Down
31 changes: 25 additions & 6 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import AlertModal from '../Modal/AlertModal'
import PhaseInput from '../PhaseInput'
import LegacyLinks from '../LegacyLinks'
import AssignedMemberField from './AssignedMember-Field'
import Tooltip from '../Tooltip'

const theme = {
container: styles.modalContainer
Expand Down Expand Up @@ -639,15 +640,24 @@ class ChallengeEditor extends Component {
return false
}

return !(Object.values(pick([
const requiredFields = [
'trackId',
'typeId',
'name',
'description',
'tags',
'prizeSets'
], challenge)).filter(v => !v.length).length ||
_.isEmpty(this.state.currentTemplate))
]
let isRequiredMissing = false

requiredFields.forEach((key) => {
const value = challenge[key]

// this check works for string and array values
isRequiredMissing = isRequiredMissing || !value || !value.length
})

return !(isRequiredMissing || _.isEmpty(this.state.currentTemplate))
}

validateChallenge () {
Expand Down Expand Up @@ -1184,9 +1194,18 @@ class ChallengeEditor extends Component {
<div className={styles.button}>
<PrimaryButton text={'Save Draft'} type={'info'} onClick={this.createDraftHandler} />
</div>
{ isDraft && <div className={styles.button}>
<PrimaryButton text={'Launch as Active'} type={'info'} onClick={this.toggleLaunch} />
</div>}
{isDraft && (
<div className={styles.button}>
{challenge.legacyId ? (
<PrimaryButton text={'Launch as Active'} type={'info'} onClick={this.toggleLaunch} />
) : (
<Tooltip content='Legacy project is not yet created'>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Launch as Active'} type={'disabled'} />
</Tooltip>
)}
</div>
)}
</div>}
{!isLoading && isActive && <div className={styles.buttonContainer}>
{/* <div className={styles.button}>
Expand Down
15 changes: 0 additions & 15 deletions src/components/LegacyLinks/LegacyLinks.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,4 @@
outline: none;
white-space: nowrap;
}

a {
&:hover {
text-decoration: none;
}
&:focus,
&:active,
&:visited {
outline: none;
}

button:focus {
outline: none;
}
}
}