Skip to content

Frontend Feature - Admin Panel#245

Merged
Flapjacck merged 3 commits intomainfrom
fe-admin-panel
Mar 18, 2026
Merged

Frontend Feature - Admin Panel#245
Flapjacck merged 3 commits intomainfrom
fe-admin-panel

Conversation

@Raafay-Qureshi
Copy link
Contributor

@Raafay-Qureshi Raafay-Qureshi commented Mar 16, 2026

[FE] Admin Panel

Summary

Implements the admin panel navigation and team management features, including a reworked sidebar, add interviewers/interviewees forms with invite flow, roles/departments sourced from Admin Settings, and several backend permission and reliability fixes.

Features Implemented

Admin Navigation Bar (#169)

  • File: frontend/src/features/dashboard/components/Sidebar.tsx
  • Sidebar now shows admin-only items: Create Team, Team Management, Settings, Schedule Interviews
  • Schedule Interviews rendered as a distinct black button below Settings
  • Non-admin users see Dashboard and Manage Availability only

Add Team Members (#173)

  • File: frontend/src/features/admin/components/AddTeamMembers.tsx
  • Wrapper page with two sub-navigation tabs: Add Interviewers | Add Interviewees
  • Renders the corresponding form inline below the tabs

Add Interviewers (#171)

  • File: frontend/src/features/admin/components/AddInterviewers.tsx
  • Form: First Name, Last Name, Email, Department dropdown, Send Invite button
  • Department options loaded from GET /teams/:id/settings (set via Admin Settings)
  • Invite flow via POST /teams/:id/members/batch
  • Lists existing interviewers with remove support

Add Interviewees (#172)

  • File: frontend/src/features/admin/components/AddInterviewees.tsx
  • Form: First Name, Last Name, Email, Applying for Role dropdown, Send Invite button
  • Role options loaded from GET /teams/:id/settings (set via Admin Settings)
  • Uses POST /candidates for creation
  • Lists existing interviewees with status badges and remove support

Admin Settings — Roles & Departments Persistence

  • File: frontend/src/features/admin/components/AdminSettings.tsx
  • Save Changes now persists roles and departments to PUT /teams/:id/settings
  • On mount, loads saved roles/departments from API (falls back to defaults)
  • UI unchanged from original

Backend Changes

TeamSettings model — roles & departments fields

  • Added roles: string[] and departments: string[] fields to TeamSettings model and schema

TeamSettings validator

  • Added roles and departments to updateTeamSettingsSchema

updateTeamSettings controller

  • Handles saving roles/departments with markModified for Mongoose array change detection
  • Replaced requireAdminOfTeam (strict creator check) with req.user.role check from DB-sourced auth middleware

addTeamMembersBatch controller

  • Replaced requireAdminOfTeam with req.user.role check to fix 403s for non-creator admins

deleteCandidate controller

  • Cascade-deletes candidate availability records on removal
  • Returns 409 (instead of crashing with 500) when candidate has scheduled meetings

Auth client — automatic token refresh

  • authenticatedFetch now auto-refreshes the access token on 401 and retries the original request
  • Clears tokens and falls back gracefully if refresh fails

Modified Files

Frontend

  • frontend/src/features/dashboard/Dashboard.tsx
  • frontend/src/features/dashboard/components/Sidebar.tsx
  • frontend/src/features/dashboard/components/CalendarStats.tsx
  • frontend/src/features/dashboard/components/InterviewScheduleSection.tsx
  • frontend/src/features/admin/components/AdminSettings.tsx
  • frontend/src/features/admin/components/index.ts
  • frontend/src/features/auth/utils/authClient.ts

New Frontend Files

  • frontend/src/features/admin/components/AddTeamMembers.tsx
  • frontend/src/features/admin/components/AddInterviewers.tsx
  • frontend/src/features/admin/components/AddInterviewees.tsx

Backend

  • backend/src/models/teamSettings.ts
  • backend/src/validators/teamValidators.ts
  • backend/src/controllers/team/updateTeamSettings.ts
  • backend/src/controllers/team/addTeamMembersBatch.ts
  • backend/src/controllers/candidate/deleteCandidate.ts

Closes

Raafay-Qureshi and others added 2 commits March 16, 2026 15:02
…panel

- index.ts: Keep fe-admin-panel exports (AdminSettings, AddTeamMembers, AddInterviewers, AddInterviewees)
- Dashboard.tsx: Keep fe-admin-panel routing structure with renderPage() function
- Sidebar.tsx: Keep fe-admin-panel nav pattern with navBtn() helper

All 3 files now have the complete admin panel feature implementation with proper admin-only routing.
Copy link
Member

@Flapjacck Flapjacck left a comment

Choose a reason for hiding this comment

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

LGTM

@Flapjacck Flapjacck merged commit 6e8cb3f into main Mar 18, 2026
2 checks passed
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.

2 participants