Skip to content
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
23 changes: 14 additions & 9 deletions src/components/ChallengeEditor/ChallengeEditor.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,26 @@
}
}

.title {
@include roboto-bold();
.topContainer {
margin-top: 30px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
}

.leftContainer {
display: flex;
align-items: center;
}

.title {
font-size: 24px;
font-weight: 700;
line-height: 29px;
margin-right: 5px;
color: $challenges-title;
margin-top: 30px;
text-align: center;

span {
color: $tc-red;
}

}

.textRequired {
Expand Down Expand Up @@ -255,7 +261,6 @@
}

.actionButtons {
position: absolute;
top: 30px;
a,button {
height: 40px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,32 @@
$tc-dark-blue: #0681ff;
$tc-white: #FFFFFF;

.topContainer {
margin-top: 30px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
}

.leftContainer {
display: flex;
align-items: center;
}
.title {
@include roboto-bold();

font-size: 24px;
font-weight: 700;
line-height: 29px;
margin-right: 5px;
color: $challenges-title;
text-align: center;
}

.actionButtons {
display: flex;
position: absolute;
top: 30px;
margin-top: 53px;
}

.actionButtonsLeft {
Expand Down Expand Up @@ -38,21 +59,6 @@ $tc-white: #FFFFFF;
}
}

.title {
@include roboto-bold();

font-size: 24px;
font-weight: 700;
line-height: 29px;
color: $challenges-title;
margin-top: 25px;
text-align: center;

span {
color: $tc-red;
}
}

.challenge-view-selector {
display: flex;
flex-wrap: wrap;
Expand Down
98 changes: 51 additions & 47 deletions src/components/ChallengeEditor/ChallengeViewTabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,60 +81,64 @@ const ChallengeViewTabs = ({
return (
<div className={styles.list}>
<Helmet title='View Details' />
{!isTask && (
<div className={styles.topContainer}>
<div className={styles.leftContainer}>
<div className={styles.title}>{challenge.name}</div>
{!isTask && (
<div
className={cn(
styles.actionButtons,
styles.button,
styles.actionButtonsLeft
)}
>
<LegacyLinks challenge={challenge} challengeView />
</div>
)}
</div>
<div
className={cn(
styles.actionButtons,
styles.button,
styles.actionButtonsLeft
styles.actionButtonsRight
)}
>
<LegacyLinks challenge={challenge} challengeView />
{(challenge.status === 'Draft' || challenge.status === 'New') && <div className={styles['cancel-button']}><CancelDropDown challenge={challenge} onSelectMenu={cancelChallenge} /></div>}
{challenge.status === 'Draft' && (
<div className={styles.button}>
{challenge.legacyId || isTask ? (
<PrimaryButton
text={'Launch'}
type={'info'}
onClick={onLaunchChallenge}
/>
) : (
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Launch'} type={'disabled'} />
</Tooltip>
)}
</div>
)}
{isTask && challenge.status === 'Active' && (
<div className={styles.button}>
{assignedMemberDetails ? (
<Tooltip content={MESSAGE.MARK_COMPLETE}>
<PrimaryButton text={'Mark Complete'} type={'success'} onClick={onCloseTask} />
</Tooltip>
) : (
<Tooltip content={MESSAGE.NO_TASK_ASSIGNEE}>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Mark Complete'} type={'disabled'} />
</Tooltip>
)}
</div>
)}
{enableEdit && (
<PrimaryButton text={'Edit'} type={'info'} submit link={`./edit`} />
)}
<PrimaryButton text={'Back'} type={'info'} submit link={`..`} />
</div>
)}
<div className={styles.title}>{challenge.name}</div>
<div
className={cn(
styles.actionButtons,
styles.button,
styles.actionButtonsRight
)}
>
{(challenge.status === 'Draft' || challenge.status === 'New') && <div className={styles['cancel-button']}><CancelDropDown challenge={challenge} onSelectMenu={cancelChallenge} /></div>}
{challenge.status === 'Draft' && (
<div className={styles.button}>
{challenge.legacyId || isTask ? (
<PrimaryButton
text={'Launch'}
type={'info'}
onClick={onLaunchChallenge}
/>
) : (
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Launch'} type={'disabled'} />
</Tooltip>
)}
</div>
)}
{isTask && challenge.status === 'Active' && (
<div className={styles.button}>
{assignedMemberDetails ? (
<Tooltip content={MESSAGE.MARK_COMPLETE}>
<PrimaryButton text={'Mark Complete'} type={'success'} onClick={onCloseTask} />
</Tooltip>
) : (
<Tooltip content={MESSAGE.NO_TASK_ASSIGNEE}>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Mark Complete'} type={'disabled'} />
</Tooltip>
)}
</div>
)}
{enableEdit && (
<PrimaryButton text={'Edit'} type={'info'} submit link={`./edit`} />
)}
<PrimaryButton text={'Back'} type={'info'} submit link={`..`} />
</div>
<div className={styles['challenge-view-selector']}>
<a
Expand Down
16 changes: 9 additions & 7 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1601,13 +1601,15 @@ class ChallengeEditor extends Component {
return (
<div className={styles.wrapper}>
<Helmet title={getTitle(isNew)} />
<div className={cn(styles.actionButtons, styles.actionButtonsLeft)}>
{!isNew && <LegacyLinks challenge={challenge} />}
</div>
<div className={styles.title}>{getTitle(isNew)}</div>
<div className={cn(styles.actionButtons, styles.actionButtonsRight)}>
{!isNew && this.props.challengeDetails.status === 'New' && <PrimaryButton text={'Delete'} type={'danger'} onClick={this.deleteModalLaunch} />}
<PrimaryButton text={'Back'} type={'info'} submit link={`/projects/${projectDetail.id}/challenges`} />
<div className={styles.topContainer}>
<div className={styles.leftContainer}>
<div className={styles.title}>{getTitle(isNew)}</div>
{!isNew && <LegacyLinks challenge={challenge} />}
</div>
<div className={cn(styles.actionButtons, styles.actionButtonsRight)}>
{!isNew && this.props.challengeDetails.status === 'New' && <PrimaryButton text={'Delete'} type={'danger'} onClick={this.deleteModalLaunch} />}
<PrimaryButton text={'Back'} type={'info'} submit link={`/projects/${projectDetail.id}/challenges`} />
</div>
</div>
<div className={styles.textRequired}>* Required</div>
<div className={styles.container}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

font-size: 24px;
font-weight: 700;
margin-right: 5px;
line-height: 29px;
color: $challenges-title;
text-align: center;
Expand All @@ -22,12 +23,17 @@
justify-content: space-between;
align-items: center;
padding: 0 20px;

}

.titleLinks {
align-items: center;
display: flex;

> span a {
margin: 2px 5px 0;
}

> a + a {
margin-left: 20px;
}
Expand Down
12 changes: 2 additions & 10 deletions src/components/LegacyLinks/LegacyLinks.module.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
@import "../../styles/includes";
.container {
display: flex;
margin-top: auto;
align-items: center;

button:not(:first-child),
a:not(:first-child) {
margin-left: 20px;
}

button {
height: 40px;
outline: none;
white-space: nowrap;
> a {
margin: 0 5px;
}

.row {
Expand Down
27 changes: 2 additions & 25 deletions src/components/LegacyLinks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,17 @@ import React, { useCallback } from 'react'
import PropTypes from 'prop-types'
import cn from 'classnames'
import styles from './LegacyLinks.module.scss'
import { DIRECT_PROJECT_URL, MESSAGE, ONLINE_REVIEW_URL } from '../../config/constants'
import PrimaryButton from '../Buttons/PrimaryButton'
import Tooltip from '../Tooltip'
import { ONLINE_REVIEW_URL } from '../../config/constants'

const LegacyLinks = ({ challenge, challengeView }) => {
const onClick = useCallback((e) => {
e.stopPropagation()
}, [])

const directUrl = `${DIRECT_PROJECT_URL}/contest/detail?projectId=${challenge.legacyId}`
const orUrl = `${ONLINE_REVIEW_URL}/review/actions/ViewProjectDetails?pid=${challenge.legacyId}`
return (
<div className={styles.container}>
{challenge.legacyId ? (
<>
<a href={directUrl} target={'_blank'} onClick={onClick}>
<PrimaryButton text={'Direct'} type={'info'} />
</a>
<a href={orUrl} target={'_blank'} onClick={onClick}>
<PrimaryButton text={'Online Review'} type={'info'} />
</a>
</>
) : (
<>
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Direct'} type={'disabled'} />
</Tooltip>
<Tooltip content={MESSAGE.NO_LEGACY_CHALLENGE}>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Online Review'} type={'disabled'} />
</Tooltip>
</>
)}
( <a href={orUrl} target={'_blank'} onClick={onClick}>Online Review</a> )
<div>
{ challengeView && challenge.discussions && challenge.discussions.map(d => (
<div key={d.id} className={cn(styles.row, styles.topRow)}>
Expand Down