-
Notifications
You must be signed in to change notification settings - Fork 6
/
create-worker.a92958aeb2d1f3159223.js
1 lines (1 loc) · 4.27 KB
/
create-worker.a92958aeb2d1f3159223.js
1
"use strict";(this.webpackChunkRuDEX3_light=this.webpackChunkRuDEX3_light||[]).push([[975],{82959:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var a=n(67294),r=n(89449),l=n(11390),s=n(32793),i=n(13973),o=n(58074),c=n.n(o),m=n(112),p=n.n(m),u=n(76660);class h extends a.Component{constructor(){super(),this.state={title:null,start:new Date,start_time:"00:00",end:null,end_time:"00:00",pay:null,url:"http://",vesting:7}}shouldComponentUpdate(e,t){return e.currentAccount,this.props.currentAccount,!i.Z.are_equal_shallow(t,this.state)}onSubmit(){l.Z.createWorker(this.state,this.props.currentAccount).catch((e=>{console.log("error",e);let t=e.message&&e.message.length&&e.message.length>0?e.message.split("stack")[0]:"unknown error";u.Notification.error({message:p().translate("notifications.worker_create_failure",{error_msg:t})})}))}render(){return console.log("state:",this.state),a.createElement("div",{className:"grid-block",style:{paddingTop:20}},a.createElement("div",{className:"grid-content large-9 large-offset-3 small-12"},a.createElement(c(),{content:"explorer.workers.create",component:"h3"}),a.createElement("form",{style:{maxWidth:800}},a.createElement(c(),{content:"explorer.workers.create_text_1",component:"p"}),a.createElement(c(),{content:"explorer.workers.create_text_2",component:"p"}),a.createElement("label",null,a.createElement(c(),{content:"explorer.workers.title"}),a.createElement("input",{onChange:e=>{this.setState({title:e.target.value})},type:"text"})),a.createElement(c(),{content:"explorer.workers.name_text",component:"p"}),a.createElement("div",{style:{width:"50%",paddingRight:"2.5%",display:"inline-block"}},a.createElement("label",null,a.createElement(c(),{content:"account.votes.start"}),a.createElement("input",{onChange:e=>{let t=new Date(e.target.value);t.setHours(this.state.start_time.split(":")[0],this.state.start_time.split(":")[1],0,0),this.setState({start:new Date(t)})},type:"date"}))),a.createElement("div",{style:{width:"50%",paddingRight:"2.5%",display:"inline-block"}},a.createElement("label",null,a.createElement(c(),{content:"explorer.workers.time_start"}),a.createElement("input",{defaultValue:this.state.start_time,onChange:e=>{let t=new Date;t.setTime(this.state.start.getTime()),t.setHours(e.target.value.split(":")[0],e.target.value.split(":")[1],0,0),this.setState({start:t,start_time:e.target.value})},type:"time"}))),a.createElement("div",{style:{width:"50%",paddingRight:"2.5%",display:"inline-block"}},a.createElement("label",null,a.createElement(c(),{content:"account.votes.end"}),a.createElement("input",{onChange:e=>{let t=new Date(e.target.value);t.setHours(this.state.end_time.split(":")[0],this.state.end_time.split(":")[1],0,0),this.setState({end:new Date(t)})},type:"date"}))),a.createElement("div",{style:{width:"50%",paddingRight:"2.5%",display:"inline-block"}},a.createElement("label",null,a.createElement(c(),{content:"explorer.workers.time_finish"}),a.createElement("input",{defaultValue:this.state.end_time,onChange:e=>{let t=new Date;try{t.setTime(this.state.end.getTime())}catch(e){t.setTime((new Date).getTime())}t.setHours(e.target.value.split(":")[0],e.target.value.split(":")[1],0,0),this.setState({end:t,end_time:e.target.value})},type:"time"}))),a.createElement(c(),{content:"explorer.workers.date_text",component:"p"}),a.createElement("label",null,a.createElement(c(),{content:"explorer.workers.daily_pay"}),a.createElement("input",{onChange:e=>{this.setState({pay:e.target.value})},type:"number"})),a.createElement(c(),{content:"explorer.workers.pay_text",component:"p"}),a.createElement("label",null,a.createElement(c(),{content:"explorer.workers.website"}),a.createElement("input",{onChange:e=>{this.setState({url:e.target.value})},type:"text"})),a.createElement(c(),{content:"explorer.workers.url_text",component:"p"}),a.createElement("label",null,a.createElement(c(),{content:"explorer.workers.vesting_pay"}),a.createElement("input",{defaultValue:this.state.vesting,onChange:e=>{this.setState({vesting:parseInt(e.target.value)})},type:"number"})),a.createElement(c(),{content:"explorer.workers.vesting_text",component:"p"}),a.createElement("div",{className:"button-group",onClick:this.onSubmit.bind(this)},a.createElement("div",{className:"button",type:"submit"},"Publish")))))}}const g=h=(0,r.$)(h,{listenTo:()=>[s.Z],getProps:()=>({currentAccount:s.Z.getState().currentAccount})})}}]);