Skip to content

Commit a5aa099

Browse files
committed
Modified project controller to return projects for multiple challenges which share the same partner organization
Removed challengeData property and challenge info from partner review pageHeader Modified feedback display to not render reviews without feedback message Added challenge badge label truncate condition to project card to prevent long labels from overflowing Fixed issue with reviewer avatars not rendering properly for projects with more than 2 reviewers Removed unnused code snippets Modified AlertBlock to not render announcements, if there are no alerts to show Removed unnused translations
1 parent 77af2f1 commit a5aa099

8 files changed

Lines changed: 67 additions & 97 deletions

File tree

backend/modules/project/controller.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,20 @@ controller.getDataForPartnerReviewing = async (event, user) => {
241241
recruiter => recruiter.recruiterId === user.sub,
242242
)
243243
if (challengeOrg) {
244-
const challengeData = _.find(
245-
event.challenges,
246-
challenge => challenge.partner === challengeOrg.organization,
247-
)
248-
const projectsFilteredByChallenge = _.filter(
249-
projectsWithExistingTeamsAndFinal,
250-
project => _.includes(project.challenges, challengeData.slug),
251-
)
244+
const challengesArray = []
245+
event.challenges.map(challenge => {
246+
if (challenge.partner === challengeOrg.organization) {
247+
challengesArray.push(challenge.slug)
248+
}
249+
})
250+
const projectsFilteredByChallenge = []
251+
252+
projectsWithExistingTeamsAndFinal.map(project => {
253+
if (_.includes(challengesArray, project.challenges[0])) {
254+
projectsFilteredByChallenge.push(project)
255+
}
256+
})
252257
data.projects = projectsFilteredByChallenge
253-
data.challenge = challengeData
254258
} else {
255259
data.projects = []
256260
}

frontend/src/components/modals/ProjectReviewModal/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ const ProjectScoreModal = ({
3030
)}
3131
{projectScoreData?.reviewers?.length > 0 &&
3232
projectScoreData.reviewers.map((reviewer, index) => {
33+
if (!reviewer?.message) {
34+
return null
35+
}
3336
return (
3437
<ReviewElement
3538
key={index}

frontend/src/components/projects/ProjectsGridItem/index.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ const ProjectsGridItem = ({
120120

121121
const styling = {
122122
punchlineMaxLength: 150,
123+
challengeMaxLength: 30,
123124
}
124125

125126
const stylingModifiers = styleRules => {
@@ -179,7 +180,12 @@ const ProjectsGridItem = ({
179180
{project.challenges.map((challenge, index) => (
180181
<Chip
181182
key={index}
182-
label={challenge.replaceAll('-', ' ')}
183+
label={_.truncate(
184+
challenge.replaceAll('-', ' '),
185+
{
186+
length: styling.challengeMaxLength,
187+
},
188+
)}
183189
/>
184190
))}
185191
</div>
@@ -251,9 +257,11 @@ const ProjectsGridItem = ({
251257
<Tooltip
252258
key={index}
253259
title={`Reviewed by ${
254-
project.reviewers.length - 1
260+
project?.scoreData
261+
?.reviewers?.length - 1
255262
} more ${
256-
project.reviewers.length -
263+
project?.scoreData
264+
?.reviewers?.length -
257265
1 >
258266
1
259267
? 'people'
@@ -262,8 +270,8 @@ const ProjectsGridItem = ({
262270
>
263271
<Avatar>
264272
+
265-
{project.reviewers.length -
266-
1}
273+
{project?.scoreData
274+
?.reviewers?.length - 1}
267275
</Avatar>
268276
</Tooltip>
269277
)
Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,56 @@
11
import React from 'react'
2-
import { useSelector } from 'react-redux'
32
import { Grid, Typography } from '@material-ui/core'
4-
import * as DashboardSelectors from 'redux/dashboard/selectors'
53
import GradientBox from 'components/generic/GradientBox'
64
import { Alerts } from '../../../../../../components/messaging/alerts'
75
import TimeLineBlock from '../Blocks/TimeLineBlock'
86

97
const makeBoxStyles = () => ({
10-
11-
128
backgroundColor: '#f7fafc',
139
border: `2px solid #e2e8f0`,
1410
borderRadius: '6px',
15-
height: '100%'
11+
height: '100%',
1612

1713
//TODO: blurr the bottom
1814

1915
// backgroundColor: '#f8f8f8',
20-
2116
})
2217

2318
const makeTimelineStyles = () => ({
24-
25-
26-
2719
backgroundColor: '#f7fafc',
2820
border: `2px solid #e2e8f0`,
2921
borderRadius: '6px',
3022
height: '100%',
3123

3224
overflow: 'auto',
3325

34-
35-
3626
// backgroundColor: '#f8f8f8',
37-
3827
})
3928

4029
export default ({ alerts = [] }) => {
41-
4230
return (
4331
<>
44-
<Grid
45-
direction="column"
46-
alignItems="stretch"
47-
item
48-
xs={8}
49-
style={{ marginLeft: '20px', marginRight: '20px' }}
50-
>
51-
<GradientBox
52-
style={makeBoxStyles()}
53-
color="theme_white"
54-
p={3}
32+
{alerts && alerts.length > 0 && (
33+
<Grid
34+
direction="column"
35+
alignItems="stretch"
36+
item
37+
xs={8}
38+
style={{ marginLeft: '20px', marginRight: '20px' }}
5539
>
56-
<Typography variant="button" gutterBottom>
57-
Announcements
58-
</Typography>
59-
<hr className="tw-h-px tw-bg-gray-500 tw-border-0 tw-dark:bg-gray-900"></hr>
60-
<Alerts alerts={alerts} />
61-
</GradientBox>
62-
63-
</Grid>
64-
<Grid
65-
item
66-
xs={4}>
40+
<GradientBox
41+
style={makeBoxStyles()}
42+
color="theme_white"
43+
p={3}
44+
>
45+
<Typography variant="button" gutterBottom>
46+
Announcements
47+
</Typography>
48+
<hr className="tw-h-px tw-bg-gray-500 tw-border-0 tw-dark:bg-gray-900"></hr>
49+
<Alerts alerts={alerts} />
50+
</GradientBox>
51+
</Grid>
52+
)}
53+
<Grid item xs={alerts && alerts.length > 0 ? 4 : 12}>
6754
<GradientBox
6855
style={makeTimelineStyles()}
6956
color="theme_white"
@@ -75,7 +62,7 @@ export default ({ alerts = [] }) => {
7562
<hr className="tw-h-px tw-bg-gray-500 tw-border-0 tw-dark:bg-gray-900"></hr>
7663
<TimeLineBlock />
7764
</GradientBox>
78-
</Grid >
65+
</Grid>
7966
</>
8067
)
8168
}

frontend/src/pages/_dashboard/renderDashboard/generalPages/default/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,10 @@ import { EventPageScripts } from '@hackjunction/shared'
2222
import { useSelector } from 'react-redux'
2323
import * as DashboardSelectors from 'redux/dashboard/selectors'
2424
// import * as AuthSelectors from 'redux/auth/selectors'
25-
import * as UserSelectors from 'redux/user/selectors'
2625
// import PartnerReviewingBlock from './Blocks/PartnerReviewingBlock'
2726
export default ({ alerts }) => {
28-
const user = useSelector(UserSelectors.userProfile)
2927
const event = useSelector(DashboardSelectors.event)
3028
const projects = useSelector(DashboardSelectors.projects)
31-
// const isPartner =
32-
// user.userId == 'google-oauth2|108766439620242776277' ||
33-
// (useSelector(AuthSelectors.idTokenData)?.roles?.includes('Recruiter') &&
34-
// !useSelector(AuthSelectors.idTokenData)?.roles?.includes(
35-
// 'SuperAdmin',
36-
// ))
3729
return (
3830
<Box>
3931
<PageHeader heading="Dashboard" />

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React, { useEffect, useState } from 'react'
22

3-
import { useRouteMatch, useLocation } from 'react-router'
3+
import { useRouteMatch } from 'react-router'
44
import { useDispatch, useSelector } from 'react-redux'
5-
import { makeStyles } from '@material-ui/core/styles'
65
import PageWrapper from 'components/layouts/PageWrapper'
76

87
import PartnerDashboard from './partner'
@@ -11,12 +10,10 @@ import OrganizerDashboard from './organiser'
1110

1211
import * as DashboardSelectors from 'redux/dashboard/selectors'
1312
import * as DashboardActions from 'redux/dashboard/actions'
14-
import * as OrganiserActions from 'redux/organiser/actions'
1513
import * as AuthSelectors from 'redux/auth/selectors'
1614
import * as UserSelectors from 'redux/user/selectors'
1715
import * as UserActions from 'redux/user/actions'
1816

19-
import { useTranslation } from 'react-i18next'
2017
import { useLazyQuery, useSubscription } from '@apollo/client'
2118
import { ALERTS_QUERY } from 'graphql/queries/alert'
2219
import { NEW_ALERTS_SUBSCRIPTION } from 'graphql/subscriptions/alert'
@@ -27,21 +24,6 @@ import {
2724
} from 'graphql/queries/events'
2825
// import { Chat } from 'components/messaging/chat'
2926

30-
const useStyles = makeStyles(theme => ({
31-
sidebarTop: {
32-
padding: theme.spacing(3),
33-
height: '100%',
34-
display: 'flex',
35-
flexDirection: 'column',
36-
alignItems: 'center',
37-
justifyContent: 'center',
38-
},
39-
sidebarLogo: {
40-
width: '100%',
41-
objectFit: 'contain',
42-
},
43-
}))
44-
4527
export default role => {
4628
const match = useRouteMatch()
4729
const dispatch = useDispatch()

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react'
1+
import React, { useEffect, useState } from 'react'
22

33
import { useRouteMatch, useLocation } from 'react-router'
44
import DashboardIcon from '@material-ui/icons/Dashboard'
@@ -23,7 +23,6 @@ import CalendarPage from './calendar'
2323
import RecruitmentPage from './partnerrecruitment'
2424
import MapPage from '../generalPages/map'
2525

26-
import { useTranslation } from 'react-i18next'
2726
import Badge from '@material-ui/core/Badge'
2827

2928
import ProjectsPage from './projects'
@@ -54,7 +53,6 @@ export default ({
5453
lockedPages,
5554
}) => {
5655
const classes = useStyles()
57-
const { t } = useTranslation()
5856
const match = useRouteMatch()
5957
const location = useLocation()
6058
const [alertCount, setAlertCount] = useState(originalAlertCount)
@@ -92,7 +90,7 @@ export default ({
9290
<DashboardIcon />
9391
</Badge>
9492
),
95-
label: t('Dashboard_'),
93+
label: 'Dashboard',
9694
component: () => {
9795
setAlertCount(0)
9896
if (shownPages?.experimental) {
@@ -129,7 +127,7 @@ export default ({
129127
exact: true,
130128
icon: <AmpStoriesIcon />,
131129
hidden: !shownPages?.hackerPack,
132-
label: t('Hackerpack_'),
130+
label: 'Hackerpack',
133131
component: HackerpackPage,
134132
},
135133
{

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,17 @@ export default ({ event }) => {
191191
return (
192192
<>
193193
<div className="tw-flex tw-justify-between tw-items-end">
194-
{inputData?.challenge?.name && (
195-
<PageHeader
196-
heading={inputData?.challenge.name}
197-
subheading={`By ${inputData?.challenge.partner}`}
198-
alignment="left"
199-
details={`${inputData?.projects.length} project${
200-
inputData?.projects.length > 1 ||
201-
inputData?.projects.length < 1
202-
? 's'
203-
: ''
204-
}`}
205-
/>
206-
)}
194+
<PageHeader
195+
heading="Project review"
196+
subheading={`Available for review:`}
197+
alignment="left"
198+
details={`${inputData?.projects.length} project${
199+
inputData?.projects.length > 1 ||
200+
inputData?.projects.length < 1
201+
? 's'
202+
: ''
203+
}`}
204+
/>
207205
</div>
208206

209207
<Box height={20} />
@@ -235,8 +233,6 @@ export default ({ event }) => {
235233
{scoreCriteriaBase &&
236234
scoreCriteriaBase.length > 0 && (
237235
<EvaluationForm
238-
event={event}
239-
project={selected}
240236
submit={handleSubmit}
241237
score={projectScore}
242238
scoreCriteria={scoreCriteriaBase}

0 commit comments

Comments
 (0)