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
19 changes: 4 additions & 15 deletions frontend/src/components/generic/RadioScore/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import {
FormControl,
FormControlLabel,
FormLabel,
IconButton,
Radio,
RadioGroup,
Typography,
} from '@material-ui/core'
import { Email } from '@material-ui/icons'
import { Field } from 'formik'
import { FormControl, FormLabel, Radio, RadioGroup } from '@material-ui/core'
import _ from 'lodash'
import { capitalize, toInteger, toString } from 'lodash-es'
import React, { useEffect, useState } from 'react'
import { popupCenter } from 'utils/misc'
import { toInteger } from 'lodash-es'
import React, { useState } from 'react'
import junctionStyle from 'utils/styles'

const scoreArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Expand Down Expand Up @@ -51,6 +39,7 @@ export default ({ category, label, onSelectionChange, value = null }) => {
>
{scoreArray.map((score, index) => (
<Radio
key={index}
checked={score === selectedValue}
onChange={() => handleChange(index)}
value={score}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Paper, Typography, Chip, Box, Grid } from '@material-ui/core'
import * as DashboardSelectors from 'redux/dashboard/selectors'

import Button from 'components/generic/Button'
import _ from 'lodash'

export default props => {
const event = useSelector(DashboardSelectors.event)
Expand All @@ -29,36 +30,49 @@ export default props => {
}
setChallengeAndTrackSlugState(challengeAndTrackSlugToNameMap)
}, [event])

const styling = {
trackMaxLength: 30,
challengeMaxLength: 30,
projectNameMaxLength: 30,
}

const ProjectCard = props => {
const project = props.project
return (
<Grid item xs={12} md={6}>
<Paper elevation={1}>
<Box p={2}>
<Typography variant="h4" gutterBottom>
{project.name}
{_.truncate(project.name, {
length: styling.projectNameMaxLength,
})}
</Typography>

<Box m={1} mb={2}>
{project.track && (
<Chip
color="primary"
label={
label={_.truncate(
challengeAndTrackSlugState[
project.track
]
}
],
{ length: styling.trackMaxLength },
)}
style={{ margin: '3px' }}
></Chip>
)}
{project.challenges &&
project.challenges.map(challenge => (
<Chip
label={
label={_.truncate(
challengeAndTrackSlugState[
challenge
]
}
],
{
length: styling.challengeMaxLength,
},
)}
style={{ margin: '3px' }}
key={challenge}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export default ({ event }) => {
const [projectScore, setProjectScore] = useState(projectScoreBase)

const resetProjectData = () => {
if (Array.isArray(scoreCriteriaBase) && scoreCriteriaBase.length > 0) {
scoreCriteriaBase.forEach(criteria => {
if (criteria.score) {
delete criteria.score
}
})
}
setSelected(null)
setScoreExists(false)
setProjectScore(projectScoreBase)
Expand Down