Skip to content

finished hook implementation#220

Merged
SamNie2027 merged 7 commits intomainfrom
applications-hooks
Apr 13, 2026
Merged

finished hook implementation#220
SamNie2027 merged 7 commits intomainfrom
applications-hooks

Conversation

@ostepan8
Copy link
Copy Markdown

ℹ️ Issue

Closes #201

📝 Description

added a react hook to fetch all applications from the backend api and display them in the admin dashboard table instead of hardcoded mock data

1 added getApplications and getApplicants methods to the api client so the frontend can call both endpoints
2 created a useApplications hook that fetches applications and applicants in parallel then merges them by app id to get names and dates alongside application data
3 updated the application table component to accept real data as props instead of using a hardcoded array
4 wired the hook into the root container so the dashboard cards show live counts and the table renders actual database records
5 added a hooks path alias to vite config and tsconfig
6 fixed the app spec test that was checking for a welcome message that no longer exists
7 wrote 18 tests covering the hook and table component including loading states error handling filtering and data merging

✔️ Verification

1 started the backend with nx serve backend and frontend with nx serve frontend
2 confirmed both api endpoints return data by curling localhost 3000 api applications and localhost 3000 api applicants
3 opened localhost 4200 in the browser and verified the table shows real application rows with names dates disciplines and statuses from the database
4 ran nx test frontend and confirmed all 20 tests pass across 3 test files
5 ran nx lint frontend and confirmed zero lint errors
6 tested search filtering in the table and confirmed it filters by name email discipline and status

🏕️ (Optional) Future Work / Notes

right now the backend sends back every application in one go which is fine for now but will definitely start to lag once we have a lot more data in there so down the line we should look into adding pagination on the server side

also the frontend is making two separate api calls to get applications and applicants then stitching them together which works but its an extra round trip we could avoid if the backend just joined those tables before sending the response

one other thing i noticed is that the discipline admin name column from the original design doesnt actually have any data backing it yet so i swapped it out for applicant type for now until we get that relationship set up on the backend

@SamNie2027
Copy link
Copy Markdown
Collaborator

Please resolve your conflicts

@SamNie2027
Copy link
Copy Markdown
Collaborator

Can you also resolve your merge conflicts?

@SamNie2027 SamNie2027 self-requested a review March 30, 2026 22:29
Comment thread apps/frontend/src/containers/root.tsx Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a frontend data-fetching hook and wires it into the Admin dashboard so the “Recent Applications” table renders backend-driven application data (instead of hardcoded mocks), alongside new path aliases and updated tests.

Changes:

  • Added getApplications() to the frontend API client and introduced a useApplications hook to load applications for the Admin dashboard.
  • Refactored ApplicationTable to accept applications as props, added date formatting, and expanded filtering to include email.
  • Added @hooks path alias support (Vite + TS) and updated/added unit tests for the hook/table.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
apps/frontend/vite.config.ts Adds @hooks alias for Vite module resolution.
apps/frontend/tsconfig.json Adds @hooks/* path mapping for TypeScript builds/tests.
apps/frontend/src/hooks/useApplications.ts Introduces useApplications hook and ApplicationRow mapping.
apps/frontend/src/hooks/useApplications.test.ts Adds unit tests for the new hook’s loading/success/error flows.
apps/frontend/src/containers/AdminLanding.tsx Wires useApplications into the Admin dashboard and passes data into the table.
apps/frontend/src/components/ApplicationTable.tsx Switches table to props-driven rendering, adds date formatting + email filtering.
apps/frontend/src/components/ApplicationTable.test.tsx Adds unit tests for table rendering, filtering, and date formatting.
apps/frontend/src/app.spec.tsx Updates assertion to match the current dashboard heading text.
apps/frontend/src/api/apiClient.ts Adds getApplications() API client method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/frontend/src/hooks/useApplications.ts Outdated
Comment thread apps/frontend/src/hooks/useApplications.ts
Comment thread apps/frontend/src/api/apiClient.ts
Comment thread apps/frontend/src/hooks/useApplications.ts
Comment thread apps/frontend/src/containers/AdminLanding.tsx
@SamNie2027
Copy link
Copy Markdown
Collaborator

Also, use the status pills component

@SamNie2027
Copy link
Copy Markdown
Collaborator

Can you merge main in
And also I notice you get the applicants from the users list without filtering out by usertype first - maybe make a new endpoint in the backend that does JUST by usertype = standard and get that list. Right now the users includes admins too.

@SamNie2027 SamNie2027 self-requested a review April 12, 2026 18:03
@SamNie2027 SamNie2027 merged commit 05d1c85 into main Apr 13, 2026
5 checks passed
@SamNie2027 SamNie2027 deleted the applications-hooks branch April 13, 2026 00:41
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.

Create hook to get all applications and insert into props for Admin view table

3 participants