@@ -16,26 +16,32 @@ import Select, { SelectChangeEvent } from '@mui/material/Select';
16
16
import { Stack } from './stack' ;
17
17
import { useTranslator } from '../hooks' ;
18
18
19
- type INotificationsSettingsProps = {
19
+ type NotificationsSettingsProps = {
20
20
notificationEvents : string [ ] ;
21
21
id : string ;
22
22
model : ICreateJobModel ;
23
23
handleModelChange : ( model : ICreateJobModel ) => void ;
24
24
} ;
25
25
26
- type NotificationEventsSelect = {
26
+ type NotificationEventsSelectProps = {
27
27
id : string ;
28
28
availableEvents : string [ ] ;
29
29
selectChange : ( e : SelectChangeEvent < string > ) => void ;
30
30
disabled : boolean ;
31
31
} ;
32
32
33
+ type SelectedEventsChipsProps = {
34
+ selectedEvents : string [ ] ;
35
+ deleteSelectedEvent : ( eventToDelete : string ) => ( ) => void ;
36
+ disabled : boolean ;
37
+ } ;
38
+
33
39
export function NotificationsSettings ( {
34
40
notificationEvents,
35
41
id,
36
42
model,
37
43
handleModelChange : modelChange
38
- } : INotificationsSettingsProps ) : JSX . Element | null {
44
+ } : NotificationsSettingsProps ) : JSX . Element | null {
39
45
const trans = useTranslator ( 'jupyterlab' ) ;
40
46
const [ selectedEvents , setSelectedEvents ] = useState < string [ ] > (
41
47
model . notificationsSettings ?. selectedEvents || [ ]
@@ -188,7 +194,7 @@ export function NotificationsSettings({
188
194
) ;
189
195
}
190
196
191
- function NotificationEventsSelect ( props : NotificationEventsSelect ) {
197
+ function NotificationEventsSelect ( props : NotificationEventsSelectProps ) {
192
198
const trans = useTranslator ( 'jupyterlab' ) ;
193
199
const label = trans . __ ( 'Notification Events' ) ;
194
200
const labelId = `${ props . id } -label` ;
@@ -215,20 +221,18 @@ function NotificationEventsSelect(props: NotificationEventsSelect) {
215
221
) ;
216
222
}
217
223
218
- const SelectedEventsChips : React . FC < {
219
- selectedEvents : string [ ] ;
220
- deleteSelectedEvent : ( eventToDelete : string ) => ( ) => void ;
221
- disabled : boolean ;
222
- } > = ( { selectedEvents, deleteSelectedEvent, disabled } ) => (
223
- < Cluster gap = { 3 } justifyContent = "flex-start" >
224
- { selectedEvents . map ( e => (
225
- < Chip
226
- key = { e }
227
- label = { e }
228
- variant = "outlined"
229
- onDelete = { deleteSelectedEvent ( e ) }
230
- disabled = { disabled }
231
- />
232
- ) ) }
233
- </ Cluster >
234
- ) ;
224
+ function SelectedEventsChips ( props : SelectedEventsChipsProps ) {
225
+ return (
226
+ < Cluster gap = { 3 } justifyContent = "flex-start" >
227
+ { props . selectedEvents . map ( e => (
228
+ < Chip
229
+ key = { e }
230
+ label = { e }
231
+ variant = "outlined"
232
+ onDelete = { props . deleteSelectedEvent ( e ) }
233
+ disabled = { props . disabled }
234
+ />
235
+ ) ) }
236
+ </ Cluster >
237
+ ) ;
238
+ }
0 commit comments