Skip to content

Unify coach requests list and patch actions in Notifications#64

Open
sahilkashyap64 wants to merge 4 commits into
mainfrom
codex/refactor-coach-requests-api-endpoints-63qcsi
Open

Unify coach requests list and patch actions in Notifications#64
sahilkashyap64 wants to merge 4 commits into
mainfrom
codex/refactor-coach-requests-api-endpoints-63qcsi

Conversation

@sahilkashyap64
Copy link
Copy Markdown
Collaborator

Motivation

  • Replace fragmented lesson/roster action APIs with a single, supported backend contract (GET /api/coach/requests + PATCH /api/coach/requests/:type/:id) so notification UI uses one list + one action endpoint.
  • Provide per-card loading state, optimistic updates, clear error messages, and pagination to match the updated API behavior and UX requirements.

Description

  • Added getCoachRequests and patchCoachRequest service helpers and exported them from src/services/coach.js to centralize requests listing and patching, including support for API-provided actions.endpoint and fallback URL resolution.
  • Reworked notifications UI in src/components/notifications/NotificationsPage.jsx to load a mixed list of lesson_request and roster_request items, add per-card expand/collapse details, wire lesson actions to confirm/decline and roster actions to approve/decline, add per-card action loading state, optimistic removal on action, rollback and toast error handling, and page/perPage pagination + reload controls.
  • Added frontend typedefs in src/types/coachRequests.js for CoachRequestItem, LessonRequestPayload, RosterRequestPayload, and RequestAction to document the new shapes used by the UI.
  • Kept visual layout and existing components intact while only changing data wiring and action behavior.

Testing

  • Ran the test suite with npm test and all unit tests passed (1..5, 5 passed).
  • Built the production bundle with npm run build and the build completed successfully.

Codex Task

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 27, 2026

Deploy Preview for thunderous-muffin-603a62 ready!

Name Link
🔨 Latest commit 57f4773
🔍 Latest deploy log https://app.netlify.com/projects/thunderous-muffin-603a62/deploys/69a1f0447120ed00084b32f0
😎 Deploy Preview https://deploy-preview-64--thunderous-muffin-603a62.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 27, 2026

PR Preview Action v1.6.2

🚀 View preview at
https://CodeMyMobile.github.io/TTP_Coach_Web_Public/pr-preview/pr-64/

Built to branch gh-pages at 2026-02-27 19:28 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant