[V2 200pts] Add admin user management actions — deactivate, reactivate, and KYC status update#394
Open
olaleyeolajide81-sketch wants to merge 1 commit into
Conversation
|
@olaleyeolajide81-sketch is attempting to deploy a commit to the Emmanuel Dorcas' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@olaleyeolajide81-sketch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Hello! This PR targets |
Contributor
|
Hello! This PR targets |
Author
|
Please approve workflow and merge PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds admin user management actions to the user detail panel, including account deactivation/reactivation and KYC status updates, as specified in issue #254.
Changes Made
1. API Functions in lib/api/admin.ts
Added three new API functions for user management:
/admin/users/{id}/deactivate/admin/users/{id}/reactivate/admin/users/{id}/kycwith kycStatus in bodyThese functions use the existing apiClient and follow the same error handling patterns as other admin API calls.
2. User Detail Panel Enhancements (components/admin/UserDetailPanel.tsx)
State Management
Added new state variables:
showDeactivateConfirm/showReactivateConfirm- Confirmation dialog visibilityshowKycConfirm- KYC status change confirmationpendingKycStatus- Tracks the pending KYC status changeactionLoading- Loading state during API callsactionError- Error message displayAction Handlers
handleDeactivate()/confirmDeactivate()- Deactivate user accounthandleReactivate()/confirmReactivate()- Reactivate user accounthandleKycToggle()/confirmKycChange()- Update KYC statusAll handlers include:
UI Components
Account Status Section
KYC Verification Section
Confirmation Dialogs
Three new confirmation dialogs with consistent UX:
Deactivate Confirmation
Reactivate Confirmation
KYC Status Change Confirmation
All dialogs:
3. Import Updates
Added new Lucide React icons:
Power- For activate/deactivate actionsShieldCheck- For mark as verified actionShieldX- For mark as unverified actionMoreVerticalimportTesting
Build Verification
npm run lint- No errors, no warningsnpm run build- Successful production buildManual Testing Scenarios
The implementation supports the following user flows:
Deactivate User
Reactivate User
Update KYC Status
Backend Integration
The API endpoints used in this implementation need to be confirmed with the backend team:
POST /admin/users/{id}/deactivate- Deactivate user accountPOST /admin/users/{id}/reactivate- Reactivate user accountPATCH /admin/users/{id}/kyc- Update KYC status (body:{ kycStatus: "Verified" | "Unverified" })If the backend endpoints differ, the API functions in
lib/api/admin.tscan be easily updated to match the actual backend implementation.Audit Trail
The issue mentions displaying an audit trail if the backend returns
lastModifiedByor audit log fields. The currentAdminUserinterface does not include these fields. Once the backend confirms the audit trail data structure, this can be added to:AdminUserinterface inlib/api/admin.tsmapAdminUserfunction to normalize the dataAccessibility & UX
Related Issue
Closes #254