import { Button, DialogActions, DialogContent, DialogTitle, TextField } from "@mui/material"; import ResponsiveDialog from "common/ResponsiveDialog"; import { useMineAPI } from "hooks"; import { pond } from "protobuf-ts/pond"; import { useGlobalState } from "providers"; import { useState } from "react"; interface Props { open: boolean; closeCallback: () => void; refreshCallback: () => void; } export default function AddMine(props: Props) { const { open, closeCallback, refreshCallback } = props; const [name, setName] = useState(""); const mineAPI = useMineAPI(); const [{as}] = useGlobalState(); const addMine = () => { let newMine = pond.MineSettings.create(); newMine.name = name; mineAPI.addMine(newMine, as).finally(() => { closeCallback(); refreshCallback(); }); }; return ( Create new Mine setName(e.target.value)} /> ); }