feat: add-user modal dialog — compact, centered, backdrop
This commit is contained in:
parent
696f275567
commit
e04485c446
|
|
@ -206,33 +206,47 @@ export default function UserManagementPanel() {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Add form */}
|
{/* Add user modal */}
|
||||||
{showAddForm && (
|
{showAddForm && (
|
||||||
<form onSubmit={handleAddUser} className="mb-4 rounded-2xl border border-[var(--color-border)] bg-[var(--color-surface-strong)] p-4 space-y-3">
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm" onClick={() => { setShowAddForm(false); setAddError(null); }}>
|
||||||
<Input
|
<div className="w-[340px] rounded-[28px] border border-[var(--color-border)] bg-[var(--color-surface)] p-6 shadow-soft" onClick={(e) => e.stopPropagation()}>
|
||||||
placeholder="Имя"
|
<h3 className="mb-4 text-base font-semibold">Новый пользователь</h3>
|
||||||
value={addForm.name}
|
<form onSubmit={handleAddUser} className="space-y-3">
|
||||||
onChange={(e) => setAddForm((f) => ({ ...f, name: e.target.value }))}
|
<Input
|
||||||
/>
|
placeholder="Имя"
|
||||||
<Input
|
value={addForm.name}
|
||||||
placeholder="Email"
|
onChange={(e) => setAddForm((f) => ({ ...f, name: e.target.value }))}
|
||||||
type="email"
|
/>
|
||||||
value={addForm.email}
|
<Input
|
||||||
onChange={(e) => setAddForm((f) => ({ ...f, email: e.target.value }))}
|
placeholder="Email"
|
||||||
/>
|
type="email"
|
||||||
<RoleDropdown
|
value={addForm.email}
|
||||||
value={addForm.role || 'manager'}
|
onChange={(e) => setAddForm((f) => ({ ...f, email: e.target.value }))}
|
||||||
onChange={(r) => setAddForm((f) => ({ ...f, role: r }))}
|
/>
|
||||||
/>
|
<RoleDropdown
|
||||||
{addError && <div className="text-sm text-[var(--color-danger)]">{addError}</div>}
|
value={addForm.role || 'manager'}
|
||||||
<button
|
onChange={(r) => setAddForm((f) => ({ ...f, role: r }))}
|
||||||
type="submit"
|
/>
|
||||||
disabled={addSubmitting}
|
{addError && <div className="text-sm text-[var(--color-danger)]">{addError}</div>}
|
||||||
className="rounded-full bg-[var(--color-accent)] px-5 py-2 text-sm font-semibold text-white hover:opacity-90 transition disabled:opacity-50"
|
<div className="flex justify-end gap-2 pt-1">
|
||||||
>
|
<button
|
||||||
{addSubmitting ? 'Добавление…' : 'Добавить'}
|
type="button"
|
||||||
</button>
|
onClick={() => { setShowAddForm(false); setAddError(null); }}
|
||||||
</form>
|
className="rounded-full border border-[var(--color-border)] px-4 py-2 text-sm font-semibold text-[var(--color-text-muted)] hover:bg-[var(--color-surface-strong)] transition"
|
||||||
|
>
|
||||||
|
Отмена
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={addSubmitting}
|
||||||
|
className="rounded-full bg-[var(--color-accent)] px-4 py-2 text-sm font-semibold text-white hover:opacity-90 transition disabled:opacity-50"
|
||||||
|
>
|
||||||
|
{addSubmitting ? 'Добавление…' : 'Добавить'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Error */}
|
{/* Error */}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue