diff --git a/component/admin/AdminEventList.jsx b/component/admin/AdminEventList.jsx index 8ecb8637..5fcc91a0 100644 --- a/component/admin/AdminEventList.jsx +++ b/component/admin/AdminEventList.jsx @@ -17,6 +17,21 @@ function AdminEventList({ events, refresh }) { notify(err?.response?.data?.message ?? err?.message, "error"); } } + + async function adminEventCheck(eventId, type) { + const updatedStatus = { + status: type + }; + try { + const resp = await EventService.adminReviewEvent(eventId, updatedStatus); + if (resp) { + refresh(); + } + } catch (error) { + notify(error?.response?.data?.message ?? error?.message, "error"); + } + } + const editevent = (id) => { router.push({ pathname: "events/create-event", @@ -49,23 +64,82 @@ function AdminEventList({ events, refresh }) {
+
+ <> +
+ + + {obj.status === "published" ? "View" : "Preview"} + + +
+
+ + + {obj.status == "published" ? (
- <> -
- + + Published + +
+ ) : obj.status == "rejected" ? ( +
+ + Rejected + +
+ ) : ( +
+
adminEventCheck(obj.id, "rejected")} + className={`flex items-center w-28 justify-center rounded-full h-8 mr-3 cursor-pointer hover:opacity-50 duration-500 + ${MyBlogStyles.dangerBg}`} + > - {obj.status === "published" ? "View" : "Preview"} + Reject - +
+
adminEventCheck(obj.id, "published")} + className={`flex items-center w-28 justify-center rounded-full h-8 mr-3 cursor-pointer hover:opacity-50 duration-500 ${MyBlogStyles.successBg} `} + > + + Publish + +
- - + )} + {obj.status == "published" && ( +
adminEventCheck(obj.id, "pending")} + className={`flex items-center w-28 justify-center rounded-full h-8 mr-3 cursor-pointer hover:opacity-50 duration-500 ${MyBlogStyles.warningBg} `} + > + + Unpublish + +
+ )} {/* {obj.status === "published" && (
)} - {event ? ( - "" - ) : ( + { +
110 of 276
+
+ + img + + + img + + + + +
*/} + + +
+
+ ); } diff --git a/component/leadership/tabs.module.scss b/component/leadership/tabs.module.scss new file mode 100644 index 00000000..62002685 --- /dev/null +++ b/component/leadership/tabs.module.scss @@ -0,0 +1,27 @@ +.table { + @apply w-full border-collapse; + font-family: "Open Sans"; +} +.t_row { + th { + @apply px-6 py-3 text-base text-left font-semibold; + color: #1b1b1b; + } +} +.t_body { + @apply px-6 text-left text-base font-bold border; + height: 0px; + td { + @apply px-6 text-left py-3 text-base font-bold; + align-items: center; + } +} +.uimage { + @apply mr-9 ml-8; +} +.duckbg { + background: linear-gradient(64.8deg, #ff6666 37.25%, #e62e6b 113.5%); + width: 26px; + height: 26px; + @apply rounded-full flex justify-center items-center; +} diff --git a/component/pagination/paginationLeaderBoard.jsx b/component/pagination/paginationLeaderBoard.jsx new file mode 100644 index 00000000..8ef26ac7 --- /dev/null +++ b/component/pagination/paginationLeaderBoard.jsx @@ -0,0 +1,228 @@ +import { useEffect, useState } from "react"; +import Styles from "./pagination.module.scss"; + +export default function paginationLeaderBoard({ TotalCount, changePage, pageNum, limit }) { + // pagenum is coming as string, so converting to number + pageNum = +pageNum + const [TotalPages, setTotalPages] = useState(); + const [FirstThree, setFirstThree] = useState([]); + const [LastThree, setLastThree] = useState([]); + const [pageNo, setpageNo] = useState(pageNum); + const [middle, setmiddle] = useState(false); + const [valuePage, setvaluePage] = useState(""); + + // console.log("outside", pageNo); + useEffect(() => { + setTotalPages(Math.ceil(TotalCount / limit)); + // console.log({ pageNum }); + setpageNo(pageNum); + }, [TotalCount]); + useEffect(() => { + if (TotalPages >= 6) { + setFirstThree([1, 2, 3, 4, 5]); + setLastThree([TotalPages]); + } + if (TotalPages <= 5) { + let temp = []; + for (let step = 0; step < TotalPages; step++) { + temp.push(step + 1); + } + setFirstThree(temp); + } + }, [TotalPages]); + + useEffect(() => { + if (pageNo > 5 && pageNo < TotalPages) { + setmiddle(true); + } else if (pageNo >= TotalPages || pageNo <= 5) { + setmiddle(false); + } + // console.log("changepage"); + changePage(pageNo); + }, [pageNo]); + + // console.log(pageNo); + const nextBut = () => { + if (pageNo !== TotalPages) { + setpageNo(pageNo + 1); + console.log(pageNo); + } + }; + const prevBut = () => { + if (pageNo !== 1) { + setpageNo(pageNo - 1); + console.log(pageNo); + } + }; + return ( + <> + {TotalCount > 0 && ( +
+
+
+
{ + prevBut(); + setvaluePage(""); + }} + > + + + +
+
+
+ {middle && ( + <> + {pageNo - 1 > 1 && ( +
+ ... +
+ )} + {pageNo - 1 > 1 && ( + + )} + + {pageNo + 1 < TotalPages && ( + + )} + {pageNo + 1 < TotalPages && ( +
+ ... +
+ )} + + )} + {LastThree[0] && ( + + )} +
+ {pageNo} +
+
+
+
{ + nextBut(); + setvaluePage(""); + }} + > + + + +
+
+
+
+

+ Go to page : +

+ { + const valueX = e?.target?.value?.match(/[0-9]*/g).join(""); + if (valueX <= TotalPages) { + if (valueX > 0) { + setvaluePage(valueX); + } else { + setvaluePage(""); + } + } + }} + /> + +
+
+ )} + + ); +} diff --git a/component/profile/Activity.jsx b/component/profile/Activity.jsx index 6c2ff9c6..997c6180 100644 --- a/component/profile/Activity.jsx +++ b/component/profile/Activity.jsx @@ -1,18 +1,58 @@ -import React from "react"; +import React, { useState } from "react"; import CalendarHeatmap from "react-calendar-heatmap"; import "react-calendar-heatmap/dist/styles.css"; import Profilestyles from "../../styles/Profile.module.css"; import Select from "react-select"; +import ActivityService from "../../services/ActivityService"; +import axios from "axios"; // import styles from './blogs.module.scss' -export default function Activity() { +function getYearAgo(getTodayDate) { + var lastYear = new Date(); + var dd = lastYear.getDate(); + var mm = lastYear.getMonth() + 1; //January is not 0! + var yyyy = lastYear.getFullYear(getTodayDate) - 1; + if (dd < 10) { + dd = "0" + dd; + } + if (mm < 10) { + mm = "0" + mm; + } + lastYear = yyyy + "-" + mm + "-" + dd; + return lastYear; +} +export default function Activity({ userId }) { const optionsCategory = [ - { label: "2021", value: "2021" }, - { label: "2020", value: "2020" }, - { label: "2019", value: "2019" }, + { label: new Date().getFullYear(), value: new Date().getFullYear() }, + { + label: new Date().getFullYear() - 1, + value: new Date().getFullYear() - 1 + }, + { label: new Date().getFullYear() - 2, value: new Date().getFullYear() - 2 } ]; + const [selectedYear, setSelectedYear] = React.useState(null); + const [values, setValues] = useState(null); + + React.useEffect(() => { + (async () => { + const { data } = await ActivityService.getYearlyActivity( + userId, + selectedYear + ); + if (data) { + setValues( + data.map((each) => ({ ...each, date: each.date.split("T")[0] })) + ); + } + })(); + }, [selectedYear]); + + const handleChange = (item) => { + setSelectedYear(item.value); + }; + return (
@@ -22,41 +62,30 @@ export default function Activity() {
*/}