import React, { useState } from "react"; import { motion, AnimatePresence } from "framer-motion"; import type { ChartType } from "../types"; interface AddWidgetModalProps { isOpen: boolean; onAdd: (data: { type: ChartType; title: string; dataKey: string }) => void; onClose: () => void; } export const AddWidgetModal: React.FC = ({ isOpen, onAdd, onClose, }) => { const [type, setType] = useState("line"); const [title, setTitle] = useState(""); const [dataKey, setDataKey] = useState("requests"); const handleAdd = () => { if (!title.trim()) return; onAdd({ type, title: title.trim(), dataKey }); setTitle(""); setType("line"); setDataKey("requests"); onClose(); }; return ( {isOpen && ( e.stopPropagation()} >

Добавить график

{(["line", "bar", "area", "pie"] as ChartType[]).map((t) => ( ))}
setTitle(e.target.value)} placeholder="Название" className="w-full px-2 py-1 text-[11px] bg-tertiary border border-primary rounded text-primary focus:outline-none focus:border-accent-primary" />
)}
); };