refactor: replace native select with shadcn Select for user role in admin
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
import { getAssetUrl } from "$lib/api";
|
import { getAssetUrl } from "$lib/api";
|
||||||
import { Button } from "$lib/components/ui/button";
|
import { Button } from "$lib/components/ui/button";
|
||||||
import { Input } from "$lib/components/ui/input";
|
import { Input } from "$lib/components/ui/input";
|
||||||
|
import { Select, SelectContent, SelectItem, SelectTrigger } from "$lib/components/ui/select";
|
||||||
import * as Dialog from "$lib/components/ui/dialog";
|
import * as Dialog from "$lib/components/ui/dialog";
|
||||||
import type { User } from "$lib/types";
|
import type { User } from "$lib/types";
|
||||||
|
|
||||||
@@ -147,16 +148,21 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-3 text-muted-foreground">{user.email}</td>
|
<td class="px-4 py-3 text-muted-foreground">{user.email}</td>
|
||||||
<td class="px-4 py-3">
|
<td class="px-4 py-3">
|
||||||
<select
|
<Select
|
||||||
class="rounded border border-border/40 bg-background px-2 py-1 text-xs disabled:opacity-50"
|
type="single"
|
||||||
value={user.role}
|
value={user.role}
|
||||||
disabled={user.id === currentUserId || updatingId === user.id}
|
disabled={user.id === currentUserId || updatingId === user.id}
|
||||||
onchange={(e) => changeUserRole(user, (e.target as HTMLSelectElement).value)}
|
onValueChange={(v) => v && changeUserRole(user, v)}
|
||||||
>
|
>
|
||||||
<option value="viewer">Viewer</option>
|
<SelectTrigger class="w-24 h-7 text-xs">
|
||||||
<option value="model">Model</option>
|
{user.role}
|
||||||
<option value="admin">Admin</option>
|
</SelectTrigger>
|
||||||
</select>
|
<SelectContent>
|
||||||
|
<SelectItem value="viewer">Viewer</SelectItem>
|
||||||
|
<SelectItem value="model">Model</SelectItem>
|
||||||
|
<SelectItem value="admin">Admin</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-3 text-muted-foreground">{formatDate(user.date_created)}</td>
|
<td class="px-4 py-3 text-muted-foreground">{formatDate(user.date_created)}</td>
|
||||||
<td class="px-4 py-3 text-right">
|
<td class="px-4 py-3 text-right">
|
||||||
|
|||||||
Reference in New Issue
Block a user