Skip to content

Feat/admin dashboard (WIP)#57

Open
conradangwz wants to merge 16 commits into
mainfrom
feat/admin-dashboard
Open

Feat/admin dashboard (WIP)#57
conradangwz wants to merge 16 commits into
mainfrom
feat/admin-dashboard

Conversation

@conradangwz

@conradangwz conradangwz commented May 24, 2026

Copy link
Copy Markdown
Contributor

📑 Description

Adds an admin dashboard for managing members and contact form responses. The dashboard includes admin-only navigation, searchable/sortable tables, view/edit modals, delete confirmation flows, and backend CRUD routes for users and contact responses.

This also updates server/src/index.ts to handle the MongoDB SRV querySrv ECONNREFUSED issue by retrying with the standard Atlas connection string when SRV DNS lookup fails.

✏️ Summary of Changes

  • Added admin dashboard route/page and sidebar navigation.
  • Added members and contact responses dashboard sections.
  • Added reusable TanStack-powered DataTable with search, sorting, pagination, loading, empty, and error states.
  • Added member table columns, response table columns, and responsive card views for smaller screens.
  • Added view/edit modals for members and responses.
  • Added save/edit/delete functionality for members and responses.
  • Added typed delete confirmation before destructive actions.
  • Added safeguards to prevent admins from deleting/demoting themselves or removing the last admin.
  • Added client API helpers for users and contact responses.
  • Added/updated backend user and contact response admin routes/controllers.
  • Updated header/app routing so admins can access the dashboard.
  • Updated Mongo connection logic in server/src/index.ts to fall back from SRV to standard connection on SRV lookup failures such as ECONNREFUSED.

📸 Screenshots

image image image

❗️ For the reviewer

  • Admin access is enforced via AdminRoute on the frontend and adminGuard on protected backend routes.
  • The dashboard currently supports two sections: members and responses.
  • Member delete/demotion has backend protection for:
    • self-delete
    • self-demotion
    • deleting/demoting the last admin
  • server/src/index.ts was made more robust, as I ran into the same ECONNREFUSED error; the previous fix would choose one connection method before connecting, which meant that if it did fail in runtime, it would just exit. While this new logic means that even if srv fails at runtime, there is a fallback connection that can be tried there and then.

Next steps

  • Clean up code style across the admin dashboard files.
  • Extract repeated modal/button/table styling into reusable components or a consistent Tailwind pattern.
  • Reduce large className strings where practical.
  • Review naming/formatting consistency across admin components.

✅ Ready?

  • Added documentation/updated README to reflect changes (if necessary)
  • Added in-code documentation (wherever needed)
  • Wrote tests for new components/features
  • Branch and PR title adheres to naming conventions
  • Self-reviewed pr

@conradangwz conradangwz added the feature New feature being worked on label May 24, 2026

@RLee64 RLee64 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update! Do you know what sort of module you'd like to use to implement the actual display? I've heard Tanstack Table is pretty popular, although the recent security breach is a bit concerning.

@conradangwz conradangwz requested a review from RLee64 June 1, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature being worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants