@@ -114,16 +114,9 @@ const Course = () => {
114
114
refetchCourse ( )
115
115
}
116
116
}
117
- const isAlreadyAssigned = ( user : User ) => {
118
- const existsAlready : Responsebility | undefined = chatInstance . responsibilities . find ( ( r : Responsebility ) => { return r . user . id === user . id } )
119
- console . log ( chatInstance . responsibilities )
120
- console . log ( user )
121
- console . log ( existsAlready )
122
- return existsAlready != undefined
123
- }
124
-
125
- const drawActionComponent = ( user : User ) => {
126
- const isResponsible = isAlreadyAssigned ( user )
117
+ const drawActionComponent = ( user : User ) => {
118
+ const usersResponsibility : Responsebility | undefined = responsibilities . find ( ( r : Responsebility ) => { return r . user . id === user . id } )
119
+ const isResponsible = usersResponsibility != undefined
127
120
return (
128
121
< >
129
122
{ ! isResponsible ?
@@ -132,8 +125,13 @@ const Course = () => {
132
125
133
126
</ Button >
134
127
:
135
- < Typography > vastuussa</ Typography >
136
- }
128
+ < AssignedResponsibilityManagement
129
+ handleRemove = { ( ) => {
130
+ handleRemoveResponsibility ( usersResponsibility )
131
+ } }
132
+ responsibility = { usersResponsibility }
133
+ />
134
+ }
137
135
</ >
138
136
)
139
137
}
@@ -269,8 +267,8 @@ const Course = () => {
269
267
>
270
268
< Box
271
269
sx = { {
272
- width : '80vw ' ,
273
- height : '80vh ' ,
270
+ width : '90vw ' ,
271
+ height : '90vh ' ,
274
272
background : 'white' ,
275
273
padding : '2rem' ,
276
274
overflowY : 'scroll' ,
@@ -309,7 +307,7 @@ const Course = () => {
309
307
const AssignedResponsibilityManagement = ( { responsibility, handleRemove } ) => {
310
308
const { t } = useTranslation ( )
311
309
if ( ! responsibility . createdByUserId ) {
312
- return < Stack direction = { 'row' } sx = { { marginLeft : 'auto' , alignItems : 'center' , height : '1rem' } } > </ Stack >
310
+ return < Stack direction = { 'row' } sx = { { marginLeft : 'auto' , alignItems : 'center' , height : '1rem' } } > sisu </ Stack >
313
311
}
314
312
return (
315
313
< Stack direction = { 'row' } sx = { { marginLeft : 'auto' , alignItems : 'center' , height : '1rem' } } >
0 commit comments