diff --git a/web/src/App.tsx b/web/src/App.tsx index 6a3fce8..917d7ad 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,42 +1,38 @@ -import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { createBrowserRouter, RouterProvider } from 'react-router-dom'; -import { useState } from 'react'; -import MainMenu from '@pages/MainMenu'; -import NotFound from '@pages/NotFound'; -import TestingComponent from '@components/TestComponent'; -// import Signup from '@pages/Signup'; -// import SignupAdditional from '@pages/SignupAdditional'; -// import SignupEmergency from '@pages/SignupEmergency'; -import SignUpPage from '@pages/SignUpPage'; -import RegisterModalErrorContextProvider from './context/RegisterModalErrorContextProvider'; -import RegisterErrorModal from '@components/register/RegisterErrorModal'; -import Dashboard from '@pages/Dashboard'; - +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { createBrowserRouter, RouterProvider } from "react-router-dom"; +import { useState } from "react"; +import MainMenu from "@pages/MainMenu"; +import NotFound from "@pages/NotFound"; +import TestingComponent from "@components/TestComponent"; +import SignUpPage from "@pages/SignUpPage"; +import RegisterModalErrorContextProvider from "./context/RegisterModalErrorContextProvider"; +import RegisterErrorModal from "@components/register/RegisterErrorModal"; +import Dashboard from "@pages/Dashboard"; const router = createBrowserRouter([ { - path: '/', + path: "/", element: , }, { - path: '*', + path: "*", element: , }, { - path: 'register', + path: "register", element: ( - + - ), + ), }, { - path: '/testing', + path: "/testing", element: , }, { - path: '/dashboard', // can probably change this to /dashboard/community or something idk, im not sure how we are handling changing tabs within the dashboard + path: "/dashboard", // can probably change this to /dashboard/community or something idk, im not sure how we are handling changing tabs within the dashboard element: , }, ]); diff --git a/web/src/components/Dashboard/DashboardCommunity/CommunityGallery.tsx b/web/src/components/Dashboard/DashboardCommunity/CommunityGallery.tsx index 70ac3f9..8aa29fd 100644 --- a/web/src/components/Dashboard/DashboardCommunity/CommunityGallery.tsx +++ b/web/src/components/Dashboard/DashboardCommunity/CommunityGallery.tsx @@ -1,61 +1,84 @@ -import axios from 'axios'; -import { useState, useEffect } from 'react'; -import CommunityGalleryCard from '../dashboardCommunity/CommunityGalleryCard'; +import axios from "axios"; +import { useState, useEffect } from "react"; +import CommunityGalleryCard from "../dashboardCommunity/CommunityGalleryCard"; interface GalleryData { title: string; image: string; } -const CommunityGallery = ({event, location}: {event: string, location: string}) => { - -// TEMPORARY DATA, we should be getting the profile data from somewhere -const name = 'John Doe'; -const hours = '14'; - const [data, setData] = useState([ +const CommunityGallery = ({ + event, + location, +}: { + event: string; + location: string; +}) => { + // TEMPORARY DATA, we should be getting the profile data from somewhere + const name = "John Doe"; + const hours = "14"; + const [data, setData] = useState([ { - title: "Relay For Life", - image: "/assets/EventHighlights/Events/RelayForLife/imgB.png" + title: "Relay For Life", + image: "/assets/EventHighlights/Events/RelayForLife/imgB.png", }, { - title:"Volunteers Day", - image: "/assets/EventHighlights/Events/VolunteersDay/imgB.png" + title: "Volunteers Day", + image: "/assets/EventHighlights/Events/VolunteersDay/imgB.png", }, { - title:"Blind Low Vision", - image: "/assets/EventHighlights/Events/BlindLowVision/imgB.png" + title: "Blind Low Vision", + image: "/assets/EventHighlights/Events/BlindLowVision/imgB.png", }, { title: "Pub Quiz", - image: "/assets/EventHighlights/Events/PubQuiz/imgB.png" - } - ]); + image: "/assets/EventHighlights/Events/PubQuiz/imgB.png", + }, + ]); - useEffect(() => { + // TODO: replace this axios call with a utility function within utils/---.ts + useEffect(() => { // Fetch gallery data - axios.get('http://localhost:3000/api/homepage/gallery') + axios + .get("http://localhost:3000/api/homepage/gallery") .then((res) => { setData(res.data); }) .catch((err) => { console.log(err); }); - } - , []); + }, []); - - return ( -
-

People you may know from {event} at {location}

-
- {/* hardcoded 4 people, this shoulded be mapped with however many people in the event?? */} - - - - -
-
- ); -} - -export default CommunityGallery; \ No newline at end of file + return ( +
+

+ People you may know from {event} at {location} +

+
+ {/* hardcoded 4 people, this shoulded be mapped with however many people in the event?? */} + + + + +
+
+ ); +}; + +export default CommunityGallery; diff --git a/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryCard.tsx b/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryCard.tsx index 947be2a..eb10f55 100644 --- a/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryCard.tsx +++ b/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryCard.tsx @@ -6,43 +6,59 @@ interface CommunityGalleryCardProps { profileImgLink: string; } -const CommunityGalleryCard = ({name, hours, profileImgLink}: CommunityGalleryCardProps) => { - - const handleAddFriend = () => { - console.log('add friend'); - }; - - return ( -
-
-
- -
- -
- -
-

{name}

-

{hours}

-

hours

- -
-
- -
- {/* THIS DOES NOT HANDLE MUTUALS, IDK HOW WE ARE GONNA DO THAT SO I HAVENT MADE PROPS FOR THE BELOW STUFF */} -

jaquallelina and 12 other mutual friends

-
- - -
+const CommunityGalleryCard = ({ + name, + hours, + profileImgLink, +}: CommunityGalleryCardProps) => { + const handleAddFriend = () => { + console.log("add friend"); + }; + + return ( +
+
+ +
+ +
+ +
+

+ {name} +

+

{hours}

+

hours

+ +
+
+ +
+ {/* THIS DOES NOT HANDLE MUTUALS, IDK HOW WE ARE GONNA DO THAT SO I HAVENT MADE PROPS FOR THE BELOW STUFF */} +

+ jaquallelina and 12 other mutual friends +

- ); -} - -export default CommunityGalleryCard; \ No newline at end of file + + +
+
+ ); +}; + +export default CommunityGalleryCard; diff --git a/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryWhole.tsx b/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryWhole.tsx index d88ffd4..fe91864 100644 --- a/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryWhole.tsx +++ b/web/src/components/Dashboard/DashboardCommunity/CommunityGalleryWhole.tsx @@ -1,6 +1,6 @@ /* * So like the purpose of this file is to have a container for every event, then for every event it will have x amount of profile cards shown -*/ + */ import axios from "axios"; import { useState, useEffect } from "react"; @@ -12,49 +12,50 @@ interface EventData { } const CommunityGalleryWhole = () => { - // TEMPORARY DATA passing down events into community gallery vvvvvvvvvvvvvvvvvvvvvvvvvvvvv - const [data, setData] = useState([ + // TEMPORARY DATA passing down events into community gallery vvvvvvvvvvvvvvvvvvvvvvvvvvvvv + const [data, setData] = useState([ { - title: "Quiz Night", - location: "Uni" + title: "Quiz Night", + location: "Uni", }, { - title:"Launch Night", - location: "Somewhere" + title: "Launch Night", + location: "Somewhere", }, { - title:"C", - location: "Somewhere" + title: "C", + location: "Somewhere", }, { title: "Beach Cleanup", - location: "Beach" - } - ]); + location: "Beach", + }, + ]); + // TODO: replace this axios call with a utility function within utils/---.ts useEffect(() => { // Fetch gallery data - axios.get('http://localhost:3000/api/homepage/highlights') + axios + .get("http://localhost:3000/api/homepage/highlights") .then((res) => { setData(res.data); }) .catch((err) => { console.log(err); }); - } - , []); -// TEMPORARY ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + }, []); + // TEMPORARY ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - return ( -
- {/* passing event data into community gallery*/} - {data.map(( event ) => ( -
- -
- ))} + return ( +
+ {/* passing event data into community gallery*/} + {data.map((event) => ( +
+
- ); -} - -export default CommunityGalleryWhole; \ No newline at end of file + ))} +
+ ); +}; + +export default CommunityGalleryWhole; diff --git a/web/src/components/Dashboard/DashboardCommunity/SearchBar.tsx b/web/src/components/Dashboard/DashboardCommunity/SearchBar.tsx index d8ded1f..85fcdf3 100644 --- a/web/src/components/Dashboard/DashboardCommunity/SearchBar.tsx +++ b/web/src/components/Dashboard/DashboardCommunity/SearchBar.tsx @@ -1,12 +1,14 @@ -import React, { useState } from 'react'; -import { FiSearch } from 'react-icons/fi'; // magnifying glass icon +import React, { useState } from "react"; +import { FiSearch } from "react-icons/fi"; // magnifying glass icon interface SearchBarProps { placeholder?: string; // Optional placeholder for the search input } -const SearchBar: React.FC = ({ placeholder = "Search by name" }) => { - const [searchTerm, setSearchTerm] = useState(''); +const SearchBar: React.FC = ({ + placeholder = "Search by name", +}) => { + const [searchTerm, setSearchTerm] = useState(""); const handleInputChange = (event: React.ChangeEvent) => { const value = event.target.value; @@ -16,7 +18,8 @@ const SearchBar: React.FC = ({ placeholder = "Search by name" }) return (
- {/* Magnifying glass icon */} + {" "} + {/* Magnifying glass icon */} (null); + const [eventDetails, setEventDetails] = useState(null); const [events, setEvents] = useState([]); const [flagshipEvent, setFlagshipEvent] = useState({ event_title: "", @@ -33,50 +33,65 @@ function DashboardDiscover() { location: "", image: "", host: "", - coordinates: {longitude: "", latitude: ""} + coordinates: { longitude: "", latitude: "" }, }); - const days = ["SUN","MON","TUES","WED","THURS","FRI","SAT"]; - const months = ["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"]; + const days = ["SUN", "MON", "TUES", "WED", "THURS", "FRI", "SAT"]; + const months = [ + "JANUARY", + "FEBRUARY", + "MARCH", + "APRIL", + "MAY", + "JUNE", + "JULY", + "AUGUST", + "SEPTEMBER", + "OCTOBER", + "NOVEMBER", + "DECEMBER", + ]; let startDate = new Date(); // Get events from backend + // TODO: replace this axios call with a utility function within utils/---.ts useEffect(() => { - axios.get("http://localhost:3000/api/events") - .then((response) => { - setEvents(response.data); - - // Have default flagship event be next upcoming event by sorting events by date and taking the first one - events.sort((a, b) => { - return new Date(a.start_date_time).getTime() - new Date(b.start_date_time).getTime(); - }); - - setFlagshipEvent(response.data[0]); - - // Now check if there is a flagship event (tagged as such) and set it as the flagship event - response.data.forEach((event:Event) => { - if (event.tag.includes("Flagship Event")) { - setFlagshipEvent(event); - } - }, - - // Need to do this for some reason to get calling methods on Date object to work - startDate = new Date(flagshipEvent.start_date_time), - - ); - }) - .catch((error) => { - console.log(error); - }); - } - , []); - - console.log(flagshipEvent); - + axios + .get("http://localhost:3000/api/events") + .then((response) => { + setEvents(response.data); + + // Have default flagship event be next upcoming event by sorting events by date and taking the first one + events.sort((a, b) => { + return ( + new Date(a.start_date_time).getTime() - + new Date(b.start_date_time).getTime() + ); + }); + + setFlagshipEvent(response.data[0]); + + // Now check if there is a flagship event (tagged as such) and set it as the flagship event + response.data.forEach( + (event: Event) => { + if (event.tag.includes("Flagship Event")) { + setFlagshipEvent(event); + } + }, + + // Need to do this for some reason to get calling methods on Date object to work + (startDate = new Date(flagshipEvent.start_date_time)) + ); + }) + .catch((error) => { + console.log(error); + }); + }, []); + + console.log(flagshipEvent); return (
-
@@ -104,10 +119,22 @@ function DashboardDiscover() { {eventDetails && ( )} -
- +
+ +
+ {/* adjust sizes and stuff as needed */} + +
+ + {eventDetails && ( + + )} +
); } -export default DashboardDiscover; \ No newline at end of file +export default DashboardDiscover; diff --git a/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx b/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx index 3921c81..f574f4c 100644 --- a/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx +++ b/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx @@ -2,100 +2,138 @@ import { Dispatch, SetStateAction } from "react"; import { IoArrowBackCircle } from "react-icons/io5"; type Event = { - event_title: string; - description: string; - tasks: string; - notes: string; - contact: string; - tag: string[]; - start_date_time: Date; - end_date_time: Date; - location: string; - image: string; - host: string; - coordinates: {longitude: string, latitude: string}; -} + event_title: string; + description: string; + tasks: string; + notes: string; + contact: string; + tag: string[]; + start_date_time: Date; + end_date_time: Date; + location: string; + image: string; + host: string; + coordinates: { longitude: string; latitude: string }; +}; interface EventProps { - event: Event; - setEventDetails: Dispatch>; + event: Event; + setEventDetails: Dispatch>; } -export default function EventDetails({event, setEventDetails}: EventProps) { - // Need to do this for some reason to get calling methods on Date object to work - const startDate = new Date(event.start_date_time); - const endDate = new Date(event.end_date_time); - - const mapEmbed = "https://maps.google.com/maps?q="+event.coordinates.longitude+","+event.coordinates.latitude+"&hl=en&z=18&&output=embed" - - const options: Intl.DateTimeFormatOptions = { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric'}; - return ( -
{/* event-container */} -
setEventDetails(null)}>
+export default function EventDetails({ event, setEventDetails }: EventProps) { + // Need to do this for some reason to get calling methods on Date object to work + const startDate = new Date(event.start_date_time); + const endDate = new Date(event.end_date_time); - + const mapEmbed = + "https://maps.google.com/maps?q=" + + event.coordinates.longitude + + "," + + event.coordinates.latitude + + "&hl=en&z=18&&output=embed"; -
-
-

{event.event_title}

- -
+ const options: Intl.DateTimeFormatOptions = { + weekday: "long", + month: "long", + day: "numeric", + year: "numeric", + }; + return ( +
+ {" "} + {/* event-container */} +
setEventDetails(null)} + > + +
+ +
+
+

{event.event_title}

+ +
-
- {event.tag.map((tag, index) => ( -
{tag}
- ))} -
+
+ {event.tag.map((tag, index) => ( +
+ {tag}
- -
-
-
-

Description

-

{event.description}

-
+ ))} +
+
+
+
+
+

Description

+

{event.description}

+
-
-

Key Tasks and Responsibilities

-

{event.tasks}

-
+
+

+ Key Tasks and Responsibilities +

+

{event.tasks}

+
-
-

Important Notes

-

{event.notes}

-
+
+

Important Notes

+

{event.notes}

+
-
-

Contact Details

-

{"Hosted By: " + event.host}

-

{event.contact}

-
-
+
+

Contact Details

+

+ {"Hosted By: " + event.host} +

+

{event.contact}

+
+
-
-
-