import type { Employee, Role, Workspace } from "../../services/api"; import { AppFormDialog, dialogPrimaryButtonClass, dialogSecondaryButtonClass, } from "~/components/common/AppFormDialog"; import { Button } from "~/components/ui/button"; import { Input } from "~/components/ui/input"; import { CreateUserProjectField } from "./CreateUserProjectField"; import { formFieldClass, formInputClass, modalFormClass, } from "../platform/modalUi"; export type UserFormState = { username: string; display_name: string; email: string; role_code: "admin" | "developer"; password: string; status: "active" | "disabled" | "locked"; }; const FORM_INPUT_CLASS = "h-[39px] w-full rounded-md border border-[#d6e0e9] bg-white px-[11px] text-xs text-[#283a4e] outline-none focus:border-[#5b9ddb] focus:ring-3 focus:ring-brand/10 disabled:cursor-not-allowed disabled:opacity-50"; export function UserFormDialog({ open, editing, form, saving, currentUserId, roles, createRoleOptions, createProjects, createProjectsLoading, selectedWorkspaceIds, onChangeForm, onToggleWorkspace, onSubmit, onClose, }: { open: boolean; editing: Employee | null; form: UserFormState; saving: boolean; currentUserId: string | undefined; roles: Role[]; createRoleOptions: Role[]; createProjects: Workspace[]; createProjectsLoading: boolean; selectedWorkspaceIds: string[]; onChangeForm: (next: UserFormState) => void; onToggleWorkspace: (workspaceId: string) => void; onSubmit: (event: React.FormEvent) => void; onClose: () => void; }) { return ( { if (!nextOpen) onClose(); }} eyebrow="EMPLOYEE" title={editing ? "编辑用户" : "添加用户"} >
{!editing && ( )} {!editing && ( )} {editing && ( )}
); }