import React, { useState, useEffect } from 'react'; import { Book, AppScreen } from '../types'; interface AddBookProps { initialData?: Partial; onSave: (book: Partial) => void; onCancel: () => void; onScanClick: () => void; } export const AddBook: React.FC = ({ initialData, onSave, onCancel, onScanClick }) => { const [formData, setFormData] = useState>({ title: '', author: '', genre: '', annotation: '', status: 'want_to_read', pages: 0, language: 'Russian', publishedYear: new Date().getFullYear(), rating: 5, coverUrl: 'https://picsum.photos/seed/newbook/400/600', ...initialData }); const handleChange = (e: React.ChangeEvent) => { const { id, value } = e.target; setFormData(prev => ({ ...prev, [id]: value })); }; return (

Добавить книгу

{formData.coverUrl && !formData.coverUrl.includes('picsum') ? ( Preview ) : (
add_a_photo

Загрузить или отсканировать

)}
expand_more