import { PASSWORD_MIN_LENGTH, SystemRole } from "@capakraken/shared"; import { InfoTooltip } from "~/components/ui/InfoTooltip.js"; const SYSTEM_ROLE_LABELS: Record = { [SystemRole.ADMIN]: "Admin", [SystemRole.MANAGER]: "Manager", [SystemRole.CONTROLLER]: "Controller", [SystemRole.USER]: "User", [SystemRole.VIEWER]: "Viewer", }; export type CreateState = { name: string; email: string; password: string; systemRole: SystemRole; }; type UserCreateModalProps = { state: CreateState; actionError: string | null; isPending: boolean; createPending: boolean; onChange: (state: CreateState) => void; onSubmit: () => void; onClose: () => void; }; export function UserCreateModal({ state, actionError, isPending, createPending, onChange, onSubmit, onClose, }: UserCreateModalProps) { return (

Create User

{actionError && (
{actionError}
)}
onChange({ ...state, name: e.target.value })} placeholder="Max Mustermann" className="border border-gray-300 dark:border-gray-600 rounded-lg px-3 py-2 text-sm w-full bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-brand-400" />
onChange({ ...state, email: e.target.value })} placeholder="user@example.com" className="border border-gray-300 dark:border-gray-600 rounded-lg px-3 py-2 text-sm w-full bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-brand-400" />
onChange({ ...state, password: e.target.value })} placeholder="Min. 8 characters" className="border border-gray-300 dark:border-gray-600 rounded-lg px-3 py-2 text-sm w-full bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-brand-400" autoComplete="new-password" />
); }