mirror of
https://github.com/JetSprow/J-Board-Lite.git
synced 2026-05-01 01:14:10 +05:30
polish: refine admin ui controls
This commit is contained in:
@@ -6,6 +6,13 @@ import { PendingSubmitButton } from "@/components/shared/pending-submit-button";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -54,11 +61,11 @@ export function UserForm({
|
||||
<DialogTitle>{isEdit ? "编辑用户" : "创建用户"}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<form action={handleSubmit} className="space-y-5">
|
||||
<div>
|
||||
<div className="space-y-2">
|
||||
<Label>邮箱</Label>
|
||||
<Input name="email" type="email" defaultValue={user?.email} required />
|
||||
</div>
|
||||
<div>
|
||||
<div className="space-y-2">
|
||||
<Label>{isEdit ? "新密码(可留空)" : "密码"}</Label>
|
||||
<Input
|
||||
name="password"
|
||||
@@ -68,20 +75,24 @@ export function UserForm({
|
||||
placeholder={isEdit ? "留空则保持不变" : undefined}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div className="space-y-2">
|
||||
<Label>昵称</Label>
|
||||
<Input name="name" defaultValue={user?.name ?? ""} />
|
||||
</div>
|
||||
<div>
|
||||
<Label>角色</Label>
|
||||
<select
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="user-role">角色</Label>
|
||||
<Select
|
||||
name="role"
|
||||
defaultValue={user?.role ?? "USER"}
|
||||
className="h-10 w-full px-3 text-sm outline-none"
|
||||
>
|
||||
<option value="USER">普通用户</option>
|
||||
<option value="ADMIN">管理员</option>
|
||||
</select>
|
||||
<SelectTrigger id="user-role" className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent align="start">
|
||||
<SelectItem value="USER">普通用户</SelectItem>
|
||||
<SelectItem value="ADMIN">管理员</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<PendingSubmitButton className="w-full" pendingLabel={isEdit ? "保存中..." : "创建中..."}>
|
||||
{isEdit ? "保存" : "创建"}
|
||||
|
||||
Reference in New Issue
Block a user