augur-ui-react-components
Advanced tools
Comparing version 3.0.20 to 3.0.21
{ | ||
"name": "augur-ui-react-components", | ||
"version": "3.0.20", | ||
"version": "3.0.21", | ||
"description": "Augur UI React Components", | ||
@@ -5,0 +5,0 @@ "author": "Baz (@thinkloop)", |
import React, { PropTypes, Component } from 'react'; | ||
import classnames from 'classnames'; | ||
import SiteHeader from '../../site/components/site-header'; | ||
@@ -27,3 +28,3 @@ import SiteFooter from '../../site/components/site-footer'; | ||
const s = this.state; | ||
console.log(p.account); | ||
return ( | ||
@@ -45,3 +46,3 @@ <main className="page account"> | ||
<tbody> | ||
<tr className="account-info-item"> | ||
<tr className={classnames('account-info-item', { displayNone: p.account.localNode })}> | ||
<th className="title">Account Name:</th> | ||
@@ -118,3 +119,3 @@ <td className="item"> | ||
<tr className="account-info-item"> | ||
<tr className={classnames('account-info-item', { displayNone: p.account.localNode })}> | ||
<th className="title">Secure Login ID:</th> | ||
@@ -145,3 +146,3 @@ <td className="item"> | ||
</div> | ||
<div className="account-section"> | ||
<div className={classnames('account-section', { displayNone: p.account.localNode })}> | ||
<div className="account-info-item"> | ||
@@ -152,3 +153,3 @@ <h2 className="heading">Download Account</h2> | ||
</p> | ||
<button className="button download-account" title="Click here to Download your Account." > | ||
<button className="button download-account" title="Click here to Download your Account." onClick={() => p.account.downloadAccount()}> | ||
Download Account | ||
@@ -155,0 +156,0 @@ </button> |
@@ -19,2 +19,3 @@ import React, { Component, PropTypes } from 'react'; | ||
super(props); | ||
this.finalDebounceMS = this.props.debounceMS > 0 || this.props.debounceMS === 0 ? this.props.debounceMS : 750; | ||
this.state = { | ||
@@ -33,3 +34,2 @@ value: this.props.value || '', | ||
this.handleClear = this.handleClear.bind(this); | ||
this.sendValue = this.sendValue.bind(this); | ||
} | ||
@@ -39,7 +39,9 @@ | ||
const newValue = e.target.value; | ||
if (this.props.debounceMS !== 0) { | ||
if (this.finalDebounceMS) { | ||
clearTimeout(this.state.timeoutID); | ||
this.setState({ timeoutID: setTimeout(() => this.sendValue(newValue), this.props.debounceMS || 750) }); | ||
} else { | ||
this.sendValue(newValue); | ||
if (newValue !== this.props.value) { | ||
this.setState({ timeoutID: setTimeout(() => this.props.onChange(newValue), this.finalDebounceMS) }); | ||
} | ||
} else if (newValue !== this.props.value) { | ||
this.props.onChange(newValue); | ||
} | ||
@@ -50,5 +52,7 @@ this.setState({ value: newValue }); | ||
handleOnBlur = () => { | ||
if (this.props.debounceMS !== 0) { | ||
if (this.finalDebounceMS) { | ||
clearTimeout(this.state.timeoutID); | ||
this.sendValue(this.state.value); | ||
if (this.state.value !== this.props.value) { | ||
this.props.onChange(this.state.value); | ||
} | ||
} | ||
@@ -60,9 +64,5 @@ this.props.onBlur && this.props.onBlur(); | ||
this.setState({ value: '' }); | ||
this.sendValue(''); | ||
this.props.onChange(''); | ||
} | ||
sendValue = (value) => { | ||
this.props.onChange(value); | ||
} | ||
render() { | ||
@@ -69,0 +69,0 @@ const p = this.props; |
@@ -86,3 +86,3 @@ import React, { Component, PropTypes } from 'react'; | ||
return ( | ||
<main className="page market"> | ||
<main className="page market" onClick={() => p.selectedOutcome.updateSelectedOutcome(null)}> | ||
<SiteHeader {...p.siteHeader} /> | ||
@@ -89,0 +89,0 @@ |
@@ -48,3 +48,3 @@ import React from 'react'; | ||
isClearable={false} | ||
onChange={(value) => p.trade.updateTradeOrder(parseFloat(value) || 0)} | ||
onChange={(value) => p.trade.updateTradeOrder(parseFloat(value) || 0, undefined, p.trade.side)} | ||
onClick={(e) => { e.stopPropagation(); p.updateSelectedOutcome(p.id); }} | ||
@@ -58,3 +58,3 @@ /> | ||
isClearable={false} | ||
onChange={(value) => p.trade.updateTradeOrder(undefined, parseFloat(value) || 0)} | ||
onChange={(value) => p.trade.updateTradeOrder(undefined, parseFloat(value) || 0, p.trade.side)} | ||
onClick={(e) => { e.stopPropagation(); p.updateSelectedOutcome(p.id); }} | ||
@@ -61,0 +61,0 @@ /> |
@@ -6,3 +6,3 @@ import React from 'react'; | ||
const TradePanel = (p) => ( | ||
<div className="trade-panel" onClick={() => p.selectedOutcome.updateSelectedOutcome(null)}> | ||
<div className="trade-panel"> | ||
<TradeBuilder | ||
@@ -9,0 +9,0 @@ outcomes={p.outcomes} |
@@ -7,2 +7,3 @@ import { emptyNumber } from '../utils/empty-number'; | ||
prettyAddress: '0x45...1efa', | ||
localNode: false, | ||
secureLoginID: 'testID123ASDW3N193NF7V123ADW25579130239SE1235189ADJWKRUY8123AOUELOREMIPSUMDOLORSITAMETCONSECTETURADIPISICINGELITSEDDOEIUSMODTEMPORINCIDIDUNTUTLABOREETDOLOREMAGNAALIQUAUTENIMADMINIMVENIAMQUISNOSTRUDEXERCITATIONULLAMCOLABORISNISIUTALIQUIPEXEACOMMODOCONSEQUATDUISAUTEIRUREDOLORINREPREHENDERITINVOLUPTATEVELITESSECILLUMDOLOREEUFUGIATNULLAPARIATUREXCEPTEURSINTOCCAECATCUPIDATATNONPROIDENTSUNTINCULPAQUIOFFICIADESERUNTMOLLITANIMIDESTLABORUM', | ||
@@ -16,3 +17,3 @@ prettySecureLoginID: 'test...ORUM', | ||
loginAccount.linkText = loginAccount.name || loginAccount.prettySecureLoginID; | ||
loginAccount.linkText = loginAccount.localNode ? loginAccount.prettyAddress : loginAccount.name || loginAccount.prettySecureLoginID; | ||
@@ -31,2 +32,16 @@ loginAccount.signIn = (name = loginAccount.name) => { | ||
loginAccount.downloadAccount = () => { | ||
const theDocument = typeof document !== 'undefined' && document; | ||
const link = theDocument.createElement('a'); | ||
const date = new Date() | ||
.toISOString() | ||
.split(':') | ||
.join('-'); | ||
const filename = `UTC--${date}--${loginAccount.address}`; | ||
const accountFile = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(loginAccount))}`; | ||
link.download = filename; | ||
link.href = accountFile; | ||
link.click(); | ||
}; | ||
loginAccount.editName = (name) => { | ||
@@ -33,0 +48,0 @@ loginAccount.name = (name && name !== '') ? name : undefined; |
@@ -230,2 +230,3 @@ import { makeNumber } from '../utils/make-number'; | ||
updateTradeOrder: (shares, limitPrice, side) => { | ||
console.log('update trade order:', shares, limitPrice, side); | ||
const outcome = { | ||
@@ -232,0 +233,0 @@ ...m.outcomes.find((outcome) => outcome.id === outcomeID) |
@@ -17,5 +17,14 @@ import { assert } from 'chai'; | ||
assert.isDefined(loginAccount.secureLoginID, `loginAccount.secureLoginID isn't defined`); | ||
assert.isString(loginAccount.secureLoginID, `loginAccount.secureLoginID isn't a string`); | ||
assert.isDefined(loginAccount.prettySecureLoginID, `loginAccount.prettySecureLoginID isn't defined`); | ||
assert.isString(loginAccount.prettySecureLoginID, `loginAccount.prettySecureLoginID isn't a string`); | ||
assert.isDefined(loginAccount.prettyAddress, `loginAccount.prettyAddress isn't defined`); | ||
assert.isString(loginAccount.prettyAddress, `loginAccount.prettyAddress isn't a string`); | ||
assert.isDefined(loginAccount.localNode, `loginAccount.localNode isn't defined`); | ||
assert.isBoolean(loginAccount.localNode, `loginAccount.localNode isn't a boolean`); | ||
assertFormattedNumber(loginAccount.rep, 'loginAccount.rep'); | ||
@@ -22,0 +31,0 @@ assertFormattedNumber(loginAccount.ether, 'loginAccount.ether'); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1165222
7635