Skip to content

Commit 2667a1d

Browse files
committed
Removed unnused packages from RadioScore
Fixed issue preventing scoreCritera scores from reseting to base value Modified styling for ProjectList to trim long project names, tracks and challenge
1 parent fe49acc commit 2667a1d

3 files changed

Lines changed: 32 additions & 22 deletions

File tree

frontend/src/components/generic/RadioScore/index.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
2-
import {
3-
FormControl,
4-
FormControlLabel,
5-
FormLabel,
6-
IconButton,
7-
Radio,
8-
RadioGroup,
9-
Typography,
10-
} from '@material-ui/core'
11-
import { Email } from '@material-ui/icons'
12-
import { Field } from 'formik'
1+
import { FormControl, FormLabel, Radio, RadioGroup } from '@material-ui/core'
132
import _ from 'lodash'
14-
import { capitalize, toInteger, toString } from 'lodash-es'
15-
import React, { useEffect, useState } from 'react'
16-
import { popupCenter } from 'utils/misc'
3+
import { toInteger } from 'lodash-es'
4+
import React, { useState } from 'react'
175
import junctionStyle from 'utils/styles'
186

197
const scoreArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
@@ -51,6 +39,7 @@ export default ({ category, label, onSelectionChange, value = null }) => {
5139
>
5240
{scoreArray.map((score, index) => (
5341
<Radio
42+
key={index}
5443
checked={score === selectedValue}
5544
onChange={() => handleChange(index)}
5645
value={score}

frontend/src/pages/_dashboard/renderDashboard/participant/project/ProjectsList.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Paper, Typography, Chip, Box, Grid } from '@material-ui/core'
55
import * as DashboardSelectors from 'redux/dashboard/selectors'
66

77
import Button from 'components/generic/Button'
8+
import _ from 'lodash'
89

910
export default props => {
1011
const event = useSelector(DashboardSelectors.event)
@@ -29,36 +30,49 @@ export default props => {
2930
}
3031
setChallengeAndTrackSlugState(challengeAndTrackSlugToNameMap)
3132
}, [event])
33+
34+
const styling = {
35+
trackMaxLength: 30,
36+
challengeMaxLength: 30,
37+
projectNameMaxLength: 30,
38+
}
39+
3240
const ProjectCard = props => {
3341
const project = props.project
3442
return (
3543
<Grid item xs={12} md={6}>
3644
<Paper elevation={1}>
3745
<Box p={2}>
3846
<Typography variant="h4" gutterBottom>
39-
{project.name}
47+
{_.truncate(project.name, {
48+
length: styling.projectNameMaxLength,
49+
})}
4050
</Typography>
4151

4252
<Box m={1} mb={2}>
4353
{project.track && (
4454
<Chip
4555
color="primary"
46-
label={
56+
label={_.truncate(
4757
challengeAndTrackSlugState[
4858
project.track
49-
]
50-
}
59+
],
60+
{ length: styling.trackMaxLength },
61+
)}
5162
style={{ margin: '3px' }}
5263
></Chip>
5364
)}
5465
{project.challenges &&
5566
project.challenges.map(challenge => (
5667
<Chip
57-
label={
68+
label={_.truncate(
5869
challengeAndTrackSlugState[
5970
challenge
60-
]
61-
}
71+
],
72+
{
73+
length: styling.challengeMaxLength,
74+
},
75+
)}
6276
style={{ margin: '3px' }}
6377
key={challenge}
6478
/>

frontend/src/pages/_dashboard/renderDashboard/partner/projects/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ export default ({ event }) => {
4747
const [projectScore, setProjectScore] = useState(projectScoreBase)
4848

4949
const resetProjectData = () => {
50+
if (Array.isArray(scoreCriteriaBase) && scoreCriteriaBase.length > 0) {
51+
scoreCriteriaBase.forEach(criteria => {
52+
if (criteria.score) {
53+
delete criteria.score
54+
}
55+
})
56+
}
5057
setSelected(null)
5158
setScoreExists(false)
5259
setProjectScore(projectScoreBase)

0 commit comments

Comments
 (0)