Skip to content

Commit b95a1c5

Browse files
committed
fix(admin): surface password reset status outside the actions menu
1 parent 585a040 commit b95a1c5

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/settings/components/admin

apps/sim/app/workspace/[workspaceId]/settings/components/admin/admin.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,6 @@ export function Admin() {
230230
impersonatingUserId,
231231
])
232232

233-
/** Confirms the send on the menu item itself, since nothing about the user row changes. */
234-
const resetPasswordLabel = (userId: string) => {
235-
if (sendPasswordReset.variables?.userId !== userId) return 'Reset password'
236-
if (sendPasswordReset.isPending) return 'Sending...'
237-
if (sendPasswordReset.isSuccess) return 'Reset sent'
238-
return 'Reset password'
239-
}
240-
241233
const renderUserRow = (u: AdminUser) => (
242234
<div key={u.id} className='flex items-center gap-3 px-3 py-2 text-small'>
243235
<span className='w-[170px] truncate text-[var(--text-primary)]'>{u.name || '—'}</span>
@@ -267,7 +259,7 @@ export function Admin() {
267259
label={`Actions for ${u.email}`}
268260
actions={[
269261
{
270-
label: resetPasswordLabel(u.id),
262+
label: 'Reset password',
271263
onSelect: () => {
272264
setProvisionWarning(null)
273265
sendPasswordReset.reset()
@@ -438,6 +430,15 @@ export function Admin() {
438430
<p className='text-[var(--text-error)] text-small'>{provisionWarning}</p>
439431
)}
440432

433+
{sendPasswordReset.variables &&
434+
(sendPasswordReset.isPending || sendPasswordReset.isSuccess) && (
435+
<p className='text-[var(--text-secondary)] text-small'>
436+
{sendPasswordReset.isPending
437+
? `Sending a password reset email to ${sendPasswordReset.variables.email}...`
438+
: `Password reset email sent to ${sendPasswordReset.variables.email}.`}
439+
</p>
440+
)}
441+
441442
{searchQuery.length > 0 && usersData ? (
442443
<>
443444
<div className='flex flex-col gap-0.5'>

0 commit comments

Comments
 (0)