From ae8b8f491de76a5634fcf1f18db8968de2f397a9 Mon Sep 17 00:00:00 2001 From: Aswanth Vc Date: Fri, 8 Dec 2023 01:47:08 +0530 Subject: [PATCH] fix : events page update and event list limit --- src/apis/eventApi.tsx | 7 +++++-- src/components/eventlist/EventList.tsx | 8 +++++--- src/pages/events/Events.module.css | 20 ++++++++++++++++++-- src/pages/events/Events.tsx | 10 ++++++++++ src/pages/home/Home.tsx | 2 +- 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/apis/eventApi.tsx b/src/apis/eventApi.tsx index b5de5515..511fcfc7 100644 --- a/src/apis/eventApi.tsx +++ b/src/apis/eventApi.tsx @@ -77,13 +77,16 @@ export const getEvents = async ( status: boolean, message: string | null, hideAfter: number | null - ) => void + ) => void, + limit: number | null | undefined = -1 ): Promise | null> => { setToast(false, null, null); if (eventId) { var res = publicRouter.get("/api/v2/events/get?id=" + eventId); } else { - var res = publicRouter.get("/api/v2/events/getAll"); + var res = publicRouter.get( + "/api/v2/events/getAll" + (limit ? "?count=" + limit : "") + ); } addLoader(res); var val = await validateResponse(res); diff --git a/src/components/eventlist/EventList.tsx b/src/components/eventlist/EventList.tsx index 714046c4..6c383825 100644 --- a/src/components/eventlist/EventList.tsx +++ b/src/components/eventlist/EventList.tsx @@ -5,14 +5,16 @@ import { getEvents } from "../../apis/eventApi"; import { _Event } from "../../utils/types"; import { useLoader } from "../toploader/useLoader"; import { useToast } from "../toast/useToast"; -interface EventListProps {} +interface EventListProps { + limit?: number; +} -const EventList: React.FC = ({}) => { +const EventList: React.FC = ({ limit = undefined }) => { var { addLoader } = useLoader(); var { setToastStatus } = useToast(); const [events, setEvents] = useState>([]); useEffect(() => { - getEvents(null, addLoader, setToastStatus).then((e) => { + getEvents(null, addLoader, setToastStatus, limit).then((e) => { if (e) setEvents(e); else console.log("error : no event data got"); }); diff --git a/src/pages/events/Events.module.css b/src/pages/events/Events.module.css index ddfe8306..f5d80e59 100644 --- a/src/pages/events/Events.module.css +++ b/src/pages/events/Events.module.css @@ -3,11 +3,27 @@ padding: 10px; .page { - width: calc(100% - 100px); - padding: 50px; + width: calc(100% - 30px); + padding: 15px; & h2 { margin-bottom: 20px; width: 100px; } + + .intro { + display: block; + font-size: 15px; + color: var(--color-white-shade); + padding-bottom: 20px; + } + } +} + +@media screen and (min-width: 768px) { + .events { + .page { + width: calc(100% - 200px); + padding: 50px 100px; + } } } diff --git a/src/pages/events/Events.tsx b/src/pages/events/Events.tsx index 4ca3528d..557af1e6 100644 --- a/src/pages/events/Events.tsx +++ b/src/pages/events/Events.tsx @@ -11,6 +11,16 @@ const Events: React.FC = ({}) => {

Events


+ + Explore the dynamic world of innovation and knowledge at our college's + technical fest. Dive into a diverse range of intellectually + stimulating events designed to challenge, inspire, and showcase the + brilliance of our student community. From coding competitions to + robotics challenges, our events page is a gateway to a thrilling + journey of creativity and skill. + +
+