-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #887 from bounswe/frontend-group-moderation
Frontend group moderation
- Loading branch information
Showing
5 changed files
with
149 additions
and
8 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
app/frontend/src/Components/MemberList/MemberList.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import "../../colors"; | ||
|
||
.username { | ||
color: $orange; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Button, List, Select } from "antd"; | ||
import styles from "./MemberList.module.scss"; | ||
import { useMutation } from "react-query"; | ||
import { banUserFromGroup } from "../../Services/group"; | ||
interface MemberListData { | ||
id: string; | ||
username: string; | ||
photoUrl: string; | ||
} | ||
|
||
function MemberList({ | ||
data, | ||
groupId, | ||
}: { | ||
data: MemberListData[]; | ||
groupId: string; | ||
}) { | ||
const banUserMutation = useMutation(banUserFromGroup, { | ||
onSuccess: async () => { | ||
alert(`You successfully banned the user`); | ||
}, | ||
onError: () => { | ||
alert("Something went wrong"); | ||
}, | ||
}); | ||
|
||
const handleClick = (userId: string) => { | ||
banUserMutation.mutate({ groupId, userId }); | ||
}; | ||
return ( | ||
<List | ||
dataSource={data} | ||
renderItem={(item: MemberListData) => ( | ||
<List.Item key={item.id}> | ||
<List.Item.Meta | ||
//avatar={<Avatar src={item.photoUrl} />} | ||
title={<p className={styles.username}>{item.username}</p>} | ||
/> | ||
<Button type="primary" danger onClick={() => handleClick(item.id)}> | ||
Ban | ||
</Button> | ||
</List.Item> | ||
)} | ||
/> | ||
); | ||
} | ||
|
||
export default MemberList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters