Skip to content

Commit dbde6e6

Browse files
committed
fix(admin): resolve type errors in admin tab
- Fix cn import path to @/lib/core/utils/cn - Use valid Badge variants (blue/gray/red/green instead of secondary/destructive) - Type setRole param as 'user' | 'admin' union
1 parent c2cc5c4 commit dbde6e6

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useMemo, useState } from 'react'
44
import { useParams } from 'next/navigation'
55
import { Badge, Button, Input as EmcnInput, Label, Skeleton, Switch } from '@/components/emcn'
66
import { useSession } from '@/lib/auth/auth-client'
7-
import { cn } from '@/lib/utils'
7+
import { cn } from '@/lib/core/utils/cn'
88
import {
99
useAdminUsers,
1010
useBanUser,
@@ -177,15 +177,13 @@ export function Admin() {
177177
</span>
178178
<span className='flex-1 truncate text-[var(--text-secondary)]'>{u.email}</span>
179179
<span className='w-[80px]'>
180-
<Badge variant={u.role === 'admin' ? 'default' : 'secondary'}>
181-
{u.role || 'user'}
182-
</Badge>
180+
<Badge variant={u.role === 'admin' ? 'blue' : 'gray'}>{u.role || 'user'}</Badge>
183181
</span>
184182
<span className='w-[80px]'>
185183
{u.banned ? (
186-
<Badge variant='destructive'>Banned</Badge>
184+
<Badge variant='red'>Banned</Badge>
187185
) : (
188-
<Badge variant='secondary'>Active</Badge>
186+
<Badge variant='green'>Active</Badge>
189187
)}
190188
</span>
191189
<span className='flex w-[180px] justify-end gap-[4px]'>

apps/sim/hooks/queries/admin-users.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function useAdminUsers(offset: number, limit: number, enabled: boolean) {
5959
export function useSetUserRole() {
6060
const queryClient = useQueryClient()
6161
return useMutation({
62-
mutationFn: async ({ userId, role }: { userId: string; role: string }) => {
62+
mutationFn: async ({ userId, role }: { userId: string; role: 'user' | 'admin' }) => {
6363
const result = await client.admin.setRole({ userId, role })
6464
return result
6565
},

0 commit comments

Comments
 (0)