Skip to content

Commit 56b9ef9

Browse files
already responsible users wont have an add button
1 parent 4801cb4 commit 56b9ef9

File tree

1 file changed

+16
-0
lines changed
  • src/client/components/Courses/Course

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,27 @@ 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+
117125
const drawActionComponent = (user: User) => {
126+
const isResponsible = isAlreadyAssigned(user)
118127
return (
128+
<>
129+
{!isResponsible ?
119130
<Button onClick={() => handleAddResponsible(user)}>
120131
{t('course:add')}
132+
121133
</Button>
134+
:
135+
<Typography>vastuussa</Typography>
136+
}
137+
</>
122138
)
123139
}
124140
const handleRemoveResponsibility = async (responsibility) => {

0 commit comments

Comments
 (0)