Skip to content

Commit

Permalink
#29 Mark user's open orders in order book
Browse files Browse the repository at this point in the history
  • Loading branch information
priecint committed Aug 1, 2016
1 parent 1b8b9f3 commit 67dc72c
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 26 deletions.
40 changes: 20 additions & 20 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.

1 change: 1 addition & 0 deletions src/modules/market/components/market-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default class MarketPage extends Component {
outcomes={p.market.outcomes}
selectedOutcome={p.selectedOutcome}
tradeSummary={p.market.tradeSummary}
userOpenOrdersSummary={p.market.userOpenOrdersSummary}
onSubmitPlaceTrade={p.market.onSubmitPlaceTrade}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/trade/components/trade-builder-bid-ask.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classnames from 'classnames';
import ValueDenomination from '../../../modules/common/components/value-denomination';

const TradeBuilderBidAsk = (p) => (
<div className={classnames('trade-builder-bid-ask', p.className)}>
<div className={classnames('trade-builder-bid-ask', { 'is-of-current-user': p.bidAsk.isOfCurrentUser }, p.className)}>
<ValueDenomination
className={classnames('shares')}
{...p.bidAsk.shares}
Expand Down
12 changes: 11 additions & 1 deletion src/modules/trade/components/trade-builder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@ const TradePanel = (p) => (
/>
))}
</tbody>
{p.userOpenOrdersSummary != null && p.userOpenOrdersSummary.openOrdersCount != null && p.userOpenOrdersSummary.openOrdersCount.value > 0 &&
(<tbody>
<tr>
<td colSpan="9">
Prices at which you have open orders are underlined
</td>
</tr>
</tbody>)
}
</table>
);

TradePanel.propTypes = {
outcomes: React.PropTypes.array,
selectedOutcome: React.PropTypes.object
selectedOutcome: React.PropTypes.object,
userOpenOrdersSummary: React.PropTypes.object
};

export default TradePanel;
2 changes: 2 additions & 0 deletions src/modules/trade/components/trade-panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const TradePanel = (p) => (
<div className="trade-panel">
<TradeBuilder
outcomes={p.outcomes}
userOpenOrdersSummary={p.userOpenOrdersSummary}
selectedOutcome={p.selectedOutcome}
/>

Expand All @@ -32,6 +33,7 @@ TradePanel.propTypes = {
outcomes: React.PropTypes.array,
selectedOutcome: React.PropTypes.object,
tradeSummary: React.PropTypes.object,
userOpenOrdersSummary: React.PropTypes.object,
onSubmitPlaceTrade: React.PropTypes.func
};

Expand Down
7 changes: 6 additions & 1 deletion src/modules/trade/less/trade-builder.less
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@

.trade-builder-bid-ask {
display: flex;
&.is-of-current-user {
.price .value {
text-decoration: underline;
}
}
.shares {
flex: 1.6;
text-align: right;
Expand Down Expand Up @@ -111,4 +116,4 @@
color: @color-warning-normal;
}
}
}
}
6 changes: 4 additions & 2 deletions src/selectors/bids-asks/select-bids-asks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default function selectOrderBook() {
bids: [
{
shares: makeNumber(776, 'Shares'),
price: makeNumber(0.5, 'eth')
price: makeNumber(0.5, 'eth'),
isOfCurrentUser: true
},
{
shares: makeNumber(87, 'Shares'),
Expand All @@ -27,7 +28,8 @@ export default function selectOrderBook() {
},
{
shares: makeNumber(2000, 'Shares'),
price: makeNumber(0.72, 'eth')
price: makeNumber(0.72, 'eth'),
isOfCurrentUser: Math.random() > 0.3
},
{
shares: makeNumber(5, 'Shares'),
Expand Down

0 comments on commit 67dc72c

Please sign in to comment.