File tree Expand file tree Collapse file tree
src/components/PRGradingScreen Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ const PRGradingTest = () => {
3333 cfg . testDataType
3434 } ${ cfg . notes ? ` — ${ cfg . notes } ` : '' } `,
3535 fromDB : true ,
36+ reviewerCount : cfg . reviewerCount ,
37+ reviewerNames : cfg . reviewerNames || [ ] ,
3638 } ) ) ;
3739 setDynamicTeams ( fetched ) ;
3840 } catch {
@@ -47,7 +49,8 @@ const PRGradingTest = () => {
4749 const allTeams = [ ...STATIC_TEAMS , ...dynamicTeams ] ;
4850
4951 const handleTeamSelect = teamId => {
50- history . push ( '/pr-grading-screen' , { teamId } ) ;
52+ const team = allTeams . find ( t => t . id === teamId ) ;
53+ history . push ( '/pr-grading-screen' , { teamId, config : team } ) ;
5154 } ;
5255
5356 const handleDeleteConfig = async ( e , teamId ) => {
Original file line number Diff line number Diff line change 1- import React from 'react' ;
21import { useLocation } from 'react-router-dom' ;
2+ import { v4 as uuidv4 } from 'uuid' ;
33import { getDataByTeamId } from './mockData' ;
44import PRGradingScreen from './PRGradingScreen' ;
55
6+ const STATIC_IDS = [ 'team1' , 'team2' , 'team3' ] ;
7+
68const PRGradingScreenContainer = ( ) => {
79 const location = useLocation ( ) ;
8-
9- // Get teamId from router state, fallback to default
1010 const teamId = location . state ?. teamId || 'team1' ;
11- const data = getDataByTeamId ( teamId ) ;
11+ const config = location . state ?. config || null ;
12+
13+ if ( ! STATIC_IDS . includes ( teamId ) && config ) {
14+ const reviewers = Array . from ( { length : config . reviewerCount } , ( _ , i ) => ( {
15+ id : uuidv4 ( ) ,
16+ reviewer : config . reviewerNames ?. [ i ] || `Reviewer ${ i + 1 } ` ,
17+ prsNeeded : 10 ,
18+ prsReviewed : 0 ,
19+ gradedPrs : [ ] ,
20+ } ) ) ;
1221
22+ const teamData = {
23+ teamName : config . teamName ,
24+ dateRange : {
25+ start : new Date ( ) . toLocaleDateString ( ) ,
26+ end : new Date ( Date . now ( ) + 7 * 24 * 60 * 60 * 1000 ) . toLocaleDateString ( ) ,
27+ } ,
28+ } ;
29+
30+ return < PRGradingScreen teamData = { teamData } reviewers = { reviewers } /> ;
31+ }
32+
33+ const data = getDataByTeamId ( teamId ) ;
1334 return < PRGradingScreen teamData = { data . teamData } reviewers = { data . reviewers } /> ;
1435} ;
1536
You can’t perform that action at this time.
0 commit comments