1
1
import React from 'react' ;
2
- import { IconButton , Tooltip } from '@mui/material' ;
2
+ import {
3
+ IconButton ,
4
+ ToggleButton ,
5
+ ToggleButtonGroup ,
6
+ Tooltip ,
7
+ } from '@mui/material' ;
3
8
import { Stack } from '@mui/system' ;
4
9
import ScheduleIcon from '@mui/icons-material/Schedule' ;
5
10
import EditOutlinedIcon from '@mui/icons-material/EditOutlined' ;
6
11
import EventBusyOutlinedIcon from '@mui/icons-material/EventBusyOutlined' ;
7
12
import KeyboardDoubleArrowDownOutlinedIcon from '@mui/icons-material/KeyboardDoubleArrowDownOutlined' ;
8
13
import DeleteOutlinedIcon from '@mui/icons-material/DeleteOutlined' ;
9
14
import { curationPalette } from '../../../theme' ;
15
+ import {
16
+ ActionScreen ,
17
+ ApprovedCorpusItem ,
18
+ ApprovedItemGrade ,
19
+ } from '../../../api/generatedTypes' ;
10
20
11
21
interface CardActionButtonRowProps {
12
22
/**
@@ -33,6 +43,20 @@ interface CardActionButtonRowProps {
33
43
* Callback for the "Reject" (trash) button
34
44
*/
35
45
onReject : VoidFunction ;
46
+
47
+ /**
48
+ * Callback for clicking a grade button
49
+ */
50
+ onGrade : (
51
+ item : ApprovedCorpusItem ,
52
+ grade : ApprovedItemGrade ,
53
+ actionScreen : ActionScreen ,
54
+ ) => void ;
55
+
56
+ /**
57
+ * The approved corpus item being graded
58
+ */
59
+ item : ApprovedCorpusItem ;
36
60
}
37
61
38
62
export const CardActionButtonRow : React . FC < CardActionButtonRowProps > = (
@@ -91,6 +115,26 @@ export const CardActionButtonRow: React.FC<CardActionButtonRowProps> = (
91
115
</ Tooltip >
92
116
</ Stack >
93
117
118
+ < Stack direction = "row" justifyContent = "flex-start" >
119
+ < ToggleButtonGroup
120
+ size = "small"
121
+ color = "primary"
122
+ onChange = { ( event : React . MouseEvent , value : any ) => {
123
+ props . onGrade ( props . item , value [ 0 ] , ActionScreen . Schedule ) ;
124
+ } }
125
+ >
126
+ { Object . values ( ApprovedItemGrade ) . map ( ( grade ) => (
127
+ < ToggleButton
128
+ key = { grade }
129
+ value = { grade }
130
+ selected = { grade === props . item . grade }
131
+ >
132
+ { grade }
133
+ </ ToggleButton >
134
+ ) ) }
135
+ </ ToggleButtonGroup >
136
+ </ Stack >
137
+
94
138
< Stack direction = "row" justifyContent = "flex-start" >
95
139
< Tooltip title = "Unschedule" placement = "bottom" >
96
140
< IconButton
0 commit comments