diff --git a/frontend/src/Global.ts b/frontend/src/Global.ts deleted file mode 100644 index cd6829f..0000000 --- a/frontend/src/Global.ts +++ /dev/null @@ -1,25 +0,0 @@ - -// "use client"; -// export class Vector2D -// { -// public X: number; -// public Y: number; - -// 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); - -// public static IsShrunkX: boolean = false; -// public static IsShrunkY: boolean = false; - - -// public static CurrentPageIndex: number = 0; -// } diff --git a/frontend/src/redux/hooks/hooks.ts b/frontend/src/redux/hooks/hooks.ts deleted file mode 100644 index 8c66928..0000000 --- a/frontend/src/redux/hooks/hooks.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux"; -import { RootState, AppDispatch } from "../stores/store"; - -export const useAppDispatch: () => AppDispatch = useDispatch; -export const useAppSelector: TypedUseSelectorHook = useSelector; diff --git a/frontend/src/redux/slices/eventSlice.ts b/frontend/src/redux/slices/eventSlice.ts deleted file mode 100644 index b9bf018..0000000 --- a/frontend/src/redux/slices/eventSlice.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { loadEventsAsync } from '../thunks/EventThunks'; - -export interface Event { - event_name: string; - event_date: string; - event_start_date: string; - event_end_date: string; - location: string; - thumbnail: string; - registration_link: string; - id: string; - last_edited_time: string; -} - -interface EventState { - events: Event[]; -} - -const initialState: EventState = { - events: [], -}; - -const eventSlice = createSlice({ - name: 'events', - initialState, - reducers: { - SetEvents: (state, action: PayloadAction) => { - state.events = action.payload; - }, - }, - extraReducers: (builder) => { - builder.addCase(loadEventsAsync.fulfilled, (state, action: PayloadAction) => { - state.events = action.payload; // Update the events with the fetched data - }); - }, -}); - -export const { SetEvents } = eventSlice.actions; -export const selectEvents = (state: any) => state.events.events; // Adjust based on your state structure -export default eventSlice.reducer; - diff --git a/frontend/src/redux/slices/execProfileSlice.ts b/frontend/src/redux/slices/execProfileSlice.ts deleted file mode 100644 index 7dd2fc9..0000000 --- a/frontend/src/redux/slices/execProfileSlice.ts +++ /dev/null @@ -1,36 +0,0 @@ -// 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; -} - -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 { AddExecProfile } = execProfileSlice.actions; -export const selectProfile = (state: any) => state.execProfiles; -export default execProfileSlice.reducer; diff --git a/frontend/src/redux/slices/pageSlice.ts b/frontend/src/redux/slices/pageSlice.ts deleted file mode 100644 index c2c8ec0..0000000 --- a/frontend/src/redux/slices/pageSlice.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PayloadAction, createSlice } from "@reduxjs/toolkit"; -import { RootState } from "../stores/store"; - -export interface PageState -{ - CurrentPage: string; -} - -const initialState: PageState = { - CurrentPage: "/" -}; - -export const pageSlice = createSlice( -{ - name: "pageSlice", - initialState, - reducers:{ - SetCurrentPage: (state, action: PayloadAction) => { - return {CurrentPage: action.payload}; - } - } -}); - -export const {SetCurrentPage} = pageSlice.actions; -export const selectCurrentPage = (state: RootState) => state.pages.CurrentPage; -export default pageSlice.reducer; diff --git a/frontend/src/redux/stores/store.ts b/frontend/src/redux/stores/store.ts deleted file mode 100644 index 03532d6..0000000 --- a/frontend/src/redux/stores/store.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { configureStore } from "@reduxjs/toolkit"; -import eventsReducer from "../slices/eventSlice"; -import execProfileReducer from "../slices/execProfileSlice"; -import pageReducer from "../slices/pageSlice"; - -export const store = configureStore({ - reducer: { - execProfiles: execProfileReducer, - pages: pageReducer, - events: eventsReducer - }, - middleware: (getDefaultMiddlware) => getDefaultMiddlware({ - serializableCheck: false // Allows putting date types in the store - }) -}); - -export type RootState = ReturnType; -export type AppDispatch = typeof store.dispatch; \ No newline at end of file diff --git a/frontend/src/redux/thunks/EventThunks.ts b/frontend/src/redux/thunks/EventThunks.ts deleted file mode 100644 index 5ef694c..0000000 --- a/frontend/src/redux/thunks/EventThunks.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { createAsyncThunk } from '@reduxjs/toolkit'; -import { Event } from '../slices/eventSlice'; - -export const loadEventsAsync = createAsyncThunk( - 'events/load', - async (): Promise => { - const response = await fetch(`https://api3.langaracs.ca/events/all`); - const data = await response.json(); - - return data.map((item: any) => ({ - Title: item.event_name, - Start: new Date(item.event_start_date), - End: new Date(item.event_end_date), - Description: item.event_date, - Location: item.location, - Image: item.thumbnail ? `https://api3.langaracs.ca/executives/image/${item.thumbnail}` : "https://via.placeholder.com/800x800", - Link: { Google: item.registration_link, Apple: null } - })); - } -); diff --git a/frontend/src/redux/thunks/ProfileThunks.ts b/frontend/src/redux/thunks/ProfileThunks.ts deleted file mode 100644 index ddad679..0000000 --- a/frontend/src/redux/thunks/ProfileThunks.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createAsyncThunk } from '@reduxjs/toolkit'; -import { ExecProfileObject } from '../slices/execProfileSlice'; - -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}`, - }, - }); - - const data = await response.json(); - - return data.map((element: any) => ({ - ID: element.student_id, - Name: element.name, - ImageBuffer: element.profile_picture, - Position: element.roles, - Description: element.bio, - })); - } -);