diff --git a/client/src/pages/AdminPages/Community/CommunityAdmin.jsx b/client/src/pages/AdminPages/Community/CommunityAdmin.jsx
new file mode 100644
index 0000000..fa00ee3
--- /dev/null
+++ b/client/src/pages/AdminPages/Community/CommunityAdmin.jsx
@@ -0,0 +1,138 @@
+// import CheckReport from "../../../components/CheckReport/CheckReport";
+import { useState, useEffect } from "react";
+import { toast } from "react-toastify";
+import { getCommunitys } from "../../../Services/communityService";
+import { UnblockCommunitys } from "../../../Services/communityService";
+import { blockCommunitys } from "../../../Services/communityService";
+
+function Community() {
+ const [community, setCommunity] = useState([]);
+ // const [openModal, setOpenModal] = useState(false);
+ // const [communityReport, setCommunityReport] = useState([]);
+
+ // const handleModal = (communityId) => {
+ // const community = community.find((community) => {
+ // return community._id === communityId;
+ // });
+ // setCommunityReport(community.reports);
+ // setOpenModal(true);
+ // };
+ useEffect(() => {
+ const fetchCommunities = async () => {
+ const response = await getCommunitys();
+ if (response.success === true) {
+ setCommunity(response?.community);
+ }
+ };
+ fetchCommunities();
+ }, [setCommunity]);
+
+ const handleBlock = async (communityId) => {
+ const response = await blockCommunitys(communityId);
+ if (response?.success === true) {
+ const updatedCommunity = community.map((community) => {
+ if (community?._id === communityId) {
+ return { ...community, is_blocked: true };
+ }
+ return community;
+ });
+ setCommunity(updatedCommunity);
+ toast(response?.message);
+ }
+ };
+ const handleUnBlock = async (communityId) => {
+ const response = await UnblockCommunitys(communityId);
+ if (response?.success === true) {
+ const updatedCommunity = community.map((community) => {
+ if (community._id === communityId) {
+ return { ...community, is_blocked: false };
+ }
+ return community;
+ });
+ setCommunity(updatedCommunity);
+ toast(response?.message);
+ }
+ };
+ return (
+ <>
+ {/*
+ No + | ++ Name + | ++ Reports + | ++ View Reports + | ++ Block/Unblock + | +
---|---|---|---|---|
+ {index + 1} + | +{community?.email} | ++ {community?.community_name} + | ++ + | ++ {community?.is_blocked ? ( + + ) : ( + + )} + | +