Skip to content

131 clinic management page features update to hi fi#137

Open
YKawesome wants to merge 19 commits intomainfrom
131-clinic-management-page-features-update-to-hi-fi
Open

131 clinic management page features update to hi fi#137
YKawesome wants to merge 19 commits intomainfrom
131-clinic-management-page-features-update-to-hi-fi

Conversation

@YKawesome
Copy link
Copy Markdown
Contributor

@YKawesome YKawesome commented Apr 10, 2026

Description

Updating the Clinic Management Page and related features to Hi-Fi.

Completed Flows

  • View Event — Updated to match Hi-Fi design; now pulls live data from the backend. Includes a volunteer list and has a spot for the email notification timeline, though this is part of a different issue.
  • Create Event — Fixed styling of the creation page and tabs; fixed responsiveness for overflow cases.
  • Edit Event — Full editing flow implemented using the PUT endpoint and an isEditing flag. Edit/delete buttons were added to the main EventManagement component. A visual edit mode icon indicates when editing is active, per the Figma.
  • Delete Event — Implemented with a confirmation modal to ensure the user intends to delete before proceeding.
  • Copy Link — Implemented copy link interaction on the event page, waiting 2 seconds per the spec in the Figma.
  • Confirmation Modal — Refactored into a reusable modal used across the delete (and edit cancel) flows so there isn't duplicate code :)

Routing

  • Added routing for UX so that users can use browser navigation to go back from pages.
  • Consolidated events/create/success route into events/:eventId to keep things consistent (especially with edit).
  • Added an edit sub-route via the navigation for the edit flow.
  • CreatedEvent now 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 attendees field has been removed from the PUT/POST endpoints for clinics; 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_roles table.

Screenshots/Media

Event Management Page

CleanShot 2026-04-18 at 02 24 06@2x

View Event

CleanShot 2026-04-18 at 02 24 48@2x

Create Event

CleanShot 2026-04-18 at 02 25 15@2x

Discard Changes

CleanShot 2026-04-18 at 02 25 29@2x CleanShot 2026-04-18 at 02 25 38@2x

Delete Event

CleanShot 2026-04-18 at 02 25 54@2x

Create Event

CleanShot 2026-04-18 at 02 26 14@2x

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

    • New events/:eventId view with volunteer list and email notification timeline; loads by ID or navigation state; delete uses reusable ConfirmDialog and returns to the list; copy event link with toast.
    • Reworked CreateEvent to use :tab and optional :eventId; prefill on edit; save via PUT /clinics/:id; success routes to events/:eventId.
    • Updated EventManagement with inline edit/delete and an edit icon; navigates to new routes; toaster now shows at top‑end.
  • Bug Fixes

    • Removed attendees from POST /clinics and PUT /clinics/:id to prevent unintended resets.
    • Fixed layout responsiveness and overflow; corrected create/edit page styling and tabs.

Written for commit c10e089. Summary will update on new commits.

@YKawesome YKawesome linked an issue Apr 10, 2026 that may be closed by this pull request
10 tasks
@alexespejo
Copy link
Copy Markdown
Member

@cubic

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Apr 15, 2026

@cubic

@alexespejo I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread server/routes/clinics.js
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)
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 15, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

const [eventData, setEventData] = useState(locationState?.eventData ?? null);

useEffect(() => {
if (eventData) return;
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 15, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

{ key: "email", label: "Email Notification Timeline" },
];

const activeTab = "details";
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 15, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

if (isEditing) {
const existingLangs = await backend.get(`/clinics/${clinicId}/languages`);
await Promise.all(
existingLangs.data.map((l) => backend.delete(`/clinics/${clinicId}/languages/${l.id}`))
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 15, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

>
{[type, capitalizeLocationType(locationType), ...languages.map((l) => (typeof l === "string" ? l : l.language))]
.filter(Boolean)
.map((tag) => (
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 15, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

@YKawesome YKawesome marked this pull request as ready for review April 18, 2026 09:29
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

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);
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 18, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

Comment thread client/src/App.tsx
<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 />} />
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 18, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

color="gray.600"
>
Showing {(page - 1) * PAGE_SIZE + 1} to{" "}
{Math.min(page * PAGE_SIZE, filtered.length)} of {filtered.length}
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 18, 2026

Choose a reason for hiding this comment

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

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>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clinic Management Page Features + Update to Hi-fi

3 participants