From 4e5e91b6c9fb18c41303bd83250bdb7fdfdf2b92 Mon Sep 17 00:00:00 2001 From: Anderson T Date: Fri, 15 Nov 2024 06:02:19 -0800 Subject: [PATCH] Some changes. --- frontend/src/Global.ts | 38 ++-- frontend/src/app/HomePage.tsx | 32 ++-- frontend/src/app/about/AboutPage.tsx | 70 ++++---- frontend/src/app/about/ExecProfiles.tsx | 132 ++++++-------- frontend/src/app/about/ProfileModal.tsx | 9 +- frontend/src/app/about/page.tsx | 6 +- frontend/src/app/api/hello/route.ts | 3 - frontend/src/app/events/Event.tsx | 127 -------------- frontend/src/app/events/Events.tsx | 17 -- frontend/src/app/events/EventsLuma.tsx | 98 ----------- .../app/events/EventsOnHomePage/Carousel.tsx | 164 ------------------ .../app/events/EventsOnHomePage/Decision.tsx | 39 ----- .../src/app/events/EventsOnHomePage/Event.tsx | 132 -------------- .../EventsOnHomePage/EventForCarousel.tsx | 147 ---------------- .../events/EventsOnHomePage/EventeSection.tsx | 106 ----------- .../app/events/EventsOnHomePage/Events.tsx | 29 ---- frontend/src/app/events/EventsPage.tsx | 92 ---------- frontend/src/app/events/page.tsx | 24 --- frontend/src/app/hacks/Body.tsx | 21 --- frontend/src/app/hacks/Header.tsx | 17 -- frontend/src/app/hacks/IconLabel.tsx | 9 - frontend/src/app/hacks/Timer.tsx | 78 --------- frontend/src/app/hacks/page.tsx | 10 -- frontend/src/app/hacks/schedule/Body.tsx | 21 --- frontend/src/app/hacks/schedule/Header.tsx | 17 -- frontend/src/app/hacks/schedule/page.tsx | 10 -- frontend/src/app/hacks/workshops/page.tsx | 11 -- frontend/src/app/page.tsx | 6 +- frontend/src/app/resources/Body.tsx | 21 --- frontend/src/app/resources/Header.tsx | 29 ---- frontend/src/app/resources/page.tsx | 10 -- .../src/app/shared_components/ClubSummary.tsx | 27 --- .../src/app/shared_components/Conditional.tsx | 14 -- .../app/shared_components/footer/Footer.tsx | 31 ++-- .../app/shared_components/header/NavBar.tsx | 77 ++++---- .../shared_components/header/NavButton.tsx | 26 +-- frontend/src/lib/utils.ts | 1 + frontend/src/redux/slices/execProfileSlice.ts | 76 ++++---- frontend/src/redux/thunks/ProfileThunks.ts | 44 +++-- 39 files changed, 246 insertions(+), 1575 deletions(-) delete mode 100644 frontend/src/app/api/hello/route.ts delete mode 100644 frontend/src/app/events/Event.tsx delete mode 100644 frontend/src/app/events/Events.tsx delete mode 100644 frontend/src/app/events/EventsLuma.tsx delete mode 100644 frontend/src/app/events/EventsOnHomePage/Carousel.tsx delete mode 100644 frontend/src/app/events/EventsOnHomePage/Decision.tsx delete mode 100644 frontend/src/app/events/EventsOnHomePage/Event.tsx delete mode 100644 frontend/src/app/events/EventsOnHomePage/EventForCarousel.tsx delete mode 100644 frontend/src/app/events/EventsOnHomePage/EventeSection.tsx delete mode 100644 frontend/src/app/events/EventsOnHomePage/Events.tsx delete mode 100644 frontend/src/app/events/EventsPage.tsx delete mode 100644 frontend/src/app/events/page.tsx delete mode 100644 frontend/src/app/hacks/Body.tsx delete mode 100644 frontend/src/app/hacks/Header.tsx delete mode 100644 frontend/src/app/hacks/IconLabel.tsx delete mode 100644 frontend/src/app/hacks/Timer.tsx delete mode 100644 frontend/src/app/hacks/page.tsx delete mode 100644 frontend/src/app/hacks/schedule/Body.tsx delete mode 100644 frontend/src/app/hacks/schedule/Header.tsx delete mode 100644 frontend/src/app/hacks/schedule/page.tsx delete mode 100644 frontend/src/app/hacks/workshops/page.tsx delete mode 100644 frontend/src/app/resources/Body.tsx delete mode 100644 frontend/src/app/resources/Header.tsx delete mode 100644 frontend/src/app/resources/page.tsx delete mode 100644 frontend/src/app/shared_components/ClubSummary.tsx delete mode 100644 frontend/src/app/shared_components/Conditional.tsx diff --git a/frontend/src/Global.ts b/frontend/src/Global.ts index 860713a..cd6829f 100644 --- a/frontend/src/Global.ts +++ b/frontend/src/Global.ts @@ -1,25 +1,25 @@ -"use client"; -export class Vector2D -{ - public X: number; - public Y: number; +// "use client"; +// export class Vector2D +// { +// public X: number; +// public Y: number; - public constructor(x: number, y: number) - { - this.X = x; - this.Y = y; - } -} +// public constructor(x: number, y: number) +// { +// this.X = x; +// this.Y = y; +// } +// } -export class Global -{ - public static WindowDimensions: Vector2D = new Vector2D(0, 0); - public static ThresholdDimensions: Vector2D = new Vector2D(850, 800); +// export class Global +// { +// public static WindowDimensions: Vector2D = new Vector2D(0, 0); +// public static ThresholdDimensions: Vector2D = new Vector2D(850, 800); - public static IsShrunkX: boolean = false; - public static IsShrunkY: boolean = false; +// public static IsShrunkX: boolean = false; +// public static IsShrunkY: boolean = false; - public static CurrentPageIndex: number = 0; -} +// public static CurrentPageIndex: number = 0; +// } diff --git a/frontend/src/app/HomePage.tsx b/frontend/src/app/HomePage.tsx index 758bd2f..515dada 100644 --- a/frontend/src/app/HomePage.tsx +++ b/frontend/src/app/HomePage.tsx @@ -2,13 +2,13 @@ import { UnknownAction } from "@reduxjs/toolkit"; import { useEffect } from "react"; -import Decision from "./events/EventsOnHomePage/Decision"; -import ClubSummary from "./shared_components/ClubSummary"; +// import Decision from "./events/EventsOnHomePage/Decision"; +// import ClubSummary from "./shared_components/ClubSummary"; import { useAppDispatch, useAppSelector } from "../redux/hooks/hooks"; import { AddExecProfile, ExecProfileObject, selectProfile } from "../redux/slices/execProfileSlice"; import { SetCurrentPage } from "../redux/slices/pageSlice"; import { AppDispatch } from "../redux/stores/store"; -import { loadProfilesAsync } from "../redux/thunks/ProfileThunks"; +// import { loadProfilesAsync } from "../redux/thunks/ProfileThunks"; let InstanceCount: number = 0; @@ -17,22 +17,22 @@ interface HomePageProps { } export default function HomePage({ }: HomePageProps) { - const execProfiles = useAppSelector(selectProfile); + // const execProfiles = useAppSelector(selectProfile); const mainDispatch = useAppDispatch(); mainDispatch(SetCurrentPage("/")); - useEffect(() => { - (async () => { - if (execProfiles.length < 1) { - const promise: UnknownAction = (mainDispatch(loadProfilesAsync() as AppDispatch)); + // useEffect(() => { + // (async () => { + // if (execProfiles.length < 1) { + // const promise: UnknownAction = (mainDispatch(loadProfilesAsync() as AppDispatch)); - ((await promise) as unknown as ExecProfileObject[]).forEach((element: ExecProfileObject) => { - mainDispatch(AddExecProfile(element)); - }); - } - })(); - }); + // ((await promise) as unknown as ExecProfileObject[]).forEach((element: ExecProfileObject) => { + // mainDispatch(AddExecProfile(element)); + // }); + // } + // })(); + // }); let css: string = "", flexContainer: string = "flex flex-row max-[600px]:justify-center max-[600px]:mx-0 ml-[10%]"; let size: number = 5; @@ -72,9 +72,9 @@ export default function HomePage({ }: HomePageProps) { - + {/* */} - + {/* */} ); } diff --git a/frontend/src/app/about/AboutPage.tsx b/frontend/src/app/about/AboutPage.tsx index f5e1ba6..453d10c 100644 --- a/frontend/src/app/about/AboutPage.tsx +++ b/frontend/src/app/about/AboutPage.tsx @@ -2,11 +2,11 @@ import { UnknownAction } from "@reduxjs/toolkit"; import { useEffect, useState } from "react"; -import Conditional from "../shared_components/Conditional"; +// import Conditional from "../shared_components/Conditional"; import ExecProfiles from "./ExecProfiles"; import { useAppDispatch, useAppSelector } from "../../redux/hooks/hooks"; import { AddExecProfile, ExecProfileObject, selectProfile } from "../../redux/slices/execProfileSlice"; -import { SetCurrentPage } from "../../redux/slices/pageSlice"; +// import { SetCurrentPage } from "../../redux/slices/pageSlice"; import { AppDispatch } from "../../redux/stores/store"; import { loadProfilesAsync } from "../../redux/thunks/ProfileThunks"; @@ -15,53 +15,59 @@ interface AboutPageProps export default function AboutPage({} : AboutPageProps) { - const execProfiles = useAppSelector(selectProfile); + // const execProfiles = useAppSelector(selectProfile); - const mainDispatch = useAppDispatch(); + // const mainDispatch = useAppDispatch(); - const [loading, setLoading] = useState(true); + // const [loading, setLoading] = useState(true); - mainDispatch(SetCurrentPage("/about")); + // mainDispatch(SetCurrentPage("/about")); // fetch the profiles if not done already - useEffect(() => { - (async () => { - if (execProfiles.length < 1) - { - const promise: UnknownAction = mainDispatch(loadProfilesAsync() as AppDispatch); + // useEffect(() => { + // (async () => { + // if (execProfiles.length < 1) + // { + // const promise: UnknownAction = mainDispatch(loadProfilesAsync() as AppDispatch); - ((await promise) as unknown as any[]).forEach((element) => { - mainDispatch(AddExecProfile({ ...element} as ExecProfileObject)); - }); - } + // ((await promise) as unknown as any[]).forEach((element) => { + // mainDispatch(AddExecProfile({ ...element} as ExecProfileObject)); + // }); + // } - setLoading(false); - })(); - }); + // setLoading(false); + // })(); + // }, [execProfiles.length]); return ( -
-
+
+ +
- About us + About us:
- {"The Langara Computer Science Club is a student-led club dedicated to providing a space for students interested in computer science. We provide a space to learn, create, network, and to have fun! We hold workshops, programming competitions, and other meetups."} -
-
-
-
- Our Executives +

{"The Langara Computer Science Club is a student-led club dedicated to providing a space for students interested in computer science. We provide a space to learn, create, network, and to have fun! We hold workshops, programming competitions, and other meetups."}

+

+

+ {"The Langara Computer Science club is run by a team of dedicated Langara students. We strive to create awesome opportunities and events and to represent the interests of the diverse student body."} +

-
- {"The Langara Computer Science club is run by a team of dedicated Langara students. We strive to create awesome opportunities and events and to represent the interests of the diverse student body."} -
+
-
+ +

+ + +
+

Our Executives:

+
- Loading + {/* TODO: don't assume API always works. */} + {/* Loading */}
+
); diff --git a/frontend/src/app/about/ExecProfiles.tsx b/frontend/src/app/about/ExecProfiles.tsx index 64594cc..fabb2ce 100644 --- a/frontend/src/app/about/ExecProfiles.tsx +++ b/frontend/src/app/about/ExecProfiles.tsx @@ -1,88 +1,56 @@ -import { useEffect, useState } from "react"; -import ExecProfile from "./ExecProfile"; -import { useAppSelector } from '../../redux/hooks/hooks'; -import { ExecProfileObject, selectProfile } from '../../redux/slices/execProfileSlice'; +import { useEffect, useState } from 'react'; +import ExecProfile from './ExecProfile'; +import { useAppSelector, useAppDispatch } from '../../redux/hooks/hooks'; +import { selectProfile } from '../../redux/slices/execProfileSlice'; +import { loadProfilesAsync } from '../../redux/thunks/ProfileThunks'; export default function ExecProfiles() { - const profiles = useAppSelector(selectProfile); - - const profilesSorted = profiles; - - const [profileSections, setProfileSections] = useState([]); - - let initialValue: number = 3; - - useEffect(() => { - if (window !== undefined) { - if (window.innerWidth <= 800) - initialValue = 2; + const dispatch = useAppDispatch(); + const profiles = useAppSelector(selectProfile); + const [loading, setLoading] = useState(true); + const [hasFetched, setHasFetched] = useState(false); // Prevents multiple fetches + + useEffect(() => { + const fetchProfiles = async () => { + if (!hasFetched) { + setHasFetched(true); // Set flag to true to prevent re-fetching + // console.log("Fetching profiles..."); + const resultAction = await dispatch(loadProfilesAsync()); + + if (loadProfilesAsync.fulfilled.match(resultAction)) { + // console.log("Profiles fetched:", resultAction.payload); + } else { + // console.error("Failed to fetch profiles"); } - }); - - const [cols, setCols] = useState(initialValue); - - const updateSections = () => { - const sections = []; - - for (let x = 0; x < profilesSorted.length / cols; x++) - sections.push(profilesSorted.slice(x * cols, x * cols + cols)); - - setProfileSections(sections); + setLoading(false); + } }; - useEffect(() => { - if (profileSections.length < 1) - updateSections(); - }); - - useEffect(() => { - const handleResize = () => { - if (window !== undefined) - { - if (window.innerWidth <= 800) - { - setCols(2); - updateSections(); - } - else - { - setCols(3); - updateSections(); - } - } - }; - - if (window !== undefined) - { - window.addEventListener('load', handleResize); - window.addEventListener('resize', handleResize); - } - - return () => { - if (window !== undefined) - window.removeEventListener('resize', handleResize); - }; - }, []); - // max-[800px]:grid max-[800px]:content-center max-[800px]:grid-flow-col max-[800px]:auto-cols-min max-[800px]:justify-items-center - return ( -
- { - profileSections.map(profiles => ( -
- { - profiles.map(profile => ( - - )) - } -
- )) - } -
- ); + fetchProfiles(); + }, [dispatch, hasFetched]); + + if (loading) { + return
Loading...
; + } + +// console.log("Profiles to display:", profiles); + + return ( +
+ {profiles.map((profile: { ID: string; Position: string[]; Name: string; ImageBuffer?: string; Description: string; }) => ( + + ))} +
+ ); } diff --git a/frontend/src/app/about/ProfileModal.tsx b/frontend/src/app/about/ProfileModal.tsx index 56cd8e5..bf34353 100644 --- a/frontend/src/app/about/ProfileModal.tsx +++ b/frontend/src/app/about/ProfileModal.tsx @@ -1,6 +1,8 @@ import * as Dialog from "@radix-ui/react-dialog"; import Image from "next/image"; import { useEffect, useState } from 'react'; +import { DialogTitle } from "@radix-ui/react-dialog"; +import { VisuallyHidden } from "@radix-ui/react-visually-hidden"; interface ProfileModalProps { ID: String; @@ -32,7 +34,11 @@ export default function ProfileModal ({Name, Position, ImageBuffer, Description, }, []); return ( -
+ + + {Name} + +
{Name}
@@ -48,5 +54,6 @@ export default function ProfileModal ({Name, Position, ImageBuffer, Description,
Close
+ ); }; \ No newline at end of file diff --git a/frontend/src/app/about/page.tsx b/frontend/src/app/about/page.tsx index 94ea7f9..4f11e69 100644 --- a/frontend/src/app/about/page.tsx +++ b/frontend/src/app/about/page.tsx @@ -11,11 +11,7 @@ export default function Page() return (
- ([ - ["Home", "/"], - ["About", "/about"], - ["Events", "/events"], - ])} /> +
diff --git a/frontend/src/app/api/hello/route.ts b/frontend/src/app/api/hello/route.ts deleted file mode 100644 index d1cc6ee..0000000 --- a/frontend/src/app/api/hello/route.ts +++ /dev/null @@ -1,3 +0,0 @@ -export async function GET(request: Request) { - return new Response('Hello, Next.js!') -} diff --git a/frontend/src/app/events/Event.tsx b/frontend/src/app/events/Event.tsx deleted file mode 100644 index 83b050a..0000000 --- a/frontend/src/app/events/Event.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import Image from "next/image"; -import { useState } from "react"; -import { useSelector } from "react-redux"; -import { useAppDispatch } from "../../redux/hooks/hooks"; -import IconLabel from "../shared_components/IconLabel"; -import { CalendarEvent, SetCurrentEvent, selectEvent } from "../../redux/slices/eventSlice"; - -import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; -import { useRouter } from "next/navigation"; - -interface EventProps -{ - Event: CalendarEvent; -} - -export default function EventInstance({Event} : EventProps) -{ - const getTimeStamp = (time: Date) => { - const split = time.toTimeString().split(' ')[0]; - - let [hour, minute] = split.substring(0, split.length - 3).split(":"); - - let hourInt: number; - let postFix: string = "AM"; - - if ((hourInt = Number.parseInt(hour)) > 12) - { - hour = (hourInt - 12).toString(); - postFix = "PM"; - } - - return `${hour}:${minute} ${postFix}`; - } - - const event = useSelector(selectEvent); - - const mainDispatch = useAppDispatch(); - - const [clicked, setClicked] = useState(true); - - const router = useRouter(); - - return (<> - - -
{ mainDispatch(SetCurrentEvent(Event)); setClicked(true); }}> -
- {"event-image"} -
-
- {Event.Title} -
- - - - - - - - - - - -
-
-
-
- - - {Event.Title} - - -
-
- event-image -
- - - - - - - - - - -
-
-
- Description -
- {Event.Description != null ? ( -
- ) : ( - "No description." - )} -
-
-
- -
- - - - -
-
-
-
- ); -} diff --git a/frontend/src/app/events/Events.tsx b/frontend/src/app/events/Events.tsx deleted file mode 100644 index 936ad5f..0000000 --- a/frontend/src/app/events/Events.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { CalendarEvent } from "../../redux/slices/eventSlice"; -import EventInstance from "./Event"; - -interface EventsProps -{ - Events: CalendarEvent[]; -} - -export default function Events({Events} : EventsProps) -{ - return ( -
- {Events.sort((a, b) => b.Start.getTime() - a.Start.getTime()) // sort by date - .map(event => )} -
- ); -} \ No newline at end of file diff --git a/frontend/src/app/events/EventsLuma.tsx b/frontend/src/app/events/EventsLuma.tsx deleted file mode 100644 index 4c6e49a..0000000 --- a/frontend/src/app/events/EventsLuma.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { useRouter } from "next/navigation"; -import { useAppDispatch } from "../../redux/hooks/hooks"; -import { SetCurrentPage } from "../../redux/slices/pageSlice"; - -export default function EventsSection() { - const router = useRouter(); - const mainDispatch = useAppDispatch(); - - mainDispatch(SetCurrentPage("/events")); - - const iframeStyle = { - border: '1px solid black', - borderRadius: '4px', - boxShadow: '0px 0px 3px 1px black ', - height: `760px`, - width: '500px', - overflow: 'hidden', - - }; - return ( - <> -
-
-
-
- {/* welcome week */} - -
-
- -

- -
- -
-
; -} diff --git a/frontend/src/app/hacks/Header.tsx b/frontend/src/app/hacks/Header.tsx deleted file mode 100644 index 74a6c02..0000000 --- a/frontend/src/app/hacks/Header.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import {useState} from "react"; -import {IconLabel} from "./IconLabel"; - -export function Header() -{ - return
-
-
-
-
Langara Hacks
-
Collaborate, Create, Innovate
-
-
-
-
-} - diff --git a/frontend/src/app/hacks/IconLabel.tsx b/frontend/src/app/hacks/IconLabel.tsx deleted file mode 100644 index b2f28fd..0000000 --- a/frontend/src/app/hacks/IconLabel.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import Image from "next/image"; - -export function IconLabel({iconSrc, label, height, width}: {iconSrc: string, label: string, height: number, width: number}) -{ - return
- {"Image"} - {label} -
; -} \ No newline at end of file diff --git a/frontend/src/app/hacks/Timer.tsx b/frontend/src/app/hacks/Timer.tsx deleted file mode 100644 index 477c132..0000000 --- a/frontend/src/app/hacks/Timer.tsx +++ /dev/null @@ -1,78 +0,0 @@ -"use client"; - -import {Component, useState} from "react"; - -class TimeStamp -{ - public readonly Days: number; - public readonly Hours: number; - public readonly Minutes: number; - public readonly Seconds: number; - - public constructor(days: number, hours: number, minutes: number, seconds: number) - { - this.Days = days; - this.Hours = hours; - this.Seconds = seconds; - this.Minutes = minutes; - } -} - -interface TimerProps -{ - EndTime: Date; -} - -interface TimerState -{ - CurrentTimeStamp: TimeStamp; -} - -export class Timer extends Component -{ - protected TimeDifference: number; - - public Tick(): void - { - this.UpdateTimeStamp() - - setInterval(()=> { - this.UpdateTimeStamp(); - if(this.TimeDifference > 0) - this.TimeDifference -= 1; - }, 1000); - } - - public UpdateTimeStamp(): void { - let seconds: number = Math.floor(this.TimeDifference % 60), - minutes: number = Math.floor((this.TimeDifference % 3600) / 60), - hours: number = Math.floor((this.TimeDifference % 86400) / 3600), - days: number = Math.floor(this.TimeDifference / (3600 * 24)); - - this.setState({CurrentTimeStamp: new TimeStamp(days, hours, minutes, seconds)} ); - } - - public UNSAFE_componentWillMount() { - this.setState({CurrentTimeStamp: new TimeStamp(0,0,0,0)}); - this.Tick(); - } - - render() - { - return
- It's time to Hack! -
- } - - constructor(props: TimerProps) - { - super(props); - - // I can't figure out how to fix the server time right now, SORRY RISHIT - let date = new Date(); - date.setHours(date.getHours()-7); - - this.TimeDifference = Math.abs((this.props.EndTime.valueOf() - date.valueOf())) / 1000; - //this.TimeDifference = Math.abs((this.props.EndTime.valueOf() - new Date().valueOf())) / 1000; - } -} \ No newline at end of file diff --git a/frontend/src/app/hacks/page.tsx b/frontend/src/app/hacks/page.tsx deleted file mode 100644 index 447cbdf..0000000 --- a/frontend/src/app/hacks/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import {Header} from "./Header"; -import {Body} from "../hacks/Body"; - -export default function Page() -{ - return
-
- -
; -} \ No newline at end of file diff --git a/frontend/src/app/hacks/schedule/Body.tsx b/frontend/src/app/hacks/schedule/Body.tsx deleted file mode 100644 index 4f2375c..0000000 --- a/frontend/src/app/hacks/schedule/Body.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import {Timer} from "../Timer"; -import SocialIcons from "@/app/shared_components/SocialIcons"; - -export function Body() -{ - return
- -
- Schedule -
- -
-
- -

- -
- -
-
; -} diff --git a/frontend/src/app/hacks/schedule/Header.tsx b/frontend/src/app/hacks/schedule/Header.tsx deleted file mode 100644 index d810a95..0000000 --- a/frontend/src/app/hacks/schedule/Header.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import {useState} from "react"; -import {IconLabel} from "../IconLabel"; - -export function Header() -{ - return
-
-
-
-
Langara Hacks
-
Collaborate, Create, Innovate
-
-
-
-
-} - diff --git a/frontend/src/app/hacks/schedule/page.tsx b/frontend/src/app/hacks/schedule/page.tsx deleted file mode 100644 index 3cd6eae..0000000 --- a/frontend/src/app/hacks/schedule/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { Header } from "./Header"; -import {Body} from "./Body"; - -export default function Page() -{ - return
-
- -
; -} \ No newline at end of file diff --git a/frontend/src/app/hacks/workshops/page.tsx b/frontend/src/app/hacks/workshops/page.tsx deleted file mode 100644 index 6fe602b..0000000 --- a/frontend/src/app/hacks/workshops/page.tsx +++ /dev/null @@ -1,11 +0,0 @@ -"use client"; - -export default function Page() -{ - if (typeof(window) !== "undefined") - window.location.href = "https://events.mlh.io/events/10198-langara-hacks-workshops"; - - return
- Redirecting. Click Here if not redirected automatically. -
; -} \ No newline at end of file diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 84d5ce3..054e637 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -39,11 +39,7 @@ export default function Home() {
- ([ - ["Home", "/"], - ["About", "/about"], - ["Events", "/events"] - ])} /> + diff --git a/frontend/src/app/resources/Body.tsx b/frontend/src/app/resources/Body.tsx deleted file mode 100644 index 60b380e..0000000 --- a/frontend/src/app/resources/Body.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import SocialIcons from "@/app/shared_components/SocialIcons"; - -export function Body() -{ - return
- -
- Resources -
- -
-
- -

- -
- -
- -
; -} diff --git a/frontend/src/app/resources/Header.tsx b/frontend/src/app/resources/Header.tsx deleted file mode 100644 index 501f0be..0000000 --- a/frontend/src/app/resources/Header.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import Image from "next/image"; -import profile from "../../../public/LCS.png"; - - -export function Header() -{ - return
-
-
-
- {"club-logo"} - -
-
-
- {/*
-
-
- - - - -
-
-
*/} -
-
-} - diff --git a/frontend/src/app/resources/page.tsx b/frontend/src/app/resources/page.tsx deleted file mode 100644 index 3a438c3..0000000 --- a/frontend/src/app/resources/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { Body } from "./Body"; -import { Header } from "./Header"; - -export default function Page() -{ - return
-
- -
; -} \ No newline at end of file diff --git a/frontend/src/app/shared_components/ClubSummary.tsx b/frontend/src/app/shared_components/ClubSummary.tsx deleted file mode 100644 index a264010..0000000 --- a/frontend/src/app/shared_components/ClubSummary.tsx +++ /dev/null @@ -1,27 +0,0 @@ - - - - -const ClubSummary = function () { - - return ( - - // The Langara Computer Science Club is a student-led club dedicated to providing a space for students interested in computer science. We provide a space to learn, create, network, and to have fun! We hold workshops, programming competitions, socials, and other meetups. - // - - -
-
-

About Us

- Meet our team -
-

- The Langara Computer Science Club is a student-led club dedicated to providing a space for students interested in computer science. We provide a space to learn, create, network, and to have fun! We hold workshops, programming competitions, socials, and other meetups. -
-
- - ) - -} - -export default ClubSummary \ No newline at end of file diff --git a/frontend/src/app/shared_components/Conditional.tsx b/frontend/src/app/shared_components/Conditional.tsx deleted file mode 100644 index f6b96a9..0000000 --- a/frontend/src/app/shared_components/Conditional.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { ReactNode } from 'react'; - -interface ConditionalProps { - Condition: boolean; - - children: ReactNode; -} - -export default function Conditional({ Condition, children }: ConditionalProps): JSX.Element { - if (Condition) - return (<>{children}); - - return <>; -} diff --git a/frontend/src/app/shared_components/footer/Footer.tsx b/frontend/src/app/shared_components/footer/Footer.tsx index ff30ef0..6c6de9d 100644 --- a/frontend/src/app/shared_components/footer/Footer.tsx +++ b/frontend/src/app/shared_components/footer/Footer.tsx @@ -2,6 +2,7 @@ import { Button } from "@/components/ui/button"; import { useRouter } from "next/navigation"; import React, { useMemo, useState } from "react"; import SocialIcons from "../SocialIcons"; +import Link from "next/link"; export default function Footer() { const forms = { @@ -13,13 +14,10 @@ export default function Footer() { ["Course Planner", "https://planner.langaracs.ca/"], ["Transfer Resources", "https://langaracs.notion.site/Transfer-Information-a0548da4b3084681868381310c604c34"], ["Course Resources", "https://langaracs.notion.site/Langara-CS-Resources-12b750af5ecc4eeb86315d3d9fd8f1ce?pvs=4"], - ["Feedback", forms.feedback] + ["Feedback", "https://forms.gle/jaYbdo6KWbGFvJJG8"] ]); const linksMap = new Map([ - ["Home", "/"], - ["About", "/about"], - ["Events", "/events"], ["Rules", "https://langaracs.notion.site/LCSC-Rules-393da1457d784fa19c98d1d3c32ae829?pvs=4"] ]); @@ -67,37 +65,34 @@ export default function Footer() {
{resourcesMemo}
-
Copyright © {new Date(Date.now()).getFullYear()} Langara Computer Science Club
+ {/*
Copyright © {new Date(Date.now()).getFullYear()} Langara Computer Science Club
*/}
-
+ {/*
Links
{linksMemo}
-
+
*/}
-
- Join Us -
+ {/*
+ Become a +
*/} - +
-
- Contacts -
- - + +
- */}
I am not here
diff --git a/frontend/src/app/shared_components/header/NavBar.tsx b/frontend/src/app/shared_components/header/NavBar.tsx index 75ee22c..2faa56c 100644 --- a/frontend/src/app/shared_components/header/NavBar.tsx +++ b/frontend/src/app/shared_components/header/NavBar.tsx @@ -1,8 +1,7 @@ "use client"; import { Button } from "@/components/ui/button"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; +import Link from "next/link"; import { useSelector } from "react-redux"; import { useAppDispatch } from "../../../redux/hooks/hooks"; import Menu from "../Menu"; @@ -11,71 +10,73 @@ import { SetCurrentPage, selectCurrentPage } from "../../../redux/slices/pageSli import SocialIcons from "../SocialIcons"; -interface NavBarProps { - Pages: Map; -} - -interface NavBarState { - ButtonGap?: number; - TopMargin?: number; -} +export default function NavBar() { -export default function NavBar({ Pages }: NavBarProps) { -
; -
; -
; -
; -
; -
; -
; + const Pages = new Map([ + ["Home", "/"], + ["About", "/about"], + ["Events", "https://lu.ma/lcsc"] + ]) - const router = useRouter(); const mainDispatch = useAppDispatch(); const currentPage = useSelector(selectCurrentPage); - const [page, setPage] = useState(currentPage); - - const formURL = "https://lu.ma/g2q0djtw"; - const onClickHandler = (url: string) => { - router.push(url); + // Set the current page when navigating + const handlePageChange = (url: string) => { mainDispatch(SetCurrentPage(url)); - setPage(currentPage); }; - const navButtons: Array = new Array(); + const navButtons: Array = []; - Pages.forEach((value, key, pageMap) => { - navButtons.push(); + Pages.forEach((value, key) => { + navButtons.push( + + ); }); + const formURL = "https://lu.ma/g2q0djtw"; + return (
-
); - } diff --git a/frontend/src/app/shared_components/header/NavButton.tsx b/frontend/src/app/shared_components/header/NavButton.tsx index 891716f..d767544 100644 --- a/frontend/src/app/shared_components/header/NavButton.tsx +++ b/frontend/src/app/shared_components/header/NavButton.tsx @@ -1,28 +1,20 @@ "use client"; +import { Button } from "@/components/ui/button"; +import Link from "next/link"; -interface NavButtonProps -{ +interface NavButtonProps { Label: string; - EndPoint: string; - Activated: boolean; - - OnClick: (url: string) => void; + onNavigate: (url: string) => void; } - -export default function NavButton({ Label, EndPoint, Activated, OnClick } : NavButtonProps): JSX.Element { - const color: string = Activated ? "white" : "lang-orange"; +export default function NavButton({ Label, EndPoint, Activated, onNavigate }: NavButtonProps) { return ( - <> - - + + {Label} + ); } - diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts index d084cca..5d90fa8 100644 --- a/frontend/src/lib/utils.ts +++ b/frontend/src/lib/utils.ts @@ -1,6 +1,7 @@ import { type ClassValue, clsx } from "clsx" import { twMerge } from "tailwind-merge" +// WHAT DOES THIS DO??? export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } diff --git a/frontend/src/redux/slices/execProfileSlice.ts b/frontend/src/redux/slices/execProfileSlice.ts index ae99fd4..7dd2fc9 100644 --- a/frontend/src/redux/slices/execProfileSlice.ts +++ b/frontend/src/redux/slices/execProfileSlice.ts @@ -1,52 +1,36 @@ -import { PayloadAction, createSlice } from "@reduxjs/toolkit"; -import { AppDispatch, RootState } from "../stores/store"; -interface ExecPosition -{ - ID: number; - - Title: string; +// execProfileSlice.ts +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { loadProfilesAsync } from '../thunks/ProfileThunks'; + +export interface ExecProfileObject { + ID: string; + Position: string; + Name: string; + ImageBuffer: string | null; + Description: string; } -export interface ExecProfileObject -{ - ID: string; - - Name: string; - - ImageBuffer: string; - - Position: Array; - - Description: string; -} - -export interface ExecProfileState -{ - Profiles: ExecProfileObject[]; -} - -const initialState: ExecProfileState = { - Profiles: [] -}; - - -const fetchEvents = () => async (state: RootState, dipatch: AppDispatch) => { - const response = await fetch("", { - method: "GET" +const initialState: ExecProfileObject[] = []; + +const execProfileSlice = createSlice({ + name: 'execProfiles', + initialState, + reducers: { + AddExecProfile: (state, action: PayloadAction) => { + const exists = state.some((profile) => profile.ID === action.payload.ID); + if (!exists) { + state.push(action.payload); + } + }, + }, + extraReducers: (builder) => { + builder.addCase(loadProfilesAsync.fulfilled, (state, action) => { + // Replace the entire state with new profiles (avoids duplicates) + return action.payload; }); -}; - -export const execProfileSlice = createSlice( -{ - name: "execProfile", - initialState, - reducers:{ - AddExecProfile: (state, action: PayloadAction) => { - return {...state, Profiles: [...state.Profiles, action.payload]}; - } - } + }, }); -export const {AddExecProfile} = execProfileSlice.actions; -export const selectProfile = (state: RootState) => state.execProfiles.Profiles; +export const { AddExecProfile } = execProfileSlice.actions; +export const selectProfile = (state: any) => state.execProfiles; export default execProfileSlice.reducer; diff --git a/frontend/src/redux/thunks/ProfileThunks.ts b/frontend/src/redux/thunks/ProfileThunks.ts index 43538de..ddad679 100644 --- a/frontend/src/redux/thunks/ProfileThunks.ts +++ b/frontend/src/redux/thunks/ProfileThunks.ts @@ -1,26 +1,24 @@ -import ExecProfile from "../../app/about/ExecProfile"; -import { AppDispatch, RootState } from "../stores/store"; -import { ExecProfileObject } from "../slices/execProfileSlice"; +import { createAsyncThunk } from '@reduxjs/toolkit'; +import { ExecProfileObject } from '../slices/execProfileSlice'; -export const loadProfilesAsync = () => async (state: RootState, dispatch: AppDispatch): Promise => { - const response = (await (await fetch(`https://api3.langaracs.ca/executives/active`, { - method: "GET", - headers: { - "apikey": `${process.env.APIKEY}` - } - })).json()); +export const loadProfilesAsync = createAsyncThunk( + 'profiles/load', + async (): Promise => { + const response = await fetch(`https://api3.langaracs.ca/executives/active`, { + method: 'GET', + headers: { + apikey: `${process.env.APIKEY}`, + }, + }); - // console.log(response) - - return response.map((element: any) => { - const execProfile: ExecProfileObject = { - ID: element.student_id, - Name: element.name, - ImageBuffer: element.profile_picture, - Position: element.roles, - Description: element.bio - }; + const data = await response.json(); - return execProfile; - }); -}; + return data.map((element: any) => ({ + ID: element.student_id, + Name: element.name, + ImageBuffer: element.profile_picture, + Position: element.roles, + Description: element.bio, + })); + } +);