Skip to content

Commit fb58497

Browse files
removal is possible through the add modal if the user has been added manually
1 parent 56b9ef9 commit fb58497

File tree

1 file changed

+13
-15
lines changed
  • src/client/components/Courses/Course

1 file changed

+13
-15
lines changed

src/client/components/Courses/Course/index.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,9 @@ const Course = () => {
114114
refetchCourse()
115115
}
116116
}
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
127120
return (
128121
<>
129122
{!isResponsible ?
@@ -132,8 +125,13 @@ const Course = () => {
132125

133126
</Button>
134127
:
135-
<Typography>vastuussa</Typography>
136-
}
128+
<AssignedResponsibilityManagement
129+
handleRemove={() => {
130+
handleRemoveResponsibility(usersResponsibility)
131+
}}
132+
responsibility={usersResponsibility}
133+
/>
134+
}
137135
</>
138136
)
139137
}
@@ -269,8 +267,8 @@ const Course = () => {
269267
>
270268
<Box
271269
sx={{
272-
width: '80vw',
273-
height: '80vh',
270+
width: '90vw',
271+
height: '90vh',
274272
background: 'white',
275273
padding: '2rem',
276274
overflowY: 'scroll',
@@ -309,7 +307,7 @@ const Course = () => {
309307
const AssignedResponsibilityManagement = ({ responsibility, handleRemove }) => {
310308
const { t } = useTranslation()
311309
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>
313311
}
314312
return (
315313
<Stack direction={'row'} sx={{ marginLeft: 'auto', alignItems: 'center', height: '1rem' }}>

0 commit comments

Comments
 (0)