polish: refine admin ui controls

This commit is contained in:
JetSprow
2026-05-01 00:58:46 +10:00
parent b8a7cab1af
commit 4dd2f9280f
30 changed files with 651 additions and 307 deletions

View File

@@ -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 ? "保存" : "创建"}