fix: no default role, placeholder for role dropdown

This commit is contained in:
root 2026-05-27 12:01:45 +00:00
parent cee5acab1d
commit fd3f738b9f
1 changed files with 10 additions and 3 deletions

View File

@ -70,9 +70,16 @@ function RoleDropdown({ value, onChange }) {
<button
type="button"
onClick={() => setOpen((v) => !v)}
className="flex w-full h-[46px] items-center justify-between gap-2 rounded-2xl border border-[var(--color-border)] bg-[var(--color-surface-strong)] px-4 text-sm transition hover:border-[var(--color-accent)]"
className={[
'flex w-full h-[46px] items-center justify-between gap-2 rounded-2xl border px-4 text-sm transition hover:border-[var(--color-accent)]',
value ? 'border-[var(--color-border)] bg-[var(--color-surface-strong)]' : 'border-[var(--color-border)] bg-[var(--color-surface-strong)]',
].join(' ')}
>
<Badge tone={ROLE_TONES[value] || 'neutral'}>{ROLE_LABELS[value] || value}</Badge>
{value ? (
<Badge tone={ROLE_TONES[value] || 'neutral'}>{ROLE_LABELS[value]}</Badge>
) : (
<span className="text-[var(--color-text-muted)]">Выберите роль</span>
)}
<span className="text-[var(--color-text-muted)] text-xs"></span>
</button>
{open && (
@ -102,7 +109,7 @@ function RoleDropdown({ value, onChange }) {
/* ── Add-user modal ── */
function AddUserModal({ onSubmit, onClose, submitting, error }) {
const [form, setForm] = useState({ name: '', email: '', role: 'manager' });
const [form, setForm] = useState({ name: '', email: '', role: '' });
const nameRef = useRef(null);
useEffect(() => { nameRef.current?.focus(); }, []);