Skip to content

Issue #49: Users Management Page #147

@wumibals

Description

@wumibals

Labels: frontend admin users
Area: frontend/app/(auth)/admin/users/UsersClient.tsx, frontend/app/(auth)/admin/users/page.tsx
Difficulty: Advanced

Description

The users management page lets privileged admins manage all admin users in the system. It shows 4 stat cards (total, active, inactive, roles distribution), a filterable user table, and supports inline role changes and account status toggles. Access is filtered by role — SUPER_ADMIN sees all users; other roles cannot see SUPER_ADMIN accounts.

Acceptance Criteria

  • Create frontend/app/(auth)/admin/users/page.tsx (server component, metadata: { title: "Users" }, renders <UsersPage />)
  • Create frontend/app/(auth)/admin/users/UsersClient.tsx as a "use client" component
  • Restrict access to SUPER_ADMIN, ADMIN, MANAGER via <RoleProtectedPage>
  • Fetch users via TanStack Query (adminApi.getUsers())
  • Filter displayed users: if the current user is not SUPER_ADMIN, exclude users with role SUPER_ADMIN from the displayed list
  • Render 4 stat cards: Total Users, Active, Inactive, Admin Count (ADMIN + SUPER_ADMIN)
  • Render "Add User" button (visible only to SUPER_ADMIN, links to /admin/users/new)
  • Render <UserTable> supporting:
    • Toggle active/inactive status (inline mutation)
    • Change role (dropdown mutation)
    • Neither action applies to SUPER_ADMIN accounts
  • Show loading skeleton and error state

Technical Notes

  • UserTable is pre-built in @/components/admin/users/UserTable
  • Read current role from useAuthStore to determine filtering and button visibility
  • On successful mutation, invalidate the users query

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions