@@ -2,13 +2,12 @@ import '@tremor/react/dist/esm/tremor.css';
2
2
3
3
import { Icon as BpIcon , NonIdealState , Position , Spinner , SpinnerSize } from '@blueprintjs/core' ;
4
4
import { IconNames } from '@blueprintjs/icons' ;
5
- import { Button , Card , Col , ColGrid , Flex , Text , Title } from '@tremor/react' ;
5
+ import { Button , Card , Flex , Text , Title } from '@tremor/react' ;
6
6
import React , { useEffect , useState } from 'react' ;
7
7
import { useDispatch } from 'react-redux' ;
8
8
import { Navigate , useParams } from 'react-router' ;
9
9
import { fetchGradingOverviews } from 'src/commons/application/actions/SessionActions' ;
10
10
import { Role } from 'src/commons/application/ApplicationTypes' ;
11
- import { GradingStatuses } from 'src/commons/assessment/AssessmentTypes' ;
12
11
import SimpleDropdown from 'src/commons/SimpleDropdown' ;
13
12
import { useSession } from 'src/commons/utils/Hooks' ;
14
13
import { numberRegExp } from 'src/features/academy/AcademyTypes' ;
@@ -17,39 +16,31 @@ import { exportGradingCSV, isSubmissionUngraded } from 'src/features/grading/Gra
17
16
import ContentDisplay from '../../../commons/ContentDisplay' ;
18
17
import { convertParamToInt } from '../../../commons/utils/ParamParseHelper' ;
19
18
import GradingSubmissionsTable from './subcomponents/GradingSubmissionsTable' ;
20
- import GradingSummary from './subcomponents/GradingSummary' ;
21
19
import GradingWorkspace from './subcomponents/GradingWorkspace' ;
22
20
21
+ const groupOptions = [
22
+ { value : false , label : 'my groups' } ,
23
+ { value : true , label : 'all groups' }
24
+ ] ;
25
+
26
+ const showOptions = [
27
+ { value : false , label : 'ungraded' } ,
28
+ { value : true , label : 'all' }
29
+ ] ;
30
+
23
31
const Grading : React . FC = ( ) => {
24
- const {
25
- courseId,
26
- gradingOverviews,
27
- role,
28
- group,
29
- assessmentOverviews : assessments = [ ]
30
- } = useSession ( ) ;
31
- const params = useParams < {
32
- submissionId : string ;
33
- questionId : string ;
34
- } > ( ) ;
32
+ const { courseId, gradingOverviews, role, group } = useSession ( ) ;
33
+ const params = useParams < { submissionId : string ; questionId : string } > ( ) ;
35
34
36
35
const isAdmin = role === Role . Admin ;
37
36
const [ showAllGroups , setShowAllGroups ] = useState ( isAdmin || group === null ) ;
38
- const groupOptions = [
39
- { value : false , label : 'my groups' } ,
40
- { value : true , label : 'all groups' }
41
- ] ;
42
37
43
38
const dispatch = useDispatch ( ) ;
44
39
useEffect ( ( ) => {
45
40
dispatch ( fetchGradingOverviews ( ! showAllGroups ) ) ;
46
41
} , [ dispatch , role , showAllGroups ] ) ;
47
42
48
43
const [ showAllSubmissions , setShowAllSubmissions ] = useState ( false ) ;
49
- const showOptions = [
50
- { value : false , label : 'ungraded' } ,
51
- { value : true , label : 'all' }
52
- ] ;
53
44
54
45
// If submissionId or questionId is defined but not numeric, redirect back to the Grading overviews page
55
46
if (
@@ -88,63 +79,42 @@ const Grading: React.FC = () => {
88
79
gradingOverviews === undefined ? (
89
80
loadingDisplay
90
81
) : (
91
- < ColGrid numColsLg = { 8 } gapX = "gap-x-4" gapY = "gap-y-2" >
92
- < Col numColSpanLg = { 6 } >
93
- < Card >
94
- < Flex justifyContent = "justify-between" >
95
- < Flex justifyContent = "justify-start" spaceX = "space-x-6" >
96
- < Title > Submissions</ Title >
97
- < Button
98
- variant = "light"
99
- size = "xs"
100
- icon = { ( ) => (
101
- < BpIcon icon = { IconNames . EXPORT } style = { { marginRight : '0.5rem' } } />
102
- ) }
103
- onClick = { ( ) => exportGradingCSV ( gradingOverviews ) }
104
- >
105
- Export to CSV
106
- </ Button >
107
- </ Flex >
108
- </ Flex >
109
- < Flex justifyContent = "justify-start" marginTop = "mt-2" spaceX = "space-x-2" >
110
- < Text > Viewing</ Text >
111
- < SimpleDropdown
112
- options = { showOptions }
113
- selectedValue = { showAllSubmissions }
114
- onClick = { setShowAllSubmissions }
115
- popoverProps = { { position : Position . BOTTOM } }
116
- buttonProps = { { minimal : true , rightIcon : 'caret-down' } }
117
- />
118
- < Text > submissions from</ Text >
119
- < SimpleDropdown
120
- options = { groupOptions }
121
- selectedValue = { showAllGroups }
122
- onClick = { setShowAllGroups }
123
- popoverProps = { { position : Position . BOTTOM } }
124
- buttonProps = { { minimal : true , rightIcon : 'caret-down' } }
125
- />
126
- </ Flex >
127
- < GradingSubmissionsTable
128
- submissions = { submissions . filter (
129
- s => showAllSubmissions || isSubmissionUngraded ( s )
130
- ) }
131
- />
132
- </ Card >
133
- </ Col >
134
-
135
- < Col numColSpanLg = { 2 } >
136
- < Card hFull >
137
- < GradingSummary
138
- // Only include submissions from the same group in the summary
139
- submissions = { submissions . filter (
140
- ( { groupName, gradingStatus } ) =>
141
- groupName === group && gradingStatus !== GradingStatuses . excluded
142
- ) }
143
- assessments = { assessments }
144
- />
145
- </ Card >
146
- </ Col >
147
- </ ColGrid >
82
+ < Card >
83
+ < Flex justifyContent = "justify-between" >
84
+ < Flex justifyContent = "justify-start" spaceX = "space-x-6" >
85
+ < Title > Submissions</ Title >
86
+ < Button
87
+ variant = "light"
88
+ size = "xs"
89
+ icon = { ( ) => < BpIcon icon = { IconNames . EXPORT } style = { { marginRight : '0.5rem' } } /> }
90
+ onClick = { ( ) => exportGradingCSV ( gradingOverviews ) }
91
+ >
92
+ Export to CSV
93
+ </ Button >
94
+ </ Flex >
95
+ </ Flex >
96
+ < Flex justifyContent = "justify-start" marginTop = "mt-2" spaceX = "space-x-2" >
97
+ < Text > Viewing</ Text >
98
+ < SimpleDropdown
99
+ options = { showOptions }
100
+ selectedValue = { showAllSubmissions }
101
+ onClick = { setShowAllSubmissions }
102
+ popoverProps = { { position : Position . BOTTOM } }
103
+ buttonProps = { { minimal : true , rightIcon : 'caret-down' } }
104
+ />
105
+ < Text > submissions from</ Text >
106
+ < SimpleDropdown
107
+ options = { groupOptions }
108
+ selectedValue = { showAllGroups }
109
+ onClick = { setShowAllGroups }
110
+ popoverProps = { { position : Position . BOTTOM } }
111
+ buttonProps = { { minimal : true , rightIcon : 'caret-down' } }
112
+ />
113
+ </ Flex >
114
+ < GradingSubmissionsTable
115
+ submissions = { submissions . filter ( s => showAllSubmissions || isSubmissionUngraded ( s ) ) }
116
+ />
117
+ </ Card >
148
118
)
149
119
}
150
120
fullWidth = { true }
0 commit comments