Show API save errors in RoomModal footer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 16:55:08 +03:00
parent 55a34dc0dc
commit 56f4d997a2
2 changed files with 16 additions and 3 deletions

View File

@@ -49,9 +49,10 @@ interface RoomModalProps {
categories?: { id: string; name: string }[]
onClose: () => void
onSave: (room: Room) => void
error?: string | null
}
export function RoomModal({ open, room, categories = [], onClose, onSave }: RoomModalProps) {
export function RoomModal({ open, room, categories = [], onClose, onSave, error }: RoomModalProps) {
const isEdit = !!room
const [tab, setTab] = useState<ModalTab>('main')
@@ -164,6 +165,9 @@ export function RoomModal({ open, room, categories = [], onClose, onSave }: Room
size="xl"
footer={
<>
{error && (
<p className="text-sm text-red-600 dark:text-red-400 flex-1 text-left">{error}</p>
)}
<button onClick={onClose} className="btn-secondary">Отмена</button>
<button onClick={handleSave} className="btn-primary" disabled={!form.number}>
{isEdit ? 'Сохранить' : 'Добавить номер'}