klg-asutk-app/components/AircraftAddModal.tsx
Yuriy aa052763f6 Безопасность и качество: 8 исправлений + обновления
- .env.example: полный шаблон, защита секретов
- .gitignore: явное исключение .env.* и секретов
- layout.tsx: XSS — заменён dangerouslySetInnerHTML на next/script для SW
- ESLint: no-console error (allow warn/error), ignore scripts/
- scripts/remove-console-logs.js: очистка console.log без glob
- backend/routes/modules: README с планом рефакторинга крупных файлов
- SECURITY.md: гид по секретам, XSS, CORS, auth, линту
- .husky/pre-commit: запуск npm run lint

+ прочие правки приложения и бэкенда

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-14 21:29:16 +03:00

26 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import { useState } from 'react';
import { Modal } from '@/components/ui';
import FormField from '@/components/ui/FormField';
interface Props { isOpen: boolean; onClose: () => void; onAdd: (data: any) => void; }
export default function AircraftAddModal({ isOpen, onClose, onAdd }: Props) {
const [form, setForm] = useState({ registration_number: '', serial_number: '', aircraft_type: '', model: '', operator_id: '' });
const set = (k: string, v: string) => setForm(f => ({ ...f, [k]: v }));
const handleAdd = () => { if (!form.registration_number.trim()) return alert('Укажите регистрацию'); onAdd(form); setForm({ registration_number: '', serial_number: '', aircraft_type: '', model: '', operator_id: '' }); };
return (
<Modal isOpen={isOpen} onClose={onClose} title="Добавить ВС" size="md"
footer={<><button onClick={onClose} className="btn-secondary">Отмена</button><button onClick={handleAdd} className="btn-primary">Добавить</button></>}>
<div className="grid grid-cols-2 gap-4">
<FormField label="Регистрация" required><input value={form.registration_number} onChange={e => set('registration_number', e.target.value)} className="input-field" placeholder="RA-XXXXX" /></FormField>
<FormField label="Серийный номер"><input value={form.serial_number} onChange={e => set('serial_number', e.target.value)} className="input-field" /></FormField>
<FormField label="Тип ВС"><input value={form.aircraft_type} onChange={e => set('aircraft_type', e.target.value)} className="input-field" placeholder="Boeing 737-800" /></FormField>
<FormField label="Модель"><input value={form.model} onChange={e => set('model', e.target.value)} className="input-field" /></FormField>
</div>
</Modal>
);
}