-
Notifications
You must be signed in to change notification settings - Fork 2
Frontend mostly finished #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,110 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useState } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Box } from "@mui/material"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import back from "../scheduling_components/icon_components/back.png"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useNavigate } from "react-router-dom"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import styles from "../scheduling_components/PlanYourDay.module.css"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import EventSelectionModal from "../scheduling_components/EventSelectionModal"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import EventCard from "../scheduling_components/EventCard"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type EventData = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| startTime: { hour: number; minute: number; period: "AM" | "PM" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endTime: { hour: number; minute: number; period: "AM" | "PM" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default function EditParticipant() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [events, setEvents] = useState<EventData[]>([]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [isModalOpen, setIsModalOpen] = useState(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const navigate = useNavigate(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const openPlanner = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setIsModalOpen(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const closePlanner = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setIsModalOpen(false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const addEvent = (event: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| startTime: { hour: number; minute: number; period: "AM" | "PM" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endTime: { hour: number; minute: number; period: "AM" | "PM" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps?: any[]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setEvents((prev) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const newEvents = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...prev, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: event.name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| startTime: event.startTime, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endTime: event.endTime, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Sort by start time (from teammate's code) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| newEvents.sort((a, b) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const aHour24 = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| a.startTime.period === "PM" && a.startTime.hour !== 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? a.startTime.hour + 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : a.startTime.hour === 12 && a.startTime.period === "AM" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : a.startTime.hour; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const bHour24 = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| b.startTime.period === "PM" && b.startTime.hour !== 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? b.startTime.hour + 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : b.startTime.hour === 12 && b.startTime.period === "AM" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : b.startTime.hour; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (aHour24 !== bHour24) return aHour24 - bHour24; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return a.startTime.minute - b.startTime.minute; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return newEvents; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setIsModalOpen(false); // close modal after adding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div style={{ color: "black" }}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.container}></div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="mt-0 pt-0"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex justify-center"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.backButton}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Box | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| component="img" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src={back} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alt="Back" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => navigate("/")} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex max-w-100 text-center pt-3 pr-15 pb-4 pl-15 items-center justify-center bg-[#0C77D9] rounded-b-xl pointer-events-none"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p className="text-white font-light text-[1.2rem]">[Name Here]</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+71
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix back button positioning and navigation target. This section has the layout issue mentioned in the PR description. The Additionally:
Apply this diff to fix the layout: - <div className="flex justify-center">
+ <div className="relative flex justify-center">
<div className={styles.backButton}>
<Box
component="img"
src={back}
alt="Back"
- onClick={() => navigate("/")}
+ onClick={() => navigate("/staff-home")}
+ sx={{ position: 'absolute', left: 16, cursor: 'pointer' }}
/>
</div>
- <div className="flex max-w-100 text-center pt-3 pr-15 pb-4 pl-15 items-center justify-center bg-[#0C77D9] rounded-b-xl pointer-events-none">
+ <div className="flex max-w-[400px] text-center px-4 py-3 items-center justify-center bg-[#0C77D9] rounded-b-xl">
<p className="text-white font-light text-[1.2rem]">[Name Here]</p>
</div>
</div>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="events-container w-full flex flex-col items-center"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {events.map((event, idx) => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div key={idx} className="event-card-main"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <EventCard | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name={event.name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| startTime={event.startTime} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endTime={event.endTime} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color={"#fffef2ff"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ))} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+87
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace array index with stable key. Using Since events don't have unique IDs, use a combination of properties: - {events.map((event, idx) => (
- <div key={idx} className="event-card-main">
+ {events.map((event) => (
+ <div
+ key={`${event.name}-${event.startTime.hour}-${event.startTime.minute}-${event.startTime.period}`}
+ className="event-card-main"
+ >
<EventCardFor a more robust solution, consider adding a unique 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <EventSelectionModal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| key={isModalOpen ? "custom" : "normal"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isOpen={isModalOpen} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClose={closePlanner} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onEventCreated={addEvent} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialStep="SELECT_EVENT" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default function StaffHome() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-col py-10 items-center justify-center mt-0 pt-0"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clean up conflicting Tailwind utilities. The class list includes both Apply this diff to remove the conflict: - <div className="flex flex-col py-10 items-center justify-center mt-0 pt-0">
+ <div className="flex flex-col pb-10 items-center justify-center">📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex max-w-100 text-center pt-3 pr-15 pb-4 pl-15 items-center justify-center bg-[#0C77D9] rounded-b-xl pointer-events-none"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p className="text-white font-light text-[1.2rem]">Participants</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix invalid Tailwind class names. Several class names don't follow Tailwind's standard spacing scale or syntax:
If you need custom spacing, use arbitrary values with bracket notation (Tailwind v4 syntax):
Apply this diff to fix the syntax: - <div className="flex max-w-100 text-center pt-3 pr-15 pb-4 pl-15 items-center justify-center bg-[#0C77D9] rounded-b-xl pointer-events-none">
+ <div className="flex max-w-[400px] text-center px-4 py-3 items-center justify-center bg-[#0C77D9] rounded-b-xl">📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <h1 className="pt-30 text-3xl">Choose a Participant</h1> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix invalid Tailwind spacing class.
Apply this diff: - <h1 className="pt-30 text-3xl">Choose a Participant</h1>
+ <h1 className="pt-[7.5rem] text-3xl">Choose a Participant</h1>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <select className="w-[90%] max-w-md p-3 rounded-lg bg-white shadow-lg border border-gray-300 focus:outline-none mt-10"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <option>Select a participant</option> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <option>example 1</option> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <option>example 2</option> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <option>example 3</option> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </select> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add interactivity and accessibility to the participant selector. The Consider this implementation: +import { useState } from "react";
+
export default function StaffHome() {
+ const [selectedParticipant, setSelectedParticipant] = useState("");
+
return (
<div className="flex flex-col pb-10 items-center justify-center">
<div className="flex max-w-[400px] text-center px-4 py-3 items-center justify-center bg-[#0C77D9] rounded-b-xl">
<p className="text-white font-light text-[1.2rem]">Participants</p>
</div>
<h1 className="pt-[7.5rem] text-3xl">Choose a Participant</h1>
- <select className="w-[90%] max-w-md p-3 rounded-lg bg-white shadow-lg border border-gray-300 focus:outline-none mt-10">
- <option>Select a participant</option>
+ <label htmlFor="participant-select" className="sr-only">
+ Select a participant
+ </label>
+ <select
+ id="participant-select"
+ value={selectedParticipant}
+ onChange={(e) => setSelectedParticipant(e.target.value)}
+ className="w-[90%] max-w-md p-3 rounded-lg bg-white shadow-lg border border-gray-300 focus:outline-none mt-10"
+ >
+ <option value="" disabled>Select a participant</option>
<option>example 1</option>
<option>example 2</option>
<option>example 3</option>
</select>
</div>
);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused
stepsparameter.The
addEventfunction accepts an optionalstepsparameter (line 33), but it's never stored in theEventDatatype or used anywhere in the component. This creates unnecessary type complexity.Apply this diff:
const addEvent = (event: { name: string; startTime: { hour: number; minute: number; period: "AM" | "PM" }; endTime: { hour: number; minute: number; period: "AM" | "PM" }; - steps?: any[]; }) => {Also applies to: 29-34
🤖 Prompt for AI Agents