var ReactBootstrap = require('react-bootstrap') , OverlayMixin = ReactBootstrap.OverlayMixin , Button = ReactBootstrap.Button , ButtonGroup = ReactBootstrap.ButtonGroup , Glyphicon = ReactBootstrap.Glyphicon , Modal = ReactBootstrap.Modal , Input = ReactBootstrap.Input var React = require('react'); var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js'); var SetIntervalMixin = require("../common/SetIntervalMixin.js"); module.exports = ImportAccountModalButton = React.createClass({ mixins: [OverlayMixin], getInitialState: function () { return { isModalOpen: false, privkey: "", username: "", }; }, handlePrivkeyChange: function(e) { this.setState({privkey: e.target.value}); }, handleUsernameChange: function(e) { this.setState({username: e.target.value}); }, handleToggle: function () { this.setState({ isModalOpen: !this.state.isModalOpen }); }, handleImportAccount: function (e) { e.preventDefault(); var newprivkey = this.state.privkey; var newusername = this.state.username; Twister.importClientSideAccount(newusername,newprivkey,function(newaccount){ console.log(newaccount._name); var event = new CustomEvent('newaccountbyuser',{detail: newaccount}); //alert("scrolled to bottom") window.dispatchEvent(event); }) this.handleToggle(); return; }, render: function() { return ( ); }, renderOverlay: function() { if (!this.state.isModalOpen) { return ; } return ( } onRequestHide={this.handleToggle}>
); } });