Skip to content

Prod push #928

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 24 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9ce4773
feat: enabled private description as per https://github.com/topcoder-…
Oct 29, 2020
995fee1
chore: add ".nvmrc" file with required node version
maxceem Nov 24, 2020
b549332
feat: show link to Direct project
maxceem Nov 24, 2020
7544307
Merge pull request #909 from maxceem/issue-900
Nov 24, 2020
bd78f07
fix: show all groups in dropdown
maxceem Nov 24, 2020
10efa67
Merge pull request #911 from maxceem/issue-899
Nov 26, 2020
caf6112
feat: hide Direct/OnlineReview when not available
maxceem Nov 27, 2020
81d2c2e
feat: disable buttons and show tooltip
maxceem Nov 27, 2020
9938bdb
fix: for route links
maxceem Nov 27, 2020
80bbfc7
fix: forward ref instead of custom prop
maxceem Nov 27, 2020
525bf0d
docs: improve comments
maxceem Nov 27, 2020
5b841c9
fix: remove 'Direct/Online Review' on Create New
maxceem Nov 27, 2020
99da318
fix: space between the buttons
maxceem Nov 27, 2020
ee177ab
Merge pull request #919 from maxceem/issue-772
Nov 28, 2020
1ed5b0f
Merge pull request #918 from maxceem/issue-775
Nov 28, 2020
e615926
Merge branch 'develop' into issue-912
maxceem Nov 28, 2020
9258a0c
feat: f2f should have only one prize
maxceem Nov 30, 2020
ee1442b
fix: integers as maximum number of submission
maxceem Nov 30, 2020
42e3bbf
fix: remove formatter to see the real value
maxceem Nov 30, 2020
27d896f
Merge pull request #916 from maxceem/issue-912
Dec 2, 2020
b8ca07e
Merge pull request #921 from maxceem/issue-784
Dec 2, 2020
b02ee11
Merge pull request #920 from maxceem/issue-865
Dec 2, 2020
b401239
fix: git#923-Default Timeline Not Selected for Design Challenge
Dec 3, 2020
a0c938a
Merge pull request #897 from topcoder-platform/feature/enable-private…
Dec 3, 2020
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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.22.1
10,103 changes: 30 additions & 10,073 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@fortawesome/fontawesome-svg-core": "^1.2.14",
"@fortawesome/free-solid-svg-icons": "^5.7.1",
"@fortawesome/react-fontawesome": "^0.1.4",
"@popperjs/core": "^2.5.4",
"@svgr/webpack": "2.4.1",
"axios": "^0.19.0",
"babel-core": "7.0.0-bridge.0",
Expand Down Expand Up @@ -74,6 +75,7 @@
"react-google-charts": "^3.0.13",
"react-helmet": "^5.2.0",
"react-js-pagination": "^3.0.3",
"react-popper": "^2.2.4",
"react-redux": "^6.0.0",
"react-redux-toastr": "^7.5.1",
"react-router-dom": "^4.3.1",
Expand Down
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 @@ -44,4 +44,16 @@
background-color: $inactive;
}
}

/* this style just visually simulates the disable status of the button */
&.disabled {
cursor: default;
background-color: $inactive;

// override possible styles for
&:not(:disabled),
&:disabled {
cursor: default;
}
}
}
44 changes: 33 additions & 11 deletions src/components/Buttons/PrimaryButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,50 @@ import cn from 'classnames'

import styles from './PrimaryButton.module.scss'

const PrimaryButton = ({ type, text, link, onClick, submit, disabled }) => {
if (_.isEmpty(link)) {
const PrimaryButton = React.forwardRef(
(
{ type, text, link, onClick, submit, disabled, onMouseEnter, onMouseLeave },
ref
) => {
if (_.isEmpty(link)) {
return (
<button
type={submit ? 'submit' : 'button'}
className={cn(styles.container, styles[type])}
onClick={submit ? null : onClick}
disabled={disabled}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
ref={ref}
>
<span>{text}</span>
</button>
)
}
return (
<button type={submit ? 'submit' : 'button'} className={cn(styles.container, styles[type])} onClick={submit ? null : onClick} disabled={disabled}>
<Link
className={cn(styles.container, styles[type])}
to={`${link}`}
ref={ref}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
<span>{text}</span>
</button>
</Link>
)
}
return (
<Link className={cn(styles.container, styles[type])} to={`${link}`}>
<span>{text}</span>
</Link>
)
}
)

PrimaryButton.propTypes = {
type: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
link: PropTypes.string,
onClick: PropTypes.func,
submit: PropTypes.bool,
disabled: PropTypes.bool
disabled: PropTypes.bool,
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func,
innerRef: PropTypes.any
}

export default PrimaryButton
10 changes: 5 additions & 5 deletions src/components/ChallengeEditor/ChallengePrizes-Field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PrizeInput from '../../PrizeInput'
import styles from './ChallengePrizes-Field.module.scss'
import cn from 'classnames'
import { PrimaryButton } from '../../Buttons'
import { CHALLENGE_PRIZE_TYPE, VALIDATION_VALUE_TYPE, PRIZE_SETS_TYPE } from '../../../config/constants'
import { CHALLENGE_PRIZE_TYPE, VALIDATION_VALUE_TYPE, PRIZE_SETS_TYPE, CHALLENGE_TYPES_WITH_MULTIPLE_PRIZES } from '../../../config/constants'
import { validateValue } from '../../../util/input-check'

class ChallengePrizesField extends Component {
Expand Down Expand Up @@ -61,12 +61,12 @@ class ChallengePrizesField extends Component {
renderPrizes () {
const { currentPrizeIndex } = this.state
const { readOnly, challenge } = this.props
const isTask = _.get(challenge, 'task.isTask', false)
const allowMultiplePrizes = _.includes(CHALLENGE_TYPES_WITH_MULTIPLE_PRIZES, challenge.type)
return _.map(this.getChallengePrize().prizes, (prize, index, { length }) => (
<div key={`${index}-${prize.amount}-edit`}>
<div className={styles.row}>
<div className={cn(styles.field, styles.col1)}>
<label htmlFor={`${index}-prize`}>Prize {!isTask ? index + 1 : ''} {!readOnly && (<span>*</span>)}:</label>
<label htmlFor={`${index}-prize`}>Prize {allowMultiplePrizes ? index + 1 : ''} {!readOnly && (<span>*</span>)}:</label>
</div>
{readOnly ? (
<span>${prize.value}</span>
Expand Down Expand Up @@ -101,7 +101,7 @@ class ChallengePrizesField extends Component {

render () {
const { readOnly, challenge } = this.props
const isTask = _.get(challenge, 'task.isTask', false)
const allowMultiplePrizes = _.includes(CHALLENGE_TYPES_WITH_MULTIPLE_PRIZES, challenge.type)
return (
<div className={styles.container}>
<div className={styles.row}>
Expand All @@ -110,7 +110,7 @@ class ChallengePrizesField extends Component {
</div>
</div>
{ this.renderPrizes() }
{!readOnly && !isTask && (<div className={styles.button} onClick={this.addNewPrize}>
{!readOnly && allowMultiplePrizes && (<div className={styles.button} onClick={this.addNewPrize}>
<PrimaryButton text={'Add New Prize'} type={'info'} />
</div>)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@

.actionButtonsRight {
right: 20px;

button:not(:last-child),
a:not(:last-child) {
margin-right: 20px;
}
}

.button {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MaximumSubmissionsField extends Component {
placeholder=''
value={count}
maxLength='200'
onChange={(e) => onUpdateMetadata('submissionLimit', e.target.value, 'count')}
onChange={(e) => onUpdateMetadata('submissionLimit', e.target.value.replace(/[^\d]+/g, ''), 'count')}
/>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/ChallengeEditor/TextEditor-Field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ class TextEditorField extends Component {

TextEditorField.defaultProps = {
challengeTags: [],
// TODO: For our first go-live, we're probably going to have this UI in production before the Community App work to display data from V5 is available. Only hide the UI elements for private description for now. Don't take out any code or functionality.
shouldShowPrivateDescription: false,
shouldShowPrivateDescription: true,
onUpdateMetadata: () => {},
onUpdateCheckbox: () => {},
addFileType: () => {},
Expand Down
4 changes: 2 additions & 2 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ class ChallengeEditor extends Component {
const { challengeTimelines, timelineTemplates } = metadata

// all timeline template ids available for the challenge type
const availableTemplateIds = _.filter(challengeTimelines, tt => tt.typeId === challenge.typeId).map(tt => tt.timelineTemplateId)
const availableTemplateIds = _.filter(challengeTimelines, ct => ct.typeId === challenge.typeId && ct.trackId === challenge.trackId).map(tt => tt.timelineTemplateId)
// filter and return timeline templates that are available for this challenge type
return _.filter(timelineTemplates, tt => availableTemplateIds.indexOf(tt.id) !== -1)
}
Expand Down Expand Up @@ -1344,7 +1344,7 @@ class ChallengeEditor extends Component {
<div className={styles.wrapper}>
<Helmet title={getTitle(isNew)} />
<div className={cn(styles.actionButtons, styles.actionButtonsLeft)}>
<LegacyLinks challenge={challenge} />
{!isNew && <LegacyLinks challenge={challenge} />}
</div>
<div className={styles.title}>{getTitle(isNew)}</div>
<div className={cn(styles.actionButtons, styles.actionButtonsRight)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
padding: 0 20px;
}

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

> a + a {
margin-left: 20px;
}
}

.buttonLaunchNew {
min-width: 135px;
height: 40px;
Expand Down
33 changes: 21 additions & 12 deletions src/components/ChallengesComponent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PropTypes from 'prop-types'
import Sticky from 'react-stickynode'
import { Helmet } from 'react-helmet'
import { Link } from 'react-router-dom'
import { CONNECT_APP_URL } from '../../config/constants'
import { CONNECT_APP_URL, DIRECT_PROJECT_URL } from '../../config/constants'

import { PrimaryButton } from '../Buttons'
import ChallengeList from './ChallengeList'
Expand All @@ -32,17 +32,26 @@ const ChallengesComponent = ({
<div>
<Helmet title={activeProject ? activeProject.name : ''} />
<div className={styles.titleContainer}>
{(activeProject && activeProject.id) ? (
<a
className={styles.buttonLaunchNew}
href={`${CONNECT_APP_URL}/projects/${activeProject.id}`}
target={'_blank'}
>
<PrimaryButton text={'View Project in Connect'} type={'info'} />
</a>
) : (
<span />
)}
<div className={styles.titleLinks}>
{activeProject && activeProject.id && (
<a
className={styles.buttonLaunchNew}
href={`${CONNECT_APP_URL}/projects/${activeProject.id}`}
target={'_blank'}
>
<PrimaryButton text={'View Project in Connect'} type={'info'} />
</a>
)}
{activeProject && activeProject.directProjectId && (
<a
className={styles.buttonLaunchNew}
href={`${DIRECT_PROJECT_URL}/projectOverview?formData.projectId=${activeProject.directProjectId}`}
target={'_blank'}
>
<PrimaryButton text={'View Project in Direct'} type={'info'} />
</a>
)}
</div>
<div
className={styles.title}
dangerouslySetInnerHTML={{
Expand Down
14 changes: 12 additions & 2 deletions src/components/LegacyLinks/LegacyLinks.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
display: flex;
margin-top: auto;

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

button {
height: 40px;
outline: none;
white-space: nowrap;
}

a {
&:hover {
text-decoration: none;
}
Expand All @@ -18,4 +28,4 @@
outline: none;
}
}
}
}
42 changes: 27 additions & 15 deletions src/components/LegacyLinks/index.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
/**
* Component to render LegacyLinks of the app
*/
import React from 'react'
import React, { useCallback } from 'react'
import PropTypes from 'prop-types'
import styles from './LegacyLinks.module.scss'
import { DIRECT_PROJECT_URL, ONLINE_REVIEW_URL } from '../../config/constants'
import PrimaryButton from '../Buttons/PrimaryButton'
import Tooltip from '../Tooltip'

const LegacyLinks = ({ challenge }) => {
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}>
<a
href={directUrl}
target={'_blank'}
onClick={(e) => e.stopPropagation()}
>
<PrimaryButton text={'Direct'} type={'info'} />
</a>
<a
href={orUrl}
target={'_blank'}
onClick={(e) => e.stopPropagation()}
>
<PrimaryButton text={'Online Review'} type={'info'} />
</a>
{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='Legacy project is not yet created'>
{/* Don't disable button for real inside tooltip, otherwise mouseEnter/Leave events work not good */}
<PrimaryButton text={'Direct'} type={'disabled'} />
</Tooltip>
<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={'Online Review'} type={'disabled'} />
</Tooltip>
</>
)}
</div>
)
}
Expand Down
22 changes: 22 additions & 0 deletions src/components/Tooltip/Tooltip.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@import "../../styles/includes";

.popover {
background-color: $darker-gray;
border-radius: 7px;
z-index: 1000;
}

.popoverArrow {
border-style: solid;
border-width: 7px 7px 0 7px;
border-color: $darker-gray transparent transparent transparent;
height: 0;
bottom: -6px;
width: 0;
}

.content {
color: #fff;
font-size: 12px;
padding: 10px;
}
Loading