Skip to content

Commit 431c299

Browse files
committed
Remove legacy challenge block when launching challenges
1 parent 27a8d35 commit 431c299

File tree

5 files changed

+18
-58
lines changed

5 files changed

+18
-58
lines changed

src/components/ChallengeEditor/ChallengeViewTabs/index.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,11 @@ const ChallengeViewTabs = ({
210210
(<div className={styles['cancel-button']}><CancelDropDown challenge={challenge} onSelectMenu={cancelChallenge} /></div>)}
211211
{canLaunch && (
212212
<div className={styles.button}>
213-
{challenge.legacyId || isTask ? (
214-
<PrimaryButton
215-
text='Launch'
216-
type='info'
217-
onClick={onLaunchChallenge}
218-
/>
219-
) : (
220-
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
221-
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
222-
<PrimaryButton text={'Launch'} type={'disabled'} />
223-
</Tooltip>
224-
)}
213+
<PrimaryButton
214+
text='Launch'
215+
type='info'
216+
onClick={onLaunchChallenge}
217+
/>
225218
</div>
226219
)}
227220
{canApprove && (

src/components/ChallengeEditor/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,13 +1595,10 @@ class ChallengeEditor extends Component {
15951595
!preventCopilotFromActivatingTask
15961596
) && (
15971597
<div className={styles.button}>
1598-
{(challenge.legacyId || isTask) && !this.state.hasValidationErrors ? (
1598+
{!this.state.hasValidationErrors ? (
15991599
<PrimaryButton text={'Launch as Active'} type={'info'} onClick={this.toggleLaunch} />
16001600
) : (
1601-
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
1602-
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
1603-
<PrimaryButton text={'Launch as Active'} type={'disabled'} />
1604-
</Tooltip>
1601+
<PrimaryButton text={'Launch as Active'} type={'disabled'} />
16051602
)}
16061603
</div>
16071604
)

src/components/ChallengesComponent/ChallengeCard/index.js

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@
44
import _ from 'lodash'
55
import React from 'react'
66
import PropTypes from 'prop-types'
7-
import cn from 'classnames'
87
import { withRouter, Link } from 'react-router-dom'
98
import moment from 'moment'
109
import 'moment-duration-format'
1110
import ChallengeStatus from '../ChallengeStatus'
1211
import ChallengeTag from '../ChallengeTag'
1312
import styles from './ChallengeCard.module.scss'
1413
import { formatDate } from '../../../util/date'
15-
import { CHALLENGE_STATUS, COMMUNITY_APP_URL, DIRECT_PROJECT_URL, MESSAGE, ONLINE_REVIEW_URL, PROJECT_ROLES } from '../../../config/constants'
14+
import { CHALLENGE_STATUS, COMMUNITY_APP_URL, DIRECT_PROJECT_URL, ONLINE_REVIEW_URL, PROJECT_ROLES } from '../../../config/constants'
1615
import ConfirmationModal from '../../Modal/ConfirmationModal'
1716
import { checkChallengeEditPermission, checkReadOnlyRoles } from '../../../util/tc'
1817
import { getCurrentPhase } from '../../../util/phase'
1918
import AlertModal from '../../Modal/AlertModal'
20-
import Tooltip from '../../Tooltip'
2119

2220
const theme = {
2321
container: styles.modalContainer
@@ -47,11 +45,13 @@ const hoverComponents = (challenge, onUpdateLaunch, deleteModalLaunch) => {
4745
)
4846
}
4947

50-
return challenge.legacyId || isTask ? (
48+
const showLegacyLinks = Boolean(challenge.legacyId) && !isTask
49+
50+
return (
5151
<div className={styles.linkGroup}>
5252
<div className={styles.linkGroupLeft}>
5353
<a className={styles.link} href={communityAppUrl} target='_blank'>View Challenge</a>
54-
{!isTask && (
54+
{showLegacyLinks && (
5555
<div className={styles.linkGroupLeftBottom}>
5656
<a className={styles.link} href={directUrl} target='_blank'>Direct</a>
5757
<span className={styles.linkDivider}>|</span>
@@ -65,33 +65,6 @@ const hoverComponents = (challenge, onUpdateLaunch, deleteModalLaunch) => {
6565
</button>
6666
)}
6767
</div>
68-
) : (
69-
<div className={styles.linkGroup}>
70-
<div className={styles.linkGroupLeft}>
71-
<a className={styles.link} href={communityAppUrl}>View Challenge</a>
72-
{!isTask && (
73-
<div className={styles.linkGroupLeftBottom}>
74-
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
75-
<span className={styles.link}>Direct</span>
76-
</Tooltip>
77-
<span className={styles.linkDivider}>|</span>
78-
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
79-
<span className={styles.link}>OR</span>
80-
</Tooltip>
81-
</div>
82-
)}
83-
</div>
84-
{
85-
challenge.status === 'Draft' && (
86-
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
87-
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
88-
<button className={cn(styles.activateButton, styles.activateButtonDisabled)}>
89-
<span>Activate</span>
90-
</button>
91-
</Tooltip>
92-
)
93-
}
94-
</div>
9568
)
9669
}
9770

src/components/LegacyLinks/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import React, { useCallback } from 'react'
55
import PropTypes from 'prop-types'
66
import cn from 'classnames'
77
import styles from './LegacyLinks.module.scss'
8-
import Tooltip from '../Tooltip'
9-
import { MESSAGE, ONLINE_REVIEW_URL } from '../../config/constants'
8+
import { ONLINE_REVIEW_URL } from '../../config/constants'
109

1110
const LegacyLinks = ({ challenge, challengeView }) => {
1211
const onClick = useCallback((e) => {
@@ -16,12 +15,11 @@ const LegacyLinks = ({ challenge, challengeView }) => {
1615
const orUrl = `${ONLINE_REVIEW_URL}/review/actions/ViewProjectDetails?pid=${challenge.legacyId}`
1716
return (
1817
<div className={styles.container}>
19-
( {challenge.legacyId ? <a href={orUrl} target={'_blank'} onClick={onClick}>Online Review</a>
20-
: <Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
21-
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
22-
<a disabled>Online Review</a>
23-
</Tooltip>}
24-
)
18+
{challenge.legacyId && (
19+
<>
20+
(<a href={orUrl} target={'_blank'} onClick={onClick}>Online Review</a>)
21+
</>
22+
)}
2523
<div>
2624
{ challengeView && challenge.discussions && challenge.discussions.map(d => (
2725
<div key={d.id} className={cn(styles.row, styles.topRow)}>

src/config/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ export const CHALLENGE_TYPES_WITH_MULTIPLE_PRIZES = ['Challenge', 'Marathon Matc
378378
* To have the same wording across the app.
379379
*/
380380
export const MESSAGE = {
381-
NO_LEGACY_CHALLENGE: 'Legacy challenge is not yet created',
382381
NO_TASK_ASSIGNEE: 'Task is not assigned yet',
383382
TASK_CLOSE_SUCCESS: 'Task closed successfully',
384383
CHALLENGE_LAUNCH_SUCCESS: 'Challenge activated successfully',

0 commit comments

Comments
 (0)