From 2667a1d4f884a9bd8077dd9848454b52ec7d10b2 Mon Sep 17 00:00:00 2001 From: Javier Date: Wed, 20 Mar 2024 18:46:19 +0200 Subject: [PATCH] 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 --- .../components/generic/RadioScore/index.js | 19 +++---------- .../participant/project/ProjectsList.js | 28 ++++++++++++++----- .../renderDashboard/partner/projects/index.js | 7 +++++ 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/generic/RadioScore/index.js b/frontend/src/components/generic/RadioScore/index.js index a26e4eb5..c8c571ac 100644 --- a/frontend/src/components/generic/RadioScore/index.js +++ b/frontend/src/components/generic/RadioScore/index.js @@ -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] @@ -51,6 +39,7 @@ export default ({ category, label, onSelectionChange, value = null }) => { > {scoreArray.map((score, index) => ( handleChange(index)} value={score} diff --git a/frontend/src/pages/_dashboard/renderDashboard/participant/project/ProjectsList.js b/frontend/src/pages/_dashboard/renderDashboard/participant/project/ProjectsList.js index dced7d63..9ca1fe26 100644 --- a/frontend/src/pages/_dashboard/renderDashboard/participant/project/ProjectsList.js +++ b/frontend/src/pages/_dashboard/renderDashboard/participant/project/ProjectsList.js @@ -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) @@ -29,6 +30,13 @@ export default props => { } setChallengeAndTrackSlugState(challengeAndTrackSlugToNameMap) }, [event]) + + const styling = { + trackMaxLength: 30, + challengeMaxLength: 30, + projectNameMaxLength: 30, + } + const ProjectCard = props => { const project = props.project return ( @@ -36,29 +44,35 @@ export default props => { - {project.name} + {_.truncate(project.name, { + length: styling.projectNameMaxLength, + })} {project.track && ( )} {project.challenges && project.challenges.map(challenge => ( diff --git a/frontend/src/pages/_dashboard/renderDashboard/partner/projects/index.js b/frontend/src/pages/_dashboard/renderDashboard/partner/projects/index.js index 2a34fbef..493f8d1f 100644 --- a/frontend/src/pages/_dashboard/renderDashboard/partner/projects/index.js +++ b/frontend/src/pages/_dashboard/renderDashboard/partner/projects/index.js @@ -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)