From 178533a409c546ef07c8c8c3911ab9724631fcf7 Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sat, 6 Jul 2024 12:30:54 -0400 Subject: [PATCH 01/80] added eventLocation and eventDate fields --- app/admin/rush/page.tsx | 9 ++++- components/admin/rush/EventModal.tsx | 53 ++++++++++++++++++++++------ utils/date.ts | 26 ++++++++------ 3 files changed, 66 insertions(+), 22 deletions(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index fdb59cb..5236a51 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -13,10 +13,13 @@ import Link from "next/link"; import "react-datepicker/dist/react-datepicker.css"; import EventModal from "@/components/admin/rush/EventModal"; import Timestamp from "react-timestamp"; +import { addTwoHours } from "@/utils/date"; export interface EventFormData { eventName: string, eventCode: string, + eventLocation: string, + eventDate: Date, eventDeadline: Date, eventId?: string, } @@ -24,7 +27,9 @@ export interface EventFormData { const initialValues: EventFormData = { eventName: "", eventCode: "", - eventDeadline: new Date(), + eventLocation: "", + eventDate: new Date(), + eventDeadline: addTwoHours(new Date()), }; export default function RushEvents() { @@ -196,6 +201,8 @@ export default function RushEvents() { categoryId: selectedRushCategory?._id, name: eventFormData.eventName, code: eventCodeTrimmed, + location: eventFormData.eventLocation, + date: eventFormData.eventDate.toISOString(), deadline: eventFormData.eventDeadline.toISOString(), ...(modifying && { eventId: eventFormData.eventId }) }) diff --git a/components/admin/rush/EventModal.tsx b/components/admin/rush/EventModal.tsx index 4dc753b..d2c8168 100644 --- a/components/admin/rush/EventModal.tsx +++ b/components/admin/rush/EventModal.tsx @@ -1,5 +1,6 @@ import { EventFormData } from "@/app/admin/rush/page"; import { RushCategory } from "@/types/admin/events"; +import { addTwoHours } from "@/utils/date"; import { Button, Label, Modal, TextInput } from "flowbite-react"; import DatePicker from "react-datepicker"; @@ -29,19 +30,19 @@ export default function EventModal({

- {modifyingEvent ? `Modify Event` : `Create an Event for "${selectedRushCategory?.name}"` } + {modifyingEvent ? `Modify Event` : `Create an Event for "${selectedRushCategory?.name}"`}

- setEventFormData({...eventFormData, eventName: e.target.value})} + onChange={(e) => setEventFormData({ ...eventFormData, eventName: e.target.value })} />
@@ -49,36 +50,68 @@ export default function EventModal({
- setEventFormData({...eventFormData, eventCode: e.target.value})} + onChange={(e) => setEventFormData({ ...eventFormData, eventCode: e.target.value })} />
-
+ setEventFormData({ ...eventFormData, eventLocation: e.target.value })} + /> +
+
+
+
+ + setEventFormData({ ...eventFormData, eventDate: date, eventDeadline: addTwoHours(date) }) + } + showTimeSelect + isClearable + timeFormat="HH:mm" + timeIntervals={15} + dateFormat="MMMM d, yyyy h:mm aa" + className="w-full bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-purple-500 focus:border-purple-500 block p-2.5" + wrapperClassName="w-full" + /> +
+
+
+
setEventFormData({...eventFormData, eventDeadline: date})} + onChange={(date: Date) => setEventFormData({ ...eventFormData, eventDeadline: date })} showTimeSelect isClearable timeFormat="HH:mm" timeIntervals={15} dateFormat="MMMM d, yyyy h:mm aa" className="w-full bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-purple-500 focus:border-purple-500 block p-2.5" - wrapperClassName="w-full" // Add a custom class to make it full width + wrapperClassName="w-full" />
-
diff --git a/utils/date.ts b/utils/date.ts index d0f4399..5fedc7b 100644 --- a/utils/date.ts +++ b/utils/date.ts @@ -1,16 +1,20 @@ export const formatMongoDate = (dateString: string): string => { - const date = new Date(dateString); + const date = new Date(dateString); - const year = date.getFullYear(); - const month = `0${date.getMonth() + 1}`.slice(-2); - const day = `0${date.getDate()}`.slice(-2); + const year = date.getFullYear(); + const month = `0${date.getMonth() + 1}`.slice(-2); + const day = `0${date.getDate()}`.slice(-2); - let hours = date.getHours(); - const ampm = hours >= 12 ? 'PM' : 'AM'; - hours = hours % 12; - hours = hours ? hours : 12; // the hour '0' should be '12' + let hours = date.getHours(); + const ampm = hours >= 12 ? 'PM' : 'AM'; + hours = hours % 12; + hours = hours ? hours : 12; // the hour '0' should be '12' - const minutes = `0${date.getMinutes()}`.slice(-2); + const minutes = `0${date.getMinutes()}`.slice(-2); - return `${year}.${month}.${day} (${hours}:${minutes} ${ampm})`; -}; \ No newline at end of file + return `${year}.${month}.${day} (${hours}:${minutes} ${ampm})`; +}; + +export const addTwoHours = (date: Date): Date => { + return new Date(date.getTime() + 2 * 60 * 60 * 1000); +} \ No newline at end of file From 9dde104031794800d4907942f11afc1abbd2d612 Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sat, 6 Jul 2024 13:08:23 -0400 Subject: [PATCH 02/80] fixed location and date useEffect --- app/admin/rush/page.tsx | 4 +++- types/admin/events.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index 5236a51..98513c5 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -153,7 +153,9 @@ export default function RushEvents() { onClick={() => { setEventFormData({ eventName: event.name, - eventCode: event.code, + eventCode: event.code, + eventLocation: event.location, + eventDate: new Date(event.date), eventDeadline: new Date(event.deadline), eventId: event.eventId, }); diff --git a/types/admin/events.ts b/types/admin/events.ts index 6329286..135666e 100644 --- a/types/admin/events.ts +++ b/types/admin/events.ts @@ -27,6 +27,8 @@ export interface RushEvent { dateCreated: string; lastModified: string; code: string; + location: string; + date: string; deadline: string; } From f4ae6aa3c37d6ce74fddc3c0bb0a584c3ebe6982 Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sat, 6 Jul 2024 13:30:35 -0400 Subject: [PATCH 03/80] added frontend validation for event upload/modify --- app/admin/rush/page.tsx | 4 ---- components/admin/rush/EventModal.tsx | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index 98513c5..2dbbe89 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -118,10 +118,6 @@ export default function RushEvents() {

{event.name}

- {/*

- Created: - -

*/}

Last Modified: diff --git a/components/admin/rush/EventModal.tsx b/components/admin/rush/EventModal.tsx index d2c8168..a699d23 100644 --- a/components/admin/rush/EventModal.tsx +++ b/components/admin/rush/EventModal.tsx @@ -78,8 +78,12 @@ export default function EventModal({

- setEventFormData({ ...eventFormData, eventDate: date, eventDeadline: addTwoHours(date) }) + onChange={(date: Date) => + setEventFormData({ + ...eventFormData, + eventDate: date, + ...(date && { eventDeadline: addTwoHours(date) }) + }) } showTimeSelect isClearable @@ -109,7 +113,13 @@ export default function EventModal({
From 6675543ed3d5f8bf7d4522df9b73f5c0bb05ed71 Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sat, 6 Jul 2024 18:18:30 -0400 Subject: [PATCH 04/80] added SettingsModal --- app/admin/rush/layout.tsx | 2 +- app/admin/rush/page.tsx | 28 +++++++-- components/admin/rush/EventModal.tsx | 17 +++--- components/admin/rush/SettingsModal.tsx | 78 +++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 13 deletions(-) create mode 100644 components/admin/rush/SettingsModal.tsx diff --git a/app/admin/rush/layout.tsx b/app/admin/rush/layout.tsx index 356a5e4..743fd2b 100644 --- a/app/admin/rush/layout.tsx +++ b/app/admin/rush/layout.tsx @@ -2,7 +2,7 @@ import '../../globals.css' import type { Metadata } from 'next' export const metadata: Metadata = { - title: 'Whyphi - QR', + title: 'Whyphi - Rush', } export default function RootLayout({ diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index 2dbbe89..01b71d3 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -3,7 +3,7 @@ import React, { useState, useEffect } from "react"; import { useAuth } from "@/app/contexts/AuthContext"; import Loader from "@/components/Loader"; -import { Button, Accordion, Avatar, Modal, TextInput, Label, Tooltip, Card } from "flowbite-react"; +import { Button, Accordion, Avatar, Modal, TextInput, Label, Tooltip, Card, ButtonGroup } from "flowbite-react"; import { HiPlus } from "react-icons/hi"; import { FaRegCopy } from 'react-icons/fa'; import CreateDrawer from "@/components/admin/rush/CreateDrawer"; @@ -14,6 +14,8 @@ import "react-datepicker/dist/react-datepicker.css"; import EventModal from "@/components/admin/rush/EventModal"; import Timestamp from "react-timestamp"; import { addTwoHours } from "@/utils/date"; +import { TbSettings } from "react-icons/tb"; +import SettingsModal from "@/components/admin/rush/SettingsModal"; export interface EventFormData { eventName: string, @@ -49,6 +51,10 @@ export default function RushEvents() { const [openDeleteEventModal, setOpenDeleteEventModal] = useState(false); const [selectedEventToDelete, setSelectedEventToDelete] = useState(null); const [toDeleteEventNameInput, setToDeleteEventNameInput] = useState(""); + + // States managing the settings modal + const [openSettingsModal, setOpenSettingsModal] = useState(false); + const [defaultRushCategoryId, setDefaultRushCategoryId] = useState(null); const [rushCategoriesCodeToggled, setRushCategoriesCodeToggled] = useState>({}); @@ -241,12 +247,16 @@ export default function RushEvents() {

Rush Events

-
{/* Container for buttons */} - -
+ +
{rushCategories.map((data: RushCategory, index) => ( @@ -293,6 +303,16 @@ export default function RushEvents() { modifyingEvent /> + {/* Custom Settings Component Modal */} + setOpenSettingsModal(false)} + onSubmit={() => {}} + /> + + {/* Custom Delete Event Component Modal */} diff --git a/components/admin/rush/EventModal.tsx b/components/admin/rush/EventModal.tsx index a699d23..ef32b5e 100644 --- a/components/admin/rush/EventModal.tsx +++ b/components/admin/rush/EventModal.tsx @@ -78,11 +78,11 @@ export default function EventModal({
+ onChange={(date: Date) => setEventFormData({ - ...eventFormData, - eventDate: date, - ...(date && { eventDeadline: addTwoHours(date) }) + ...eventFormData, + eventDate: date, + ...(date && { eventDeadline: addTwoHours(date) }) }) } showTimeSelect @@ -114,13 +114,14 @@ export default function EventModal({
diff --git a/components/admin/rush/SettingsModal.tsx b/components/admin/rush/SettingsModal.tsx new file mode 100644 index 0000000..4cac471 --- /dev/null +++ b/components/admin/rush/SettingsModal.tsx @@ -0,0 +1,78 @@ +import { EventFormData } from "@/app/admin/rush/page"; +import { RushCategory } from "@/types/admin/events"; +import { addTwoHours } from "@/utils/date"; +import { Button, Dropdown, Label, Modal, TextInput } from "flowbite-react"; +import { useState } from "react"; +import DatePicker from "react-datepicker"; + +interface SettingsModalProps { + showModal: boolean, + defaultRushCategoryId: string | null, + rushCategories: RushCategory[], + onClose: () => void, + onSubmit: () => void, +} + +// SettingsModal: used to select/update the defaultRushCategoryId (TODO: delete rushCategories here too) +export default function SettingsModal({ + showModal, + defaultRushCategoryId, + rushCategories, + onClose, + onSubmit, +}: SettingsModalProps) { + const [localDefaultRushCategoryId, setLocalDefaultRushCategoryId] = useState(defaultRushCategoryId); + + const categories = rushCategories.map((category) => { + return { label: category.name, value: category._id } + }); + + const getRushCategoryById = (categoryId: string | null): string => { + const category = rushCategories.find((category) => category._id === categoryId); + if (category) { + return category.name; + } else { + return "None"; + } + } + + return ( + + + +
+

+ Rush Settings +

+ +
+
+
+ + setLocalDefaultRushCategoryId(null)}> + None + + + {categories.map((category) => ( + setLocalDefaultRushCategoryId(category.value)}> + {category.label} + + ))} + +
+ +
+ +
+
+
+
+ ) +} \ No newline at end of file From 824f97e2be12f7a8f33ce9db8c9ada351177b7bd Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sun, 7 Jul 2024 11:44:21 -0400 Subject: [PATCH 05/80] added ability to update defaultRushCategory from settings --- app/admin/rush/page.tsx | 52 +++++++++++++++++-------- components/admin/rush/CreateDrawer.tsx | 5 ++- components/admin/rush/SettingsModal.tsx | 9 ++--- types/admin/events.ts | 1 + 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index 01b71d3..829597f 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -51,7 +51,7 @@ export default function RushEvents() { const [openDeleteEventModal, setOpenDeleteEventModal] = useState(false); const [selectedEventToDelete, setSelectedEventToDelete] = useState(null); const [toDeleteEventNameInput, setToDeleteEventNameInput] = useState(""); - + // States managing the settings modal const [openSettingsModal, setOpenSettingsModal] = useState(false); const [defaultRushCategoryId, setDefaultRushCategoryId] = useState(null); @@ -67,7 +67,7 @@ export default function RushEvents() { setCopied(true); setTimeout(() => setCopied(false), 2000); // Reset copied state after 2 seconds }; - + useEffect(() => { // Fetch all rush categories and events from the API fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/events/rush/`, { @@ -98,7 +98,7 @@ export default function RushEvents() { setOpenCreateEventModal(false); setEventFormData(initialValues); } - + function onCloseModifyEventModal() { setOpenModifyEventModal(false); setEventFormData(initialValues); @@ -150,18 +150,18 @@ export default function RushEvents() {
- { - setEventFormData({ - eventName: event.name, + onClick={() => { + setEventFormData({ + eventName: event.name, eventCode: event.code, eventLocation: event.location, eventDate: new Date(event.date), eventDeadline: new Date(event.deadline), eventId: event.eventId, - }); - setOpenModifyEventModal(true); + }); + setOpenModifyEventModal(true); }} /> ) => { @@ -201,9 +201,9 @@ export default function RushEvents() { Authorization: `Bearer ${token}`, "Content-Type": "application/json", }, - body: JSON.stringify({ - categoryId: selectedRushCategory?._id, - name: eventFormData.eventName, + body: JSON.stringify({ + categoryId: selectedRushCategory?._id, + name: eventFormData.eventName, code: eventCodeTrimmed, location: eventFormData.eventLocation, date: eventFormData.eventDate.toISOString(), @@ -241,6 +241,26 @@ export default function RushEvents() { } } + // handleRusheeEvent : by default creates a rush event + const handleUpdateSettings = async (defaultRushCategoryId: string | null) => { + try { + const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/events/rush/settings/${defaultRushCategoryId}`, { + method: "PATCH", + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/json", + }, + }) + if (!response.ok) { + throw new Error(response.statusText); + } + window.location.reload(); + } catch (error) { + // TODO: handle error + console.error(error); + } + } + if (isLoading) return ; return ( @@ -284,7 +304,7 @@ export default function RushEvents() { {isDrawerOpen && } {/* Custom Create/Modify Event Component Modal */} - handleRusheeEvent()} /> - - setOpenSettingsModal(false)} - onSubmit={() => {}} + onSubmit={(defaultRushCategoryId) => handleUpdateSettings(defaultRushCategoryId)} /> {/* Custom Delete Event Component Modal */} diff --git a/components/admin/rush/CreateDrawer.tsx b/components/admin/rush/CreateDrawer.tsx index 26fa0da..2568c91 100644 --- a/components/admin/rush/CreateDrawer.tsx +++ b/components/admin/rush/CreateDrawer.tsx @@ -39,7 +39,10 @@ const CreateDrawer: React.FC = ({ onClose }) => { Authorization: `Bearer ${token}`, "Content-Type": "application/json", }, - body: JSON.stringify({ name: categoryName }) + body: JSON.stringify({ + name: categoryName, + defaultRushCategory: false + }) }) if (!response.ok) { throw new Error(response.statusText); diff --git a/components/admin/rush/SettingsModal.tsx b/components/admin/rush/SettingsModal.tsx index 4cac471..78476dc 100644 --- a/components/admin/rush/SettingsModal.tsx +++ b/components/admin/rush/SettingsModal.tsx @@ -1,16 +1,13 @@ -import { EventFormData } from "@/app/admin/rush/page"; import { RushCategory } from "@/types/admin/events"; -import { addTwoHours } from "@/utils/date"; -import { Button, Dropdown, Label, Modal, TextInput } from "flowbite-react"; +import { Button, Dropdown, Label, Modal } from "flowbite-react"; import { useState } from "react"; -import DatePicker from "react-datepicker"; interface SettingsModalProps { showModal: boolean, defaultRushCategoryId: string | null, rushCategories: RushCategory[], onClose: () => void, - onSubmit: () => void, + onSubmit: (defaultRushCategoryId: string | null) => Promise, } // SettingsModal: used to select/update the defaultRushCategoryId (TODO: delete rushCategories here too) @@ -66,7 +63,7 @@ export default function SettingsModal({
diff --git a/types/admin/events.ts b/types/admin/events.ts index 135666e..17ff24f 100644 --- a/types/admin/events.ts +++ b/types/admin/events.ts @@ -36,6 +36,7 @@ export interface RushCategory { _id: string; dateCreated: string; name: string; + defaultRushCategory: boolean; events: RushEvent[] } From 750900f858cc1487df12dce442c03d55ff0c11e3 Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sun, 7 Jul 2024 13:14:43 -0400 Subject: [PATCH 06/80] added default rush category label --- app/admin/rush/page.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index 829597f..ec50806 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -76,7 +76,7 @@ export default function RushEvents() { }, }) .then((res) => res.json()) - .then((data) => { + .then((data: RushCategory[]) => { // Create a new object with the categories and false as their initial code toggle status const categoriesCodeToggled = data.reduce((acc: Record, category: RushCategory) => { acc[category._id] = false; @@ -87,13 +87,16 @@ export default function RushEvents() { setRushCategories(data); setRushCategoriesCodeToggled(categoriesCodeToggled); + // set defaultRushCategoryId + const defaultRushCategory = data.find((category) => category.defaultRushCategory); + setDefaultRushCategoryId(defaultRushCategory?._id ?? null) + // Stop the loading spinner setIsLoading(false); }) .catch((err) => console.error(err)); }, [token]); - function onCloseCreateEventModal() { setOpenCreateEventModal(false); setEventFormData(initialValues); @@ -281,9 +284,16 @@ export default function RushEvents() {
{rushCategories.map((data: RushCategory, index) => ( - + - {data.name} +
+
{data.name}
+ {data.defaultRushCategory && ( +
+ (default) +
+ )} +
From b1ceac55ea936899d3dbfcf9a9fc44df32cc67b5 Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sun, 7 Jul 2024 13:43:27 -0400 Subject: [PATCH 07/80] fixed UI for rush events (still needs some styling updates) --- app/admin/rush/page.tsx | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index ec50806..46d939a 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -125,15 +125,42 @@ export default function RushEvents() {
-
+

{event.name}

+

+ Created: + +

Last Modified: - + +

+
+

+ Event Date: +

Deadline: - + +

+

+ Location: +

+ {event.location} +

From d8a2dfa340890c275911466c7b464e77aa0400dd Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sun, 7 Jul 2024 23:52:24 -0400 Subject: [PATCH 08/80] updated frontend to pass "" for defaultRushCategoryId --- app/admin/rush/page.tsx | 11 +++++++---- components/admin/rush/SettingsModal.tsx | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index 46d939a..71834b1 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -54,7 +54,7 @@ export default function RushEvents() { // States managing the settings modal const [openSettingsModal, setOpenSettingsModal] = useState(false); - const [defaultRushCategoryId, setDefaultRushCategoryId] = useState(null); + const [defaultRushCategoryId, setDefaultRushCategoryId] = useState(""); const [rushCategoriesCodeToggled, setRushCategoriesCodeToggled] = useState>({}); @@ -89,7 +89,7 @@ export default function RushEvents() { // set defaultRushCategoryId const defaultRushCategory = data.find((category) => category.defaultRushCategory); - setDefaultRushCategoryId(defaultRushCategory?._id ?? null) + setDefaultRushCategoryId(defaultRushCategory?._id ?? "") // Stop the loading spinner setIsLoading(false); @@ -272,14 +272,17 @@ export default function RushEvents() { } // handleRusheeEvent : by default creates a rush event - const handleUpdateSettings = async (defaultRushCategoryId: string | null) => { + const handleUpdateSettings = async (defaultRushCategoryId: string) => { try { - const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/events/rush/settings/${defaultRushCategoryId}`, { + const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/events/rush/settings`, { method: "PATCH", headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", }, + body: JSON.stringify({ + defaultRushCategoryId: defaultRushCategoryId + }) }) if (!response.ok) { throw new Error(response.statusText); diff --git a/components/admin/rush/SettingsModal.tsx b/components/admin/rush/SettingsModal.tsx index 78476dc..a2bf03d 100644 --- a/components/admin/rush/SettingsModal.tsx +++ b/components/admin/rush/SettingsModal.tsx @@ -4,10 +4,10 @@ import { useState } from "react"; interface SettingsModalProps { showModal: boolean, - defaultRushCategoryId: string | null, + defaultRushCategoryId: string, rushCategories: RushCategory[], onClose: () => void, - onSubmit: (defaultRushCategoryId: string | null) => Promise, + onSubmit: (defaultRushCategoryId: string) => Promise, } // SettingsModal: used to select/update the defaultRushCategoryId (TODO: delete rushCategories here too) @@ -48,7 +48,7 @@ export default function SettingsModal({ *
- setLocalDefaultRushCategoryId(null)}> + setLocalDefaultRushCategoryId("")}> None From fcdad4b3a723e6353ef4a4e44116d132aeba8dd2 Mon Sep 17 00:00:00 2001 From: William De Rocco <93288641+wderocco8@users.noreply.github.com> Date: Sun, 7 Jul 2024 23:58:39 -0400 Subject: [PATCH 09/80] commented out extra fields in EventRow --- app/admin/rush/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/rush/page.tsx b/app/admin/rush/page.tsx index 71834b1..c69388a 100644 --- a/app/admin/rush/page.tsx +++ b/app/admin/rush/page.tsx @@ -127,7 +127,7 @@ export default function RushEvents() {

{event.name}

-

+ {/*

Created:

-
+
*/}

Event Date: Date: Sun, 14 Jul 2024 18:30:38 -0400 Subject: [PATCH 10/80] basic image cropping in place for Rush Event creation --- components/admin/rush/CreateDrawer.tsx | 10 +- components/admin/rush/EventModal.tsx | 11 +- components/admin/rush/Image/CanvasPreview.tsx | 65 ++++++ components/admin/rush/Image/CropImage.tsx | 191 ++++++++++++++++++ package-lock.json | 9 + package.json | 1 + utils/useDebounceEffect.tsx | 17 ++ 7 files changed, 296 insertions(+), 8 deletions(-) create mode 100644 components/admin/rush/Image/CanvasPreview.tsx create mode 100644 components/admin/rush/Image/CropImage.tsx create mode 100644 utils/useDebounceEffect.tsx diff --git a/components/admin/rush/CreateDrawer.tsx b/components/admin/rush/CreateDrawer.tsx index 2568c91..aae78ec 100644 --- a/components/admin/rush/CreateDrawer.tsx +++ b/components/admin/rush/CreateDrawer.tsx @@ -1,11 +1,9 @@ "use client" import React, { useState, useEffect } from 'react'; -import { HiOutlineUserGroup, HiOutlinePlus, HiOutlineX } from "react-icons/hi"; -import { Label, TextInput, Button, Select, Badge } from 'flowbite-react'; +import { HiOutlineUserGroup } from "react-icons/hi"; +import { Label, TextInput, Button } from 'flowbite-react'; import { useAuth } from "@/app/contexts/AuthContext"; -import { Timeframe } from "@/types/admin/events"; -import { Spinner } from 'flowbite-react'; interface CreateDrawerProps { onClose: () => void; // Prop for close button click handler @@ -54,9 +52,7 @@ const CreateDrawer: React.FC = ({ onClose }) => { console.error(error); } } - - - + return (

+
@@ -45,6 +47,13 @@ export default function EventModal({ onChange={(e) => setEventFormData({ ...eventFormData, eventName: e.target.value })} />
+
+
+
+ +