Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rise-dc-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import InstructionPage from "./pages/cookbook/InstructionPage";
import RecipeComplete from "./scheduling_components/pages/RecipeComplete";
import GroceryList from "./pages/cookbook/GroceryList";
import GroceryShopping from "./pages/cookbook/GroceryShopping";
import StaffHome from "./pages/StaffHome";
import EditParticipant from "./pages/EditParticipant";

function App() {
return (
Expand All @@ -37,6 +39,9 @@ function App() {
element={<RecipeComplete />}
/>
<Route path="/scheduler" element={<Scheduler />} />

<Route path="/staff-home" element={<StaffHome />} />
<Route path="/edit-participant" element={<EditParticipant />} />
</Routes>
</Router>
);
Expand Down
110 changes: 110 additions & 0 deletions rise-dc-app/src/pages/EditParticipant.tsx
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" };
};
Comment on lines +9 to +13
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unused steps parameter.

The addEvent function accepts an optional steps parameter (line 33), but it's never stored in the EventData type 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
In rise-dc-app/src/pages/EditParticipant.tsx around lines 9-13 and 29-34, remove
the unused optional steps parameter from the addEvent function signature and any
calls/places that pass or expect it; since EventData does not include steps,
simply delete the parameter, adjust the function signature and any invocations
accordingly, and run/typecheck to ensure there are no remaining references to
steps in this file.


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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix back button positioning and navigation target.

This section has the layout issue mentioned in the PR description. The justify-center class centers both the back button and header together, but the back button should be positioned to the left.

Additionally:

  • Line 77: Navigation goes to / instead of /staff-home, breaking the staff workflow
  • Line 82: Placeholder text [Name Here] needs to be replaced with actual participant data
  • Same invalid Tailwind classes as in StaffHome: pr-15, pl-15, max-w-100

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<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>
<div className="relative flex justify-center">
<div className={styles.backButton}>
<Box
component="img"
src={back}
alt="Back"
onClick={() => navigate("/staff-home")}
sx={{ position: 'absolute', left: 16, cursor: 'pointer' }}
/>
</div>
<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>
🤖 Prompt for AI Agents
In rise-dc-app/src/pages/EditParticipant.tsx around lines 71-84, the back button
and header are both centered (use layout classes so the back button sits left
and header centers), the back button navigation points to "/" instead of
"/staff-home", the header shows the placeholder "[Name Here]" instead of the
participant's actual name, and some invalid Tailwind classes are used (pr-15,
pl-15, max-w-100). Fix by changing the container to use a left/right layout
(e.g., replace justify-center with justify-between or split into two sibling
containers) so the back image stays left and the title is centered; update the
onClick navigate target to "/staff-home"; replace the placeholder with the
participant name from props/state (e.g., participant.name); and correct Tailwind
classes to valid utilities (e.g., use px-4 or pl-4/pr-4 and max-w-full or a
bracketed value like max-w-[100px]) so the layout renders correctly.


<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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Replace array index with stable key.

Using key={idx} is an anti-pattern that can cause rendering issues when the list is reordered (which happens on every addition due to sorting). React may incorrectly reuse component instances, leading to state bugs or performance issues.

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"
+              >
                 <EventCard

For a more robust solution, consider adding a unique id field to EventData (e.g., Date.now() or crypto.randomUUID()).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{events.map((event, idx) => (
<div key={idx} className="event-card-main">
<EventCard
name={event.name}
startTime={event.startTime}
endTime={event.endTime}
color={"#fffef2ff"}
/>
</div>
))}
{events.map((event) => (
<div
key={`${event.name}-${event.startTime.hour}-${event.startTime.minute}-${event.startTime.period}`}
className="event-card-main"
>
<EventCard
name={event.name}
startTime={event.startTime}
endTime={event.endTime}
color={"#fffef2ff"}
/>
</div>
))}
🤖 Prompt for AI Agents
In rise-dc-app/src/pages/EditParticipant.tsx around lines 87 to 96, the list is
using key={idx} which is unstable and causes rendering bugs when the events
array is sorted or changed; replace the index key with a stable unique key by
either (preferred) adding a unique id property to EventData at creation time
(e.g., use crypto.randomUUID() or Date.now() and persist that id on the event
object) and use event.id as the React key, or (short-term) derive a stable key
from event properties such as
`${event.startTime}-${event.endTime}-${event.name}` and use that as the key in
the map; ensure the id is generated where events are created/loaded so remounts
and reorders preserve component identity.

</div>

<EventSelectionModal
key={isModalOpen ? "custom" : "normal"}
isOpen={isModalOpen}
onClose={closePlanner}
onEventCreated={addEvent}
initialStep="SELECT_EVENT"
/>

</div>
</div>
);
}
22 changes: 22 additions & 0 deletions rise-dc-app/src/pages/StaffHome.tsx
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">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Clean up conflicting Tailwind utilities.

The class list includes both py-10 (which sets padding-top: 2.5rem) and pt-0 (which overrides it to 0). This redundancy reduces maintainability.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<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">
🤖 Prompt for AI Agents
In rise-dc-app/src/pages/StaffHome.tsx around line 4, the div class string
includes conflicting Tailwind utilities `py-10` and `pt-0`; remove the redundant
`pt-0` so the top/bottom padding from `py-10` remains consistent (update the
class list to exclude `pt-0`).


<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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix invalid Tailwind class names.

Several class names don't follow Tailwind's standard spacing scale or syntax:

  • pr-15 and pl-15 are not valid (standard scale ends at p-96 = 24rem)
  • max-w-100 is not a standard class
  • pointer-events-none on a static header label may be unintentional

If you need custom spacing, use arbitrary values with bracket notation (Tailwind v4 syntax):

  • pr-[15px] or pr-[3.75rem] instead of pr-15
  • max-w-[100px] instead of max-w-100

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<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>
<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>
🤖 Prompt for AI Agents
In rise-dc-app/src/pages/StaffHome.tsx around lines 6 to 8, replace the invalid
Tailwind classes: change pr-15 and pl-15 to arbitrary values (e.g. pr-[15px] and
pl-[15px] or pr-[3.75rem]/pl-[3.75rem] as needed), change max-w-100 to a valid
class such as max-w-[100px] or another appropriate max-w utility (e.g.
max-w-full), and remove or change pointer-events-none to pointer-events-auto (or
omit it) so the header label is interactive as intended.


<h1 className="pt-30 text-3xl">Choose a Participant</h1>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix invalid Tailwind spacing class.

pt-30 is not a valid Tailwind utility. The standard scale provides values from pt-0 to pt-96 (24rem). If you need 30 units of spacing, use arbitrary value syntax: pt-[30px] or pt-[7.5rem].

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<h1 className="pt-30 text-3xl">Choose a Participant</h1>
<h1 className="pt-[7.5rem] text-3xl">Choose a Participant</h1>
🤖 Prompt for AI Agents
In rise-dc-app/src/pages/StaffHome.tsx around line 10, the h1 uses an invalid
Tailwind class `pt-30`; replace it with a valid Tailwind spacing utility using
arbitrary value syntax (for example `pt-[30px]` or `pt-[7.5rem]`) so the element
receives the intended top padding; update the className string accordingly and
ensure the brackets are included exactly as Tailwind requires.


<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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add interactivity and accessibility to the participant selector.

The <select> element currently has no state management or change handler, making it non-functional. Additionally, it lacks accessibility attributes.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<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>
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>
<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>
);
}
🤖 Prompt for AI Agents
In rise-dc-app/src/pages/StaffHome.tsx around lines 12 to 17, the <select> is
static and missing state and accessibility; update it to be a controlled
component by adding local state for the selected participant, bind the select's
value to that state and add an onChange handler that updates state (and calls
any passed callback/dispatch). Replace hardcoded option elements with mapped
options from a participants array (with value attributes), keep a disabled
placeholder option as the default, and add accessibility attributes: an
associated <label> (or aria-label/aria-labelledby), a unique id on the select,
and any needed aria-required or aria-describedby for helper text; ensure
keyboard focus styling remains and validate/handle an empty selection in the
change handler.


</div>

);
}