131 clinic management page features update to hi fi#137
131 clinic management page features update to hi fi#137
Conversation
|
@alexespejo I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
5 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="client/src/components/eventManagement/CreatedEvent.jsx">
<violation number="1" location="client/src/components/eventManagement/CreatedEvent.jsx:24">
P1: Stale `eventData` can persist across `eventId` changes, causing displayed event details to diverge from actions that use current route params.</violation>
<violation number="2" location="client/src/components/eventManagement/CreatedEvent.jsx:101">
P2: Tabs are non-functional because active tab is hardcoded and never updated by user interaction.</violation>
<violation number="3" location="client/src/components/eventManagement/CreatedEvent.jsx:203">
P3: `key={tag}` is not guaranteed unique for this list and can cause React reconciliation issues when duplicate tag values exist.</violation>
</file>
<file name="server/routes/clinics.js">
<violation number="1" location="server/routes/clinics.js:50">
P1: `attendees` is no longer maintained by clinic/registration writes, but UI still reads it, causing stale registration counts.</violation>
</file>
<file name="client/src/components/eventManagement/createEvent.jsx">
<violation number="1" location="client/src/components/eventManagement/createEvent.jsx:189">
P2: Edit-mode language update is non-atomic and can drop existing language associations on partial failure.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const clinic = await db.query( | ||
| `INSERT INTO clinics (name, description, start_time, end_time, date, attendees, min_attendees, capacity, max_target_roles, parking, address, city, state, zip, meeting_link, location_type, type) | ||
| VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17) RETURNING *`, | ||
| `INSERT INTO clinics (name, description, start_time, end_time, date, min_attendees, capacity, max_target_roles, parking, address, city, state, zip, meeting_link, location_type, type) |
There was a problem hiding this comment.
P1: attendees is no longer maintained by clinic/registration writes, but UI still reads it, causing stale registration counts.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At server/routes/clinics.js, line 50:
<comment>`attendees` is no longer maintained by clinic/registration writes, but UI still reads it, causing stale registration counts.</comment>
<file context>
@@ -48,15 +47,14 @@ clinicsRouter.post("/", async (req, res) => {
const clinic = await db.query(
- `INSERT INTO clinics (name, description, start_time, end_time, date, attendees, min_attendees, capacity, max_target_roles, parking, address, city, state, zip, meeting_link, location_type, type)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17) RETURNING *`,
+ `INSERT INTO clinics (name, description, start_time, end_time, date, min_attendees, capacity, max_target_roles, parking, address, city, state, zip, meeting_link, location_type, type)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING *`,
[
</file context>
| const [eventData, setEventData] = useState(locationState?.eventData ?? null); | ||
|
|
||
| useEffect(() => { | ||
| if (eventData) return; |
There was a problem hiding this comment.
P1: Stale eventData can persist across eventId changes, causing displayed event details to diverge from actions that use current route params.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/components/eventManagement/CreatedEvent.jsx, line 24:
<comment>Stale `eventData` can persist across `eventId` changes, causing displayed event details to diverge from actions that use current route params.</comment>
<file context>
@@ -0,0 +1,375 @@
+ const [eventData, setEventData] = useState(locationState?.eventData ?? null);
+
+ useEffect(() => {
+ if (eventData) return;
+ const fetch = async () => {
+ try {
</file context>
| { key: "email", label: "Email Notification Timeline" }, | ||
| ]; | ||
|
|
||
| const activeTab = "details"; |
There was a problem hiding this comment.
P2: Tabs are non-functional because active tab is hardcoded and never updated by user interaction.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/components/eventManagement/CreatedEvent.jsx, line 101:
<comment>Tabs are non-functional because active tab is hardcoded and never updated by user interaction.</comment>
<file context>
@@ -0,0 +1,375 @@
+ { key: "email", label: "Email Notification Timeline" },
+ ];
+
+ const activeTab = "details";
+
+ return (
</file context>
| if (isEditing) { | ||
| const existingLangs = await backend.get(`/clinics/${clinicId}/languages`); | ||
| await Promise.all( | ||
| existingLangs.data.map((l) => backend.delete(`/clinics/${clinicId}/languages/${l.id}`)) |
There was a problem hiding this comment.
P2: Edit-mode language update is non-atomic and can drop existing language associations on partial failure.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/components/eventManagement/createEvent.jsx, line 189:
<comment>Edit-mode language update is non-atomic and can drop existing language associations on partial failure.</comment>
<file context>
@@ -119,9 +168,27 @@ export const CreateEvent = ({ onClose, onCreated }) => {
+ if (isEditing) {
+ const existingLangs = await backend.get(`/clinics/${clinicId}/languages`);
+ await Promise.all(
+ existingLangs.data.map((l) => backend.delete(`/clinics/${clinicId}/languages/${l.id}`))
+ );
+ }
</file context>
| > | ||
| {[type, capitalizeLocationType(locationType), ...languages.map((l) => (typeof l === "string" ? l : l.language))] | ||
| .filter(Boolean) | ||
| .map((tag) => ( |
There was a problem hiding this comment.
P3: key={tag} is not guaranteed unique for this list and can cause React reconciliation issues when duplicate tag values exist.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/components/eventManagement/CreatedEvent.jsx, line 203:
<comment>`key={tag}` is not guaranteed unique for this list and can cause React reconciliation issues when duplicate tag values exist.</comment>
<file context>
@@ -0,0 +1,375 @@
+ >
+ {[type, capitalizeLocationType(locationType), ...languages.map((l) => (typeof l === "string" ? l : l.language))]
+ .filter(Boolean)
+ .map((tag) => (
+ <Tag.Root
+ key={tag}
</file context>
There was a problem hiding this comment.
3 issues found across 13 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="client/src/components/eventManagement/CreatedEvent.jsx">
<violation number="1" location="client/src/components/eventManagement/CreatedEvent.jsx:343">
P2: Handle clipboard write failures before showing the “Link copied” state; currently users can get a false success message when copy is denied.</violation>
</file>
<file name="client/src/components/eventManagement/EventVolunteerList.jsx">
<violation number="1" location="client/src/components/eventManagement/EventVolunteerList.jsx:329">
P3: Pagination summary uses total items instead of totalPages as required by the project rule.</violation>
</file>
<file name="client/src/App.tsx">
<violation number="1" location="client/src/App.tsx:124">
P2: Missing `/events/:eventId/edit` route/redirect means base edit URLs fall through to the catch-all 404 instead of opening the edit page.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| color="gray.600" | ||
| size="md" | ||
| onClick={() => { | ||
| navigator.clipboard.writeText(window.location.href); |
There was a problem hiding this comment.
P2: Handle clipboard write failures before showing the “Link copied” state; currently users can get a false success message when copy is denied.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/components/eventManagement/CreatedEvent.jsx, line 343:
<comment>Handle clipboard write failures before showing the “Link copied” state; currently users can get a false success message when copy is denied.</comment>
<file context>
@@ -0,0 +1,482 @@
+ color="gray.600"
+ size="md"
+ onClick={() => {
+ navigator.clipboard.writeText(window.location.href);
+ setLinkCopied(true);
+ setTimeout(() => setLinkCopied(false), 2000);
</file context>
| <Route path="/events/:eventId" element={<CreatedEvent />} /> | ||
| <Route path="/events/create" element={<Navigate to="/events/create/header" replace />} /> | ||
| <Route path="/events/create/:tab" element={<CreateEvent />} /> | ||
| <Route path="/events/:eventId/edit/:tab" element={<CreateEvent />} /> |
There was a problem hiding this comment.
P2: Missing /events/:eventId/edit route/redirect means base edit URLs fall through to the catch-all 404 instead of opening the edit page.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/App.tsx, line 124:
<comment>Missing `/events/:eventId/edit` route/redirect means base edit URLs fall through to the catch-all 404 instead of opening the edit page.</comment>
<file context>
@@ -116,10 +118,10 @@ const App = () => {
+ <Route path="/events/:eventId" element={<CreatedEvent />} />
+ <Route path="/events/create" element={<Navigate to="/events/create/header" replace />} />
+ <Route path="/events/create/:tab" element={<CreateEvent />} />
+ <Route path="/events/:eventId/edit/:tab" element={<CreateEvent />} />
</Route>
</file context>
| color="gray.600" | ||
| > | ||
| Showing {(page - 1) * PAGE_SIZE + 1} to{" "} | ||
| {Math.min(page * PAGE_SIZE, filtered.length)} of {filtered.length} |
There was a problem hiding this comment.
P3: Pagination summary uses total items instead of totalPages as required by the project rule.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/components/eventManagement/EventVolunteerList.jsx, line 329:
<comment>Pagination summary uses total items instead of totalPages as required by the project rule.</comment>
<file context>
@@ -0,0 +1,380 @@
+ color="gray.600"
+ >
+ Showing {(page - 1) * PAGE_SIZE + 1} to{" "}
+ {Math.min(page * PAGE_SIZE, filtered.length)} of {filtered.length}
+ </Text>
+ <HStack gap={1}>
</file context>
Description
Updating the Clinic Management Page and related features to Hi-Fi.
Completed Flows
isEditingflag. Edit/delete buttons were added to the mainEventManagementcomponent. A visual edit mode icon indicates when editing is active, per the Figma.Routing
events/create/successroute intoevents/:eventIdto keep things consistent (especially with edit).editsub-route via the navigation for the edit flow.CreatedEventnow pulls data from the backend unless we just created it.Important
The duplicate flow was not completed. The duplicate icon on the Event Management screen was mistakenly interpreted as a trash/delete icon. The icon needs to be changed to correctly represent duplication before this flow can be implemented—we were also confused about how this connects to the email notification system.
Warning
The
attendeesfield has been removed from the PUT/POST endpoints forclinics; it shouldn't be touched externally and defaults to 0.Note
Role was intentionally not implemented (similar to how Language was handled). Josh confirmed we should leave it for now; it would otherwise require wiring up the
clinics_rolestable.Screenshots/Media
Event Management Page
View Event
Create Event
Discard Changes
Delete Event
Create Event
Issues
Closes #131
Summary by cubic
Upgrades Events/Clinic Management to hi‑fi with route‑driven create, view, edit, and delete. Adds a hi‑fi event view with volunteers and email timeline, backend load/save, safer deletes, and copy‑link (addresses Linear 131).
New Features
events/:eventIdview with volunteer list and email notification timeline; loads by ID or navigation state; delete uses reusableConfirmDialogand returns to the list; copy event link with toast.CreateEventto use:taband optional:eventId; prefill on edit; save viaPUT /clinics/:id; success routes toevents/:eventId.EventManagementwith inline edit/delete and an edit icon; navigates to new routes; toaster now shows at top‑end.Bug Fixes
attendeesfromPOST /clinicsandPUT /clinics/:idto prevent unintended resets.Written for commit c10e089. Summary will update on new commits.