From dd0fdb9bdde2d84fa76813d6c089726784730c42 Mon Sep 17 00:00:00 2001 From: maxceem Date: Fri, 4 Dec 2020 12:30:47 +0200 Subject: [PATCH 1/2] fix: validation of "tags" ref issue #854 --- src/components/ChallengeEditor/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index a9681444..6607f025 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -639,15 +639,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 () { From bfeb62719f653f999320bef3d8ee538733bc3248 Mon Sep 17 00:00:00 2001 From: maxceem Date: Fri, 4 Dec 2020 12:45:25 +0200 Subject: [PATCH 2/2] fix: disable "launch active" when no legacy - additionally fixed PrimaryButton styles globally not only for legacy links ref issue #933 --- .../PrimaryButton/PrimaryButton.module.scss | 12 ++++++++++++ src/components/ChallengeEditor/index.js | 16 +++++++++++++--- .../LegacyLinks/LegacyLinks.module.scss | 15 --------------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/components/Buttons/PrimaryButton/PrimaryButton.module.scss b/src/components/Buttons/PrimaryButton/PrimaryButton.module.scss index 08682483..b311d684 100644 --- a/src/components/Buttons/PrimaryButton/PrimaryButton.module.scss +++ b/src/components/Buttons/PrimaryButton/PrimaryButton.module.scss @@ -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; } diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 6607f025..3170656d 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -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 @@ -1193,9 +1194,18 @@ class ChallengeEditor extends Component {
- { isDraft &&
- -
} + {isDraft && ( +
+ {challenge.legacyId ? ( + + ) : ( + + {/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */} + + + )} +
+ )} } {!isLoading && isActive &&
{/*
diff --git a/src/components/LegacyLinks/LegacyLinks.module.scss b/src/components/LegacyLinks/LegacyLinks.module.scss index 6260feb6..a6f48d60 100644 --- a/src/components/LegacyLinks/LegacyLinks.module.scss +++ b/src/components/LegacyLinks/LegacyLinks.module.scss @@ -13,19 +13,4 @@ outline: none; white-space: nowrap; } - - a { - &:hover { - text-decoration: none; - } - &:focus, - &:active, - &:visited { - outline: none; - } - - button:focus { - outline: none; - } - } }