Skip to content

Commit

Permalink
Merge branch 'master' into #29-open-orders
Browse files Browse the repository at this point in the history
Conflicts:
	build/components.jsx
	build/styles.css
	src/app.jsx
	src/selectors/markets.js
	test/assertions/market.js
  • Loading branch information
priecint committed Jul 25, 2016
2 parents 530aee4 + b865519 commit 2229fea
Show file tree
Hide file tree
Showing 52 changed files with 662 additions and 834 deletions.
41 changes: 20 additions & 21 deletions build/components.jsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/styles.css

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "augur-ui-react-components",
"version": "3.0.14",
"version": "3.0.21",
"description": "Augur UI React Components",
"author": "Baz (@thinkloop)",
"license": "AAL",
Expand Down
15 changes: 7 additions & 8 deletions src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ export default function (appElement, selectors) {
accountLinkText: p.loginAccount && p.loginAccount.linkText || undefined
};

if (url !== window.location.pathname + window.location.search) {
window.history.pushState(null, null, url);
window.scrollTo(0, 0);
}

switch (p.activePage) {
case REGISTER:
case LOGIN:
Expand Down Expand Up @@ -91,9 +86,7 @@ export default function (appElement, selectors) {
node = (
<MarketPage
siteHeader={p.siteHeader}
sideOptions={p.sideOptions}
updateSelectedOutcome={p.selectedOutcome.updateSelectedOutcome}
selectedOutcomeID={p.selectedOutcome.selectedOutcomeID}
selectedOutcome={p.selectedOutcome}
cancelOrder={p.cancelOrder}
market={p.market}
numPendingReports={p.marketsTotals.numPendingReports}
Expand Down Expand Up @@ -125,4 +118,10 @@ export default function (appElement, selectors) {
node,
appElement
);


if (url !== window.location.pathname + window.location.search) {
window.history.pushState(null, null, url);
window.scrollTo(0, 0);
}
}
2 changes: 0 additions & 2 deletions src/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import positionsMarkets from '../test/assertions/positions-markets';
import positionsSummary from '../test/assertions/positions-summary';
import searchSort from '../test/assertions/search-sort';
import selectedOutcome from '../test/assertions/selected-outcome';
import sideOptions from '../test/assertions/side-options';
import siteHeader from '../test/assertions/site-header';
import transactions from '../test/assertions/transactions';
import transactionsTotals from '../test/assertions/transactions-totals';
Expand All @@ -43,7 +42,6 @@ export default {
positionsSummary,
searchSort,
selectedOutcome,
sideOptions,
siteHeader,
transactions,
transactionsTotals,
Expand Down
4 changes: 3 additions & 1 deletion src/components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import assertions from './assertions';
import * as PAGES from './modules/site/constants/pages';
import * as AUTH_TYPES from './modules/auth/constants/auth-types';
import * as TRANSACTION_TYPES from './modules/transactions/constants/types';
import * as TRADE_TYPES from './modules/trade/constants/types';

const constants = {
PAGES,
AUTH_TYPES,
TRANSACTION_TYPES
TRANSACTION_TYPES,
TRADE_TYPES
};

const components = {
Expand Down
32 changes: 29 additions & 3 deletions src/modules/account/components/account-page.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react';
import classnames from 'classnames';
import SiteHeader from '../../site/components/site-header';
import SiteFooter from '../../site/components/site-footer';
import Link from '../../link/components/link';
Expand All @@ -16,6 +17,7 @@ export default class AccountPage extends Component {
name: this.props.account.name,
editName: false,
showFullID: false,
showFullAddress: false,
msg: ''
};
}
Expand All @@ -40,7 +42,7 @@ export default class AccountPage extends Component {
<h2 className="heading">Credentials</h2>
<table className="account-info">
<tbody>
<tr className="account-info-item">
<tr className={classnames('account-info-item', { displayNone: p.account.localNode })}>
<th className="title">Account Name:</th>
<td className="item">
{s.editName &&
Expand Down Expand Up @@ -89,6 +91,30 @@ export default class AccountPage extends Component {
</tr>

<tr className="account-info-item">
<th className="title">Account Address:</th>
<td className="item">
{!s.showFullAddress &&
<span>
{p.account.prettyAddress}
</span>
}
{s.showFullAddress &&
<textarea className="full-secure-login-id" value={p.account.id} readOnly />
}
<button
className="link"
title={s.showFullID ? 'Hide full address' : 'Show full address'}
onClick={() => {
const showHide = !s.showFullAddress;
this.setState({ showFullAddress: showHide });
}}
>
{s.showFullAddress ? '(hide address)' : '(show full address)'}
</button>
</td>
</tr>

<tr className={classnames('account-info-item', { displayNone: p.account.localNode })}>
<th className="title">Secure Login ID:</th>
<td className="item">
{!s.showFullID &&
Expand All @@ -114,13 +140,13 @@ export default class AccountPage extends Component {
</tbody>
</table>
</div>
<div className="account-section">
<div className={classnames('account-section', { displayNone: p.account.localNode })}>
<div className="account-info-item">
<h2 className="heading">Download Account</h2>
<p>
If you are running Augur using a local geth node, you can download your account data to login through the node.
</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
</button>
</div>
Expand Down
4 changes: 0 additions & 4 deletions src/modules/account/less/account.less
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
.account-info {
padding: 2vmin 0;

.fade {
opacity: .25;
}

.account-info-item {
margin: 0.5rem 1vmin;

Expand Down
1 change: 0 additions & 1 deletion src/modules/bids-asks/components/bids-asks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const BidsAsks = (p) => (
<OrderBook
key={`order-book-${outcome.id}`}
outcome={outcome}
updateTradeOrder={outcome.trade.updateTradeOrder}
bids={outcome.orderBook.bids}
asks={outcome.orderBook.asks}
/>
Expand Down
22 changes: 4 additions & 18 deletions src/modules/bids-asks/components/order-book.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { PropTypes } from 'react';
import Clickable from '../../common/components/clickable';
import ValueDenomination from '../../common/components/value-denomination';

const OrderBook = (p) => (
Expand All @@ -9,14 +8,8 @@ const OrderBook = (p) => (
if (i !== 0) {
return (
<article key={bid.price.full} className="bid-ask bid">
<Clickable
onClick={() => { p.updateTradeOrder(p.outcome.id, bid.shares.value, bid.price.value, 'ask'); }}
>
<ValueDenomination className="shares" {...bid.shares} />
</Clickable>
<Clickable onClick={() => { p.updateTradeOrder(p.outcome.id, 0, bid.price.value); }}>
<ValueDenomination className="price" {...bid.price} />
</Clickable>
<ValueDenomination className="shares clickable" {...bid.shares} />
<ValueDenomination className="price clickable" {...bid.price} />
</article>
);
}
Expand All @@ -34,14 +27,8 @@ const OrderBook = (p) => (
if (i !== 0) {
return (
<article key={ask.price.full} className="bid-ask ask">
<Clickable onClick={() => { p.updateTradeOrder(p.outcome.id, 0, ask.price.value); }}>
<ValueDenomination className="price" {...ask.price} />
</Clickable>
<Clickable
onClick={() => { p.updateTradeOrder(p.outcome.id, ask.shares.value, ask.price.value, 'bid'); }}
>
<ValueDenomination className="shares" {...ask.shares} />
</Clickable>
<ValueDenomination className="price clickable" {...ask.price} />
<ValueDenomination className="shares clickable" {...ask.shares} />
</article>
);
}
Expand All @@ -59,7 +46,6 @@ const OrderBook = (p) => (

OrderBook.propTypes = {
outcome: PropTypes.object,
updateTradeOrder: PropTypes.func,
bids: PropTypes.array,
asks: PropTypes.array
};
Expand Down
39 changes: 0 additions & 39 deletions src/modules/common/components/clickable.js

This file was deleted.

8 changes: 4 additions & 4 deletions src/modules/common/components/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { PropTypes } from 'react';
import classnames from 'classnames';

const Dropdown = (p) => (
<span className={classnames('drop-down', p.className)}>
<span className={classnames('dropdown', p.className)}>
{!!p.selected &&
<span className="selected">{p.selected.label}</span>
<span className={classnames('selected', p.selected.value)}>{p.selected.label}</span>
}
<ul className="options">
{p.options.filter(option => option.value !== p.selected.value).map(option => (
<li key={option.value} className="option" onClick={() => p.onChange(option.value)}>{option.label}</li>
{p.options.filter(option => !p.selected || option.value !== p.selected.value).map(option => (
<li key={option.value} className={classnames('option', option.value)} onClick={() => p.onChange(option.value)}>{option.label}</li>
))}
</ul>
</span>
Expand Down
28 changes: 15 additions & 13 deletions src/modules/common/components/input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ export default class Input extends Component {
isMultiline: PropTypes.bool,
isClearable: PropTypes.bool,
debounceMS: PropTypes.number,
onChange: PropTypes.func
onChange: PropTypes.func,
onBlur: PropTypes.func
};

constructor(props) {
super(props);
this.finalDebounceMS = this.props.debounceMS > 0 || this.props.debounceMS === 0 ? this.props.debounceMS : 750;
this.state = {
value: this.props.value || '',
timeoutID: ''
Expand All @@ -28,34 +30,34 @@ export default class Input extends Component {
this.handleOnChange = this.handleOnChange.bind(this);
this.handleOnBlur = this.handleOnBlur.bind(this);
this.handleClear = this.handleClear.bind(this);
this.sendValue = this.sendValue.bind(this);
}

handleOnChange = (e) => {
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);
}
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);
}
}
this.props.onBlur && this.props.onBlur();
}

handleClear = () => {
this.setState({ value: '' });
this.sendValue('');
}

sendValue = (value) => {
this.props.onChange(value);
this.props.onChange('');
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/common/components/value-denomination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classnames from 'classnames';

const ValueDenomination = (p) => (
<span className={classnames('value-denomination', p.className, { positive: p.formattedValue > 0, negative: p.formattedValue < 0 })}>
{(p.formatted) &&
{p.formatted &&
<span className="value">{p.formatted}</span>
}
{p.denomination &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.drop-down {
.dropdown {
display: inline-block; position: relative;
color: @color-light-normal;
background: @color-dark-hover;
Expand All @@ -12,7 +12,7 @@

.selected {
display: block;
padding: 0.5rem 1.2rem;
padding: 0.5em 1.2em;
}

.options {
Expand All @@ -25,17 +25,12 @@

.option {
display: block;
padding: 0.5rem 1.4rem;
font-size: 0.8em;
padding: 0.5em 1.2em;

&:hover, &:focus, &:active {
color: white;
background: @color-dark-active;
}

&:last-child {
padding-bottom: 1rem;
}
}
}
}
8 changes: 8 additions & 0 deletions src/modules/common/less/general.less
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,11 @@ input[type=file] {
.displayNone {
display: none !important;
}

.fade {
opacity: .25;
}

.unfade {
opacity: 1;
}
Loading

0 comments on commit 2229fea

Please sign in to comment.