import React from "react"; import { Input, Button } from "./"; import { prompt } from "../helpers/"; import { Popup } from "./popup"; import { t } from "../locales/"; export class ModalPrompt extends Popup { constructor(props){ super(props); } componentDidMount(){ prompt.subscribe((text, okCallback, cancelCallback, type) => { this.setState({ appear: true, value: "", error: null, type: type || "text", text: text || "", fns: {ok: okCallback, cancel: cancelCallback} }); }); } onSubmit(e){ e && e.preventDefault && e.preventDefault(); this.state.fns.ok(this.state.value) .then(() => this.setState({appear: false})) .catch((message) => this.setState({error: message})); } modalContentBody(){ return (