useModeration
Introduction
The useModeration
hook provides community managers (CMs) with essential functionalities to moderate posts, manage reports, and handle member rights efficiently. It simplifies the approval and rejection workflows, making it easier to build a custom UI for moderation.
Hook Properties
Property | Type | Description |
---|---|---|
selectedTab | string | Currently selected moderation tab. |
selectTab | (tab: string) => void | Function to change the selected tab. |
isPostApprovalEnabled | boolean | Indicates if post approval is enabled. |
reports | GroupReport[] | List of reported posts. |
posts | Record<string, Post> | Collection of posts. |
comments | Record<string, Comment> | Collection of comments. |
users | Record<string, User> | Collection of users. |
widgets | Record<string, Widget> | Collection of widgets. |
topics | Record<string, Topic> | Collection of topics. |
handleOnApprovedPostClicked | (reportIds: number[]) => Promise<void> | Function to approve posts. |
handleOnRejectedPostClicked | (reportIds: number[]) => Promise<void> | Function to reject posts. |
onApprovedCallback | (groupReport: GroupReport) => Promise<void> | Callback triggered after a post is approved. |
onRejectedCallback | (groupReport: GroupReport, postId: string) => Promise<void> | Callback triggered after a post is rejected. |
editMemberPermissionsHandler | (uuid: string) => Promise<void> | Function to edit member permissions. |
updateMemberRightsHandler | () => Promise<void> | Function to update member rights. |
handleHeaderLeadingTap | () => void | Function triggered on leading header tap. |
handleHeaderTextTap | () => void | Function triggered on header text tap. |
handleHeaderTrailingTap | () => void | Function triggered on trailing header tap. |
memberRights | MemberRights[] | List of member rights. |
isEditPermissionDialogOpen | boolean | Indicates if the edit permission dialog is open. |
setIsEditPermissionDialogOpen | React.Dispatch<React.SetStateAction<boolean>> | Function to toggle the edit permission dialog. |
modifiedRights | MemberRights[] | List of modified rights. |
setModifiedRights | React.Dispatch<React.SetStateAction<MemberRights[] >> | Function to set modified rights. |
customTitle | string | Custom title for the moderation section. |
setCustomTitle | React.Dispatch<React.SetStateAction<string>> | Function to set the custom title. |
currentReport | GroupReport | null | Currently selected report. |
setCurrentReport | React.Dispatch<React.SetStateAction<GroupReport | null>> | Function to set the current report. |
loadMoreFeeds | boolean | Indicates if more feeds should be loaded. |
getNextPage | () => void | Function to fetch the next page of moderation data. |
isLoading | boolean | Indicates if data is currently being loaded. |
Example
For an example implementation, check out this reference.