-
- {u.name || '—'}
- {u.email}
-
- {u.role || 'user'}
-
-
- {u.banned ? Banned : Active}
-
-
- {u.id !== session?.user?.id && (
- <>
-
-
-
- {u.banned ? (
-
- ) : (
-
- )}
- >
- )}
-
-
- {banUserId === u.id && !u.banned && (
-
-
setBanReason(e.target.value)}
- placeholder='Reason (optional)'
- className='flex-1'
- />
-
)
@@ -424,21 +405,10 @@ export function Admin() {
)}
- {(setUserRole.error ||
- banUser.error ||
- unbanUser.error ||
- impersonateUser.error ||
- sendPasswordReset.error ||
- impersonationGuardError) && (
+ {(unbanUser.error || impersonateUser.error || impersonationGuardError) && (
{impersonationGuardError ||
- (
- setUserRole.error ||
- banUser.error ||
- unbanUser.error ||
- impersonateUser.error ||
- sendPasswordReset.error
- )?.message ||
+ (unbanUser.error || impersonateUser.error)?.message ||
'Action failed. Please try again.'}
)}
@@ -447,6 +417,12 @@ export function Admin() {
{provisionWarning}
)}
+ {sendPasswordReset.isPending && sendPasswordReset.variables && (
+
+ Sending a password reset email to {sendPasswordReset.variables.email}...
+
+ )}
+
{searchQuery.length > 0 && usersData ? (
<>
@@ -503,6 +479,67 @@ export function Admin() {
)}
+
{
+ if (!open) closePendingAction()
+ }}
+ srTitle='Ban user'
+ title='Ban user'
+ text={[
+ 'Banning ',
+ { text: pendingUser?.email ?? 'this user', bold: true },
+ ' ',
+ {
+ text: 'signs them out everywhere and blocks them from signing back in.',
+ error: true,
+ },
+ ' You can unban them later.',
+ ]}
+ confirm={{
+ label: 'Ban',
+ onClick: handleConfirmBan,
+ pending: banUser.isPending,
+ pendingLabel: 'Banning...',
+ }}
+ >
+
+ {banUser.error?.message}
+
+
+
{
+ if (!open) closePendingAction()
+ }}
+ srTitle={isDemotion ? 'Demote user' : 'Promote user'}
+ title={isDemotion ? 'Demote user' : 'Promote user'}
+ text={[
+ isDemotion ? 'Demoting ' : 'Promoting ',
+ { text: pendingUser?.email ?? 'this user', bold: true },
+ ' ',
+ isDemotion
+ ? { text: 'revokes their platform admin access.', error: true }
+ : 'grants full platform admin access, including impersonating any user.',
+ ]}
+ confirm={{
+ label: isDemotion ? 'Demote' : 'Promote',
+ onClick: handleConfirmRoleChange,
+ variant: isDemotion ? 'destructive' : 'primary',
+ pending: setUserRole.isPending,
+ pendingLabel: isDemotion ? 'Demoting...' : 'Promoting...',
+ }}
+ >
+ {setUserRole.error?.message}
+
+