diff --git a/client/src/App.tsx b/client/src/App.tsx index af8b57b..000d65a 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -47,9 +47,9 @@ function App() { {/* Events Route */} } /> + } path="view/:id" /> + } path="register/:id" /> - } path="event/:id" /> - } /> {/* Karang Guni Schedules Route */} diff --git a/client/src/pages/EventDetailsPage.tsx b/client/src/pages/EventDetailsPage.tsx index 527de11..f97f9d4 100644 --- a/client/src/pages/EventDetailsPage.tsx +++ b/client/src/pages/EventDetailsPage.tsx @@ -2,7 +2,13 @@ import { useState, useEffect } from "react"; import { useParams, useNavigate } from "react-router-dom"; import instance from "../security/http"; import config from "../config"; -import { Card, CardHeader, CardBody, Button, CardFooter } from "@nextui-org/react"; +import { + Card, + CardHeader, + CardBody, + Button, + CardFooter, +} from "@nextui-org/react"; import { ArrowUTurnLeftIcon } from "../icons"; // Make sure this path is correct const EventDetailsPage = () => { @@ -20,13 +26,17 @@ const EventDetailsPage = () => { setEvent(res.data); // Fetch all events to find similar ones - const allEventsRes = await instance.get(`${config.serverAddress}/events`); + const allEventsRes = await instance.get( + `${config.serverAddress}/events` + ); const allEvents = allEventsRes.data; // Find similar events based on location and category, excluding the current event - const similar = allEvents.filter((e: any) => - e.id !== Number(id) && // Make sure to exclude the current event - (e.location === res.data.location || e.category === res.data.category) + const similar = allEvents.filter( + (e: any) => + e.id !== Number(id) && // Make sure to exclude the current event + (e.location === res.data.location || + e.category === res.data.category) ); setSimilarEvents(similar); @@ -44,7 +54,7 @@ const EventDetailsPage = () => {
@@ -88,13 +98,18 @@ const EventDetailsPage = () => { {/* Similar Events Section */}
-

Similar Events You Might Be Interested In

+

+ Similar Events You Might Be Interested In +

{similarEvents.length === 0 ? (

No similar events available.

) : ( similarEvents.map((similarEvent: any) => ( - +

{similarEvent.title}

@@ -110,7 +125,7 @@ const EventDetailsPage = () => { diff --git a/client/src/pages/EventsPage.tsx b/client/src/pages/EventsPage.tsx index 33fb56f..19a224b 100644 --- a/client/src/pages/EventsPage.tsx +++ b/client/src/pages/EventsPage.tsx @@ -17,7 +17,7 @@ interface Event { title: string; category: string; location: string; - time: string; + time: string; description: string; imageUrl: string; } @@ -36,7 +36,9 @@ const EventsPage: React.FC = () => { useEffect(() => { const fetchEvents = async () => { try { - const res = await instance.get(`${config.serverAddress}/events`); + const res = await instance.get( + `${config.serverAddress}/events` + ); console.log("Fetched events data:", res.data); setEvents(res.data); setFilteredEvents(res.data); @@ -53,7 +55,9 @@ const EventsPage: React.FC = () => { const fetchTownCouncils = async () => { try { - const res = await axios.get(`${config.serverAddress}/users/town-councils-metadata`); + const res = await axios.get( + `${config.serverAddress}/users/town-councils-metadata` + ); setTownCouncils(JSON.parse(res.data).townCouncils); } catch (error) { console.error("Failed to fetch town councils:", error); @@ -67,8 +71,12 @@ const EventsPage: React.FC = () => { useEffect(() => { // Filter events based on selected criteria const filtered = events.filter((event) => { - const matchCategory = selectedCategory ? event.category === selectedCategory : true; - const matchTownCouncil = selectedTownCouncil ? event.location === selectedTownCouncil : true; + const matchCategory = selectedCategory + ? event.category === selectedCategory + : true; + const matchTownCouncil = selectedTownCouncil + ? event.location === selectedTownCouncil + : true; const matchTime = selectedTime ? event.time === selectedTime : true; return matchCategory && matchTownCouncil && matchTime; @@ -99,15 +107,15 @@ const EventsPage: React.FC = () => { {townCouncils.length > 0 && ( )} @@ -128,9 +136,7 @@ const EventsPage: React.FC = () => {

No events available.

) : ( filteredEvents.map((event) => ( - +

{event.title}

@@ -147,7 +153,7 @@ const EventsPage: React.FC = () => {

{event.description}