import { useState } from "react"; import type { AccountCreate } from "@/api/types"; import { useT } from "@/lib/i18n"; interface Props { onSave: (data: AccountCreate) => void; onClose: () => void; } export function AddModal({ onSave, onClose }: Props) { const t = useT(); const [login, setLogin] = useState(""); const [password, setPassword] = useState(""); const [email, setEmail] = useState(""); const [proxy, setProxy] = useState(""); const handleSave = () => { if (!login || !password) return; onSave({ login, password, email: email || undefined, proxy: proxy || undefined, }); }; return (
e.stopPropagation()}>

{t("modal.addAccount")}

setLogin(e.target.value)} placeholder={t("ph.login")} className="w-full bg-dark-700 border border-dark-600 rounded px-3 py-2 text-sm" /> setPassword(e.target.value)} placeholder={t("ph.password")} className="w-full bg-dark-700 border border-dark-600 rounded px-3 py-2 text-sm" /> setEmail(e.target.value)} placeholder="Email" className="w-full bg-dark-700 border border-dark-600 rounded px-3 py-2 text-sm" /> setProxy(e.target.value)} placeholder={t("ph.proxy")} className="w-full bg-dark-700 border border-dark-600 rounded px-3 py-2 text-sm" />
); }