diff --git a/shpe-app-web/.eslintrc.json b/shpe-app-web/.eslintrc.json deleted file mode 100644 index bffb357a7..000000000 --- a/shpe-app-web/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/shpe-app-web/.gitignore b/shpe-app-web/.gitignore deleted file mode 100644 index fd3dbb571..000000000 --- a/shpe-app-web/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/shpe-app-web/README.md b/shpe-app-web/README.md deleted file mode 100644 index c4033664f..000000000 --- a/shpe-app-web/README.md +++ /dev/null @@ -1,36 +0,0 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). - -## Getting Started - -First, run the development server: - -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/shpe-app-web/app/(main)/committees/components/CommitteeCard.tsx b/shpe-app-web/app/(main)/committees/components/CommitteeCard.tsx deleted file mode 100644 index 37eb036d9..000000000 --- a/shpe-app-web/app/(main)/committees/components/CommitteeCard.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { Committee } from "../../../types/committees"; -import { getLogoComponent } from "../../../types/committees"; -import Image from 'next/image'; import { CommitteeLogosName } from "../../../types/committees"; - -const CommitteeCard: React.FC = ({ committee }) => { - const { name, color, logo, head, memberCount, description } = committee; - console.log(committee); - const { LogoComponent, height, width } = getLogoComponent(logo as CommitteeLogosName); - const truncate = (str: string, n: number) => str.length > n ? str.substring(0, n) + "..." : str; - // TODO: committee.head is now a string containing the uid of the head of the committee - // We need to fetch the user data from the uid and display the head's name and photo - // Previously, committee.head was an object containing the head's data - - return ( -
-
- -
- {/* {''} */} -
-
{memberCount} members
-
-
-
- { - // Truncate the name if it is too long , but if doesnt exist default to untitled - name ? truncate(name, 16) : 'Untittled' - }
-
- { - // Truncate the description if it is too long , but if doesnt exist default to nothing - description ? truncate(description, 140) : '' - } -
-
-
- ); -} - -interface CommitteeCardProps { - committee: Committee -} - - -export default CommitteeCard; \ No newline at end of file diff --git a/shpe-app-web/app/(main)/committees/page.tsx b/shpe-app-web/app/(main)/committees/page.tsx deleted file mode 100644 index 346cfe7e9..000000000 --- a/shpe-app-web/app/(main)/committees/page.tsx +++ /dev/null @@ -1,55 +0,0 @@ -'use client' -import { useState, useEffect } from "react"; -import { useRouter } from "next/navigation"; -import { getPublicUserData, getCommittees } from "@/api/firebaseUtils"; -import { Committee } from "@/types/committees"; -import CommitteeCard from "./components/CommitteeCard"; - -const Committees = () => { - const router = useRouter(); - const [loading, setLoading] = useState(true); - const [committees, setCommittees] = useState([]); - - useEffect(() => { - const fetchCommittees = async () => { - setLoading(true); - const committees = await getCommittees(); - - const updatedCommittees = await Promise.all(committees.map(async (committee) => { - if (committee.head) { - const userData = committee.head; - return { ...committee, head: userData }; - } - return committee; - })); - - setCommittees(updatedCommittees as Committee[]); - setLoading(false); - } - - fetchCommittees(); - setLoading(false); - }, []); - - if (loading) { - return ( -
- -
- ); - } - - return ( -
- - -
- {!loading && committees.map((committees) => ( - - ))} -
- -
- ); -} -export default Committees; \ No newline at end of file diff --git a/shpe-app-web/app/(main)/dashboard/page.tsx b/shpe-app-web/app/(main)/dashboard/page.tsx deleted file mode 100644 index 0275d2336..000000000 --- a/shpe-app-web/app/(main)/dashboard/page.tsx +++ /dev/null @@ -1,41 +0,0 @@ -'use client' -import { useEffect, useState } from "react"; -import { useRouter } from 'next/navigation'; -import { onAuthStateChanged } from "firebase/auth"; -import { auth } from "@/config/firebaseConfig"; - -const Dashboard = () => { - const router = useRouter(); - const [loading, setLoading] = useState(true); - - useEffect(() => { - const unsubscribe = onAuthStateChanged(auth, (currentUser) => { - if (currentUser) { - setLoading(false); - } else { - // User is not logged in, redirect to root - router.push('/'); - } - }); - - return () => unsubscribe(); - }, [router]); - - if (loading) { - return ( -
-
- -
-
- ); - } - - return ( -
- -
- ); -}; - -export default Dashboard; \ No newline at end of file diff --git a/shpe-app-web/app/(main)/events/components/DayModal.tsx b/shpe-app-web/app/(main)/events/components/DayModal.tsx deleted file mode 100644 index f3c549f10..000000000 --- a/shpe-app-web/app/(main)/events/components/DayModal.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { SHPEEvent } from '@/types/events'; -import { format } from 'date-fns'; -import ReactDOM from 'react-dom'; - -interface DayModalProps { - day: Date; - events: SHPEEvent[]; - isShowing: boolean; - hide: () => void; - toggleEventPage: (event?: SHPEEvent) => void; -} - -export const DayModal: React.FC = ({ day, events, isShowing, hide, toggleEventPage }) => { - const modal = ( - <> - {/* Filter */} -
- - {/* Modal */} -
-
- {/* Header */} -

{format(day, 'cccc, MMMM do yyyy')}

- - {/* Event List */} -
- {events.map((event) => { - return ( -
toggleEventPage(event)} className="flex bg-red-300 cursor-pointer rounded-lg text-center font-medium p-1"> -
-

{event.name}

-

- {format(event.startTime!.toDate(), 'h:mm aaa')} - {format(event.endTime!.toDate(), 'h:mm aaa')} -

-
-
- ); - })} -
- - {/* Close Button */} - -
-
- - ); - - return isShowing ? ReactDOM.createPortal(modal, document.body) : null; -}; diff --git a/shpe-app-web/app/(main)/events/components/EventCalendar.tsx b/shpe-app-web/app/(main)/events/components/EventCalendar.tsx deleted file mode 100644 index 6b6c24885..000000000 --- a/shpe-app-web/app/(main)/events/components/EventCalendar.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { SHPEEvent } from '@/types/events'; -import { format, subMonths, addMonths, subWeeks, addWeeks, isSameMonth, startOfWeek, endOfWeek } from 'date-fns'; -import MonthView from './MonthView'; -import { useMemo, useState } from 'react'; -import WeekView from './WeekView'; - -interface EventCalendarProps { - events: SHPEEvent[]; - toggleEventPage: (event?: SHPEEvent) => void; -} - -const EventCalendar: React.FC = ({ events, toggleEventPage }) => { - const [focusDate, setFocusDate] = useState(new Date()); - const [isMonthSelected, setIsMonthSelected] = useState(true); - - // Group events by date - const eventsByDate = useMemo(() => { - return events.reduce((acc: { [key: string]: SHPEEvent[] }, event) => { - const dateKey = event.startTime?.toDate() ? format(event.startTime.toDate(), 'yyyy-MM-dd') : ''; - if (!acc[dateKey]) { - acc[dateKey] = []; - } - acc[dateKey].push(event); - return acc; - }, {}); - }, [events]); - - return ( -
- {/* Side Bar */} -
- {/* Event Filters */} -
-

Filters

-
- -

WIP

-
-
- {/* Small Calendar */} -
WIP
-
- -
- {/* Top Bar */} -
-

- {isMonthSelected - ? format(focusDate, 'MMMM yyyy') - : `${ - !isSameMonth(startOfWeek(focusDate), endOfWeek(focusDate)) - ? format(startOfWeek(focusDate), 'MMMM - ') - : '' - }${format(endOfWeek(focusDate), 'MMMM yyyy')}`} -

-
- - -
-
- - -
-
- - {/* Main Calendar */} - {isMonthSelected ? ( - - ) : ( - - )} -
-
- ); -}; - -export default EventCalendar; diff --git a/shpe-app-web/app/(main)/events/components/EventModal.tsx b/shpe-app-web/app/(main)/events/components/EventModal.tsx deleted file mode 100644 index 9fc2dacf1..000000000 --- a/shpe-app-web/app/(main)/events/components/EventModal.tsx +++ /dev/null @@ -1,478 +0,0 @@ -import { SHPEEvent, EventType, SHPEEventLog } from '@/types/events'; -import { format } from 'date-fns'; -import { Timestamp } from 'firebase/firestore'; -import { useEffect, useState } from 'react'; -import { getEventLogs, getPublicUserData } from '@/api/firebaseUtils'; -import ReactDOM from 'react-dom'; - -interface EventPageProps { - event?: SHPEEvent; - isShowing: boolean; - hide: () => void; -} - -interface FormData { - [key: string]: any; -} - -export const EventModal: React.FC = ({ event, isShowing, hide }) => { - const [loading, setLoading] = useState(false); - const currentDate = new Date(); - - const [eventLogs, setEventLogs] = useState([]); - const [formData, setFormData] = useState({}); - - useEffect(() => { - console.log(event); - if (event) { - const fetchLogs = async () => { - setLoading(true); - const logs = await getEventLogs(event.id!); - setEventLogs(logs); - setLoading(false); - }; - - fetchLogs(); - - setFormData({ - name: event?.name ?? null, - description: event?.description ?? null, - locationName: event?.locationName ?? null, - startDate: event?.startTime - ? format(event?.startTime?.toDate(), 'yyyy-MM-dd') - : format(new Date(), 'yyyy-MM-dd'), - startTime: event?.startTime - ? format(event.startTime.toDate(), 'HH:mm') - : format( - new Date( - currentDate.getFullYear(), - currentDate.getMonth(), - currentDate.getDay(), - currentDate.getHours() + 1, - 0 - ), - 'HH:mm' - ), - endDate: event?.endTime ? format(event?.endTime?.toDate(), 'yyyy-MM-dd') : format(new Date(), 'yyyy-MM-dd'), - endTime: event?.endTime - ? format(event.endTime.toDate(), 'HH:mm') - : format( - new Date( - currentDate.getFullYear(), - currentDate.getMonth(), - currentDate.getDay(), - currentDate.getHours() + 2, - 0 - ), - 'HH:mm' - ), - eventType: event?.eventType ?? 'CUSTOM_EVENT', - committee: event?.committee ?? 'NONE', - signInPoints: event?.signInPoints ?? null, - signOutPoints: event?.signOutPoints, - pointsPerHour: event?.pointsPerHour ?? null, - startTimeBuffer: event?.startTimeBuffer ?? null, - endTimeBuffer: event?.endTimeBuffer ?? null, - notificationSent: event?.notificationSent ?? false, - general: event?.general ?? false, - nationalConventionEligible: event?.nationalConventionEligible ?? false, - }); - } else { - setFormData({ - name: '', - description: '', - locationName: 'ZACH', - startDate: format(currentDate, 'yyyy-MM-dd'), - startTime: format( - new Date( - currentDate.getFullYear(), - currentDate.getMonth(), - currentDate.getDay(), - currentDate.getHours() + 1, - 0 - ), - 'HH:mm' - ), - endDate: format(currentDate, 'yyyy-MM-dd'), - endTime: format( - new Date( - currentDate.getFullYear(), - currentDate.getMonth(), - currentDate.getDay(), - currentDate.getHours() + 2, - 0 - ), - 'HH:mm' - ), - eventType: 'CUSTOM_EVENT', - committee: 'NONE', - signInPoints: 0, - signOutPoints: 0, - pointsPerHour: 0, - startTimeBuffer: 1200000, - endTimeBuffer: 1200000, - notificationSent: false, - general: false, - nationalConventionEligible: false, - }); - } - console.log(formData); - }, [event]); - - const handleChange = (e: React.ChangeEvent) => { - const { name, value, type } = e.target as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement; - const checked = type === 'checkbox' ? (e.target as HTMLInputElement).checked : false; - - setFormData((prev) => ({ - ...prev, - [name]: - type === 'checkbox' - ? checked - : name === 'startTimeBuffer' || name == 'endTimeBuffer' - ? parseInt(value) * 1000 * 60 - : value, - })); - }; - - function handleSubmit(e: React.FormEvent) { - e.preventDefault(); - - const startCombined = new Date(`${formData.startDate}T${formData.startTime}`); - const endCombined = new Date(`${formData.endDate}T${formData.endTime}`); - - const startTimeFirebase = Timestamp.fromDate(startCombined); - const endTimeFirebase = Timestamp.fromDate(endCombined); - - const submissionData = { - ...formData, - startTime: startTimeFirebase, - endTime: endTimeFirebase, - }; - - delete (submissionData as { startDate?: string }).startDate; - delete (submissionData as { endDate?: string }).endDate; - - console.log(submissionData); - } - - const modal = ( -
- - - {loading ? ( -
- - - ) : ( -
-
- {/* Name */} -
- - -
-
- - {/* Event Info */} -
-
- {/* Date */} - - - {/* Time */} - - - {/* Location */} - - - {/* Type */} - - - {/* Scope */} -
-

Event Scope

-
- - - - - -
-
-
- -
- {/* Points */} -
-

Points

- - - -
- - {/* Advanced */} -
-

Advanced Options

-
-
- -

- Allow to scan QRCode {formData.startTimeBuffer ? formData.startTimeBuffer / (1000 * 60) : 0} - mins before event starts -

-
- -
- -

- Allow to scan QRCode {formData.endTimeBuffer ? formData.endTimeBuffer / (1000 * 60) : 0} mins - after event starts -

-
- - - - -
-
-
-
- -
- {/* Description */} -