augur-ui-react-components
Advanced tools
Comparing version 3.0.15 to 3.0.16
{ | ||
"name": "augur-ui-react-components", | ||
"version": "3.0.15", | ||
"version": "3.0.16", | ||
"description": "Augur UI React Components", | ||
@@ -5,0 +5,0 @@ "author": "Baz (@thinkloop)", |
@@ -34,7 +34,2 @@ import React from 'react'; | ||
if (url !== window.location.pathname + window.location.search) { | ||
window.history.pushState(null, null, url); | ||
window.scrollTo(0, 0); | ||
} | ||
switch (p.activePage) { | ||
@@ -95,5 +90,3 @@ case REGISTER: | ||
siteHeader={p.siteHeader} | ||
sideOptions={p.sideOptions} | ||
updateSelectedOutcome={p.selectedOutcome.updateSelectedOutcome} | ||
selectedOutcomeID={p.selectedOutcome.selectedOutcomeID} | ||
selectedOutcome={p.selectedOutcome} | ||
market={p.market} | ||
@@ -129,2 +122,8 @@ numPendingReports={p.marketsTotals.numPendingReports} | ||
); | ||
if (url !== window.location.pathname + window.location.search) { | ||
window.history.pushState(null, null, url); | ||
window.scrollTo(0, 0); | ||
} | ||
} |
@@ -19,3 +19,2 @@ import activePage from '../test/assertions/active-page'; | ||
import selectedOutcome from '../test/assertions/selected-outcome'; | ||
import sideOptions from '../test/assertions/side-options'; | ||
import siteHeader from '../test/assertions/site-header'; | ||
@@ -45,3 +44,2 @@ import transactions from '../test/assertions/transactions'; | ||
selectedOutcome, | ||
sideOptions, | ||
siteHeader, | ||
@@ -48,0 +46,0 @@ transactions, |
import React, { PropTypes } from 'react'; | ||
import Clickable from '../../common/components/clickable'; | ||
import ValueDenomination from '../../common/components/value-denomination'; | ||
@@ -12,10 +11,4 @@ | ||
<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} onClick={() => p.updateTradeOrder(p.outcome.id, bid.shares.value, bid.price.value, 'ask')} /> | ||
<ValueDenomination className="price clickable" {...bid.price} onClick={() => p.updateTradeOrder(p.outcome.id, 0, bid.price.value)} /> | ||
</article> | ||
@@ -38,10 +31,4 @@ ); | ||
<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} onClick={() => p.updateTradeOrder(p.outcome.id, 0, ask.price.value)} /> | ||
<ValueDenomination className="shares clickable" {...ask.shares} onClick={() => p.updateTradeOrder(p.outcome.id, ask.shares.value, ask.price.value, 'bid')} /> | ||
</article> | ||
@@ -48,0 +35,0 @@ ); |
@@ -5,9 +5,9 @@ import React, { PropTypes } from 'react'; | ||
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> | ||
))} | ||
@@ -14,0 +14,0 @@ </ul> |
@@ -13,3 +13,4 @@ import React, { Component, PropTypes } from 'react'; | ||
debounceMS: PropTypes.number, | ||
onChange: PropTypes.func | ||
onChange: PropTypes.func, | ||
onBlur: PropTypes.func | ||
}; | ||
@@ -51,2 +52,3 @@ | ||
} | ||
this.props.onBlur && this.props.onBlur(); | ||
} | ||
@@ -53,0 +55,0 @@ |
@@ -6,3 +6,3 @@ import React, { PropTypes } from 'react'; | ||
<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> | ||
@@ -9,0 +9,0 @@ } |
@@ -15,4 +15,4 @@ import React, { Component, PropTypes } from 'react'; | ||
siteHeader: PropTypes.object, | ||
sideOptions: PropTypes.array, | ||
market: PropTypes.object, | ||
selectedOutcome: PropTypes.object, | ||
priceTimeSeries: PropTypes.array, | ||
@@ -57,9 +57,6 @@ numPendingReports: PropTypes.number | ||
outcomes={p.market.outcomes} | ||
sideOptions={p.sideOptions} | ||
updateSelectedOutcome={p.updateSelectedOutcome} | ||
selectedOutcomeID={p.selectedOutcomeID} | ||
selectedOutcome={p.selectedOutcome} | ||
tradeOrders={p.market.tradeSummary.tradeOrders} | ||
tradeSummary={p.market.tradeSummary} | ||
onSubmitPlaceTrade={p.market.onSubmitPlaceTrade} | ||
orderSides={p.market.orderSides} | ||
/> | ||
@@ -66,0 +63,0 @@ ); |
@@ -44,3 +44,3 @@ import React from 'react'; | ||
<section className={classnames('report-form', { reported: s.isReported })}> | ||
<div ref="outcomeOptions" className="outcome-options"> | ||
<div className="outcome-options"> | ||
<h4>{!s.isReported ? 'Report the outcome' : 'Outcome Reported'}</h4> | ||
@@ -68,3 +68,2 @@ | ||
<Checkbox | ||
ref="unethical" | ||
className={classnames('unethical-checkbox', { disabled: s.isReported })} | ||
@@ -71,0 +70,0 @@ text="Yes, this question is unethical" |
import React from 'react'; | ||
import TradePanelHeader from '../../../modules/trade/components/trade-panel-header'; | ||
import TradePanelFooter from '../../../modules/trade/components/trade-panel-footer'; | ||
import TradePanelBody from '../../../modules/trade/components/trade-panel-body'; | ||
import TradeBuilder from '../../../modules/trade/components/trade-builder'; | ||
import TradeSummary from '../../../modules/trade/components/trade-summary'; | ||
const TradePanel = (p) => ( | ||
<div | ||
className="trade-panel" | ||
onClick={() => p.updateSelectedOutcome(null)} | ||
> | ||
<table className="trade-builder"> | ||
<TradePanelHeader selectedOutcomeID={p.selectedOutcomeID} /> | ||
{p.outcomes.map(outcome => ( | ||
<TradePanelBody | ||
key={`${outcome.name}`} | ||
outcome={outcome} | ||
sideOptions={p.sideOptions} | ||
selectedOutcomeID={p.selectedOutcomeID} | ||
updateSelectedOutcome={p.updateSelectedOutcome} | ||
orderSides={p.orderSides} | ||
/> | ||
))} | ||
{p.tradeOrders && !!p.tradeOrders.length && | ||
<TradePanelFooter | ||
summary={p.tradeSummary} | ||
orderSides={p.orderSides} | ||
/> | ||
} | ||
</table> | ||
<div className="trade-panel" onClick={() => p.selectedOutcome.updateSelectedOutcome(null)}> | ||
<TradeBuilder | ||
outcomes={p.outcomes} | ||
selectedOutcome={p.selectedOutcome} | ||
/> | ||
{!!p.tradeSummary && !!p.tradeOrders && !!p.tradeOrders.length && | ||
<TradeSummary summary={p.tradeSummary} /> | ||
} | ||
<div className="place-trade-container"> | ||
@@ -36,3 +22,2 @@ <button | ||
event.stopPropagation(); | ||
p.onSubmitPlaceTrade(); | ||
@@ -49,11 +34,8 @@ }} | ||
outcomes: React.PropTypes.array, | ||
sideOptions: React.PropTypes.array, | ||
updateSelectedOutcome: React.PropTypes.func, | ||
selectedOutcomeID: React.PropTypes.string, | ||
selectedOutcome: React.PropTypes.object, | ||
tradeOrders: React.PropTypes.array, | ||
tradeSummary: React.PropTypes.object, | ||
onSubmitPlaceTrade: React.PropTypes.func, | ||
orderSides: React.PropTypes.object | ||
onSubmitPlaceTrade: React.PropTypes.func | ||
}; | ||
export default TradePanel; |
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import { CREATE_MARKET, BUY_SHARES, SELL_SHARES, BID, ASK, SUBMIT_REPORT, GENERATE_ORDER_BOOK, TRADE_SUMMARY } from '../../transactions/constants/types'; | ||
import { CREATE_MARKET, BUY, SELL, BID, ASK, SUBMIT_REPORT, GENERATE_ORDER_BOOK, TRADE_SUMMARY } from '../../transactions/constants/types'; | ||
import { LOGIN, REGISTER } from '../../auth/constants/auth-types'; | ||
@@ -11,8 +11,8 @@ import ValueDenomination from '../../common/components/value-denomination'; | ||
switch (p.type) { | ||
case BUY_SHARES: | ||
case BUY: | ||
case BID: | ||
case SELL_SHARES: | ||
case SELL: | ||
case ASK: | ||
switch (p.type) { | ||
case BUY_SHARES: | ||
case BUY: | ||
nodes.action = 'BUY'; | ||
@@ -23,3 +23,3 @@ break; | ||
break; | ||
case SELL_SHARES: | ||
case SELL: | ||
nodes.action = 'SELL'; | ||
@@ -37,6 +37,6 @@ break; | ||
<ValueDenomination className="shares" {...p.shares} /> | ||
<span className="at">at</span> | ||
<ValueDenomination className="avgPrice" {...p.data.avgPrice} /> | ||
<span className="of">of</span> | ||
<span className="outcome-name">{p.data.outcomeName.substring(0, 35) + (p.data.outcomeName.length > 35 && '...' || '')}</span> | ||
<span className="at">@</span> | ||
<ValueDenomination className="avgPrice" {...p.data.avgPrice} /> | ||
<br /> | ||
@@ -48,21 +48,12 @@ <span className="market-description" title={p.data.marketDescription}> | ||
); | ||
if (p.type === BUY_SHARES) { | ||
nodes.valueChange = ( | ||
<span className="value-change"> | ||
{!!p.shares && !!p.shares.value && <ValueDenomination className="value-change shares" {...p.shares} /> | ||
} | ||
{!!p.etherNegative && !!p.etherNegative.value && <ValueDenomination className="value-change ether" {...p.etherNegative} /> | ||
} | ||
</span> | ||
); | ||
} else { | ||
nodes.valueChange = ( | ||
<span className="value-change"> | ||
{!!p.sharesNegative && !!p.sharesNegative.value && <ValueDenomination className="value-change shares" {...p.sharesNegative} /> | ||
} | ||
{!!p.ether && !!p.ether.value && <ValueDenomination className="value-change ether" {...p.ether} /> | ||
} | ||
</span> | ||
); | ||
} | ||
nodes.valueChange = ( | ||
<span className="value-changes"> | ||
{!!p.shares && !!p.shares.value && | ||
<ValueDenomination className="value-change shares" {...p.shares} /> | ||
} | ||
{!!p.ether && !!p.ether.value && | ||
<ValueDenomination className="value-change ether" {...p.ether} /> | ||
} | ||
</span> | ||
); | ||
break; | ||
@@ -72,3 +63,3 @@ case TRADE_SUMMARY: | ||
nodes.valueChange = ( | ||
<span className="value-change"> | ||
<span className="value-changes"> | ||
{!!p.shares && !!p.shares.value && <ValueDenomination className="value-change shares" {...p.shares} /> | ||
@@ -131,3 +122,3 @@ } | ||
nodes.valueChange = ( | ||
<span className="value-change"> | ||
<span className="value-changes"> | ||
{!!p.shares && !!p.shares.value && <ValueDenomination className="value-change shares" {...p.shares} /> | ||
@@ -134,0 +125,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export const BUY_SHARES = 'buy_shares'; | ||
export const SELL_SHARES = 'sell_shares'; | ||
export const BUY = 'buy'; | ||
export const SELL = 'sell'; | ||
export const TRADE_SUMMARY = 'trade_summary'; | ||
@@ -4,0 +4,0 @@ export const BID = 'bid'; |
@@ -8,2 +8,3 @@ import activePage from './selectors/active-page'; | ||
import loginAccount from './selectors/login-account'; | ||
import market from './selectors/market'; | ||
import markets from './selectors/markets'; | ||
@@ -17,4 +18,2 @@ import marketsTotals from './selectors/markets-totals'; | ||
import { BID, ASK } from './modules/transactions/constants/types'; | ||
// all selectors should go here | ||
@@ -29,2 +28,3 @@ const selectors = { | ||
loginAccount, | ||
market, | ||
markets, | ||
@@ -53,3 +53,2 @@ marketsTotals, | ||
selectors.searchSort = { | ||
@@ -62,4 +61,2 @@ selectedSort: { prop: 'creationDate', isDesc: true }, | ||
selectors.market = markets[0]; // selected market -- set to the first market for tests | ||
selectors.sideOptions = [{ value: BID, label: 'Buy' }, { value: ASK, label: 'Sell' }]; | ||
selectors.selectedOutcome = { | ||
@@ -66,0 +63,0 @@ updateSelectedOutcome: (selectedOutcomeID) => { |
@@ -7,15 +7,15 @@ import { makeNumber } from '../../utils/make-number'; | ||
{ | ||
shares: makeNumber(10, 'Shares'), | ||
shares: makeNumber(776, 'Shares'), | ||
price: makeNumber(0.5, 'eth') | ||
}, | ||
{ | ||
shares: makeNumber(20, 'Shares'), | ||
shares: makeNumber(87, 'Shares'), | ||
price: makeNumber(0.45, 'eth') | ||
}, | ||
{ | ||
shares: makeNumber(30, 'Shares'), | ||
shares: makeNumber(2, 'Shares'), | ||
price: makeNumber(0.35, 'eth') | ||
}, | ||
{ | ||
shares: makeNumber(40, 'Shares'), | ||
shares: makeNumber(6544, 'Shares'), | ||
price: makeNumber(0.25, 'eth') | ||
@@ -26,16 +26,16 @@ } | ||
{ | ||
shares: makeNumber(10, 'Shares'), | ||
price: makeNumber(0.6, 'eth') | ||
shares: makeNumber(180, 'Shares'), | ||
price: makeNumber(0.63, 'eth') | ||
}, | ||
{ | ||
shares: makeNumber(20, 'Shares'), | ||
price: makeNumber(0.7, 'eth') | ||
shares: makeNumber(2000, 'Shares'), | ||
price: makeNumber(0.72, 'eth') | ||
}, | ||
{ | ||
shares: makeNumber(30, 'Shares'), | ||
price: makeNumber(0.8, 'eth') | ||
shares: makeNumber(5, 'Shares'), | ||
price: makeNumber(0.82, 'eth') | ||
}, | ||
{ | ||
shares: makeNumber(40, 'Shares'), | ||
price: makeNumber(0.9, 'eth') | ||
shares: makeNumber(888, 'Shares'), | ||
price: makeNumber(0.99, 'eth') | ||
} | ||
@@ -42,0 +42,0 @@ ] |
@@ -5,2 +5,3 @@ import { makeNumber } from '../utils/make-number'; | ||
import { M } from '../modules/site/constants/pages'; | ||
import { BUY } from '../modules/trade/constants/types'; | ||
@@ -11,7 +12,3 @@ module.exports = makeMarkets(); | ||
const markets = []; | ||
const types = ['binary', 'categorical', 'scalar']; | ||
const constants = { | ||
BID: 'bid', | ||
ASK: 'ask' | ||
}; | ||
const types = ['binary', 'categorical', 'scalar']; | ||
@@ -27,3 +24,3 @@ for (let i = 0; i < numMarkets; i++) { | ||
const d = new Date('2017/12/12/'); | ||
const m = { | ||
const m = { | ||
id, | ||
@@ -41,14 +38,10 @@ type: types[randomInt(0, types.length - 1)], | ||
volume: makeNumber(randomInt(0, 10000), 'shares', true), | ||
isOpen: Math.random() > 0.1, | ||
isPendingReport: Math.random() < 0.5, | ||
isOpen: randomInt(0, 100) > 5, | ||
isPendingReport: index > 0 && index % 4 === 0, | ||
marketLink: { | ||
text: 'Trade', | ||
className: 'trade', | ||
onClick: () => require('../selectors').update({ activePage: M, market: m }) | ||
onClick: () => require('../selectors').update({ activePage: M, market: m, url: `/m/${id}` }) | ||
}, | ||
orderBook: {}, | ||
orderSides: { | ||
BID: constants.BID, | ||
ASK: constants.ASK | ||
} | ||
orderBook: {} | ||
}; | ||
@@ -69,45 +62,10 @@ | ||
// trade summary | ||
Object.defineProperty(m, 'tradeSummary', { | ||
get: () => { | ||
const tots = m.outcomes.reduce((p, outcome) => { | ||
if (!outcome.trade || !outcome.trade.numShares) { | ||
return p; | ||
} | ||
m.tradeSummary = { | ||
totalShares: makeNumber(0, 'shares'), | ||
totalEther: makeNumber(0, 'eth'), | ||
totalGas: makeNumber(0, 'eth'), | ||
feeToPay: makeNumber(0, 'eth'), | ||
tradeOrders: [] | ||
}; | ||
const feeToPay = 0.02 * outcome.trade.numShares * outcome.trade.limitPrice; | ||
const numShares = outcome.trade.numShares; | ||
const limitPrice = outcome.trade.limitPrice || 0; | ||
const profitLoss = outcome.trade.side === constants.BID ? -(numShares * limitPrice) : numShares * limitPrice; | ||
const cost = numShares * limitPrice; | ||
p.feeToPay += feeToPay; | ||
p.totalShares += outcome.trade.side === constants.BID ? numShares : -numShares; | ||
p.totalEther += outcome.trade.side === constants.BID ? -cost : cost; | ||
p.tradeOrders.push({ | ||
type: outcome.trade.side, | ||
shares: makeNumber(numShares, 'Shares'), | ||
ether: makeNumber(limitPrice, 'eth'), | ||
feeToPay: makeNumber(feeToPay, 'eth'), | ||
profitLoss: makeNumber(profitLoss, 'eth'), | ||
data: { | ||
outcomeName: outcome.name, | ||
marketDescription: m.description | ||
} | ||
}); | ||
return p; | ||
}, { feeToPay: 0, totalShares: 0, totalEther: 0, totalFees: 0, totalGas: 0, tradeOrders: [] }); | ||
tots.feeToPay = makeNumber(tots.feeToPay, 'eth'); | ||
tots.totalShares = makeNumber(tots.totalShares, 'Shares'); | ||
tots.totalEther = makeNumber(tots.totalEther, 'eth'); | ||
tots.totalFees = makeNumber(tots.totalFees); | ||
tots.totalGas = makeNumber(tots.totalGas); | ||
return tots; | ||
}, | ||
enumerable: true | ||
}); | ||
// price history | ||
@@ -142,6 +100,6 @@ const dayMillis = 24 * 60 * 60 * 1000; | ||
numPositions: makeNumber(3, 'Positions', true), | ||
qtyShares: makeNumber(10, 'Shares'), | ||
qtyShares: makeNumber(10, 'shares'), | ||
purchasePrice: makeNumber(0.5, 'eth'), | ||
totalCost: makeNumber(5, 'eth'), | ||
shareChange: makeNumber(1, 'Shares'), | ||
shareChange: makeNumber(1, 'shares'), | ||
netChange: makeNumber(1, 'eth'), | ||
@@ -272,17 +230,10 @@ totalValue: makeNumber(985, 'eth'), | ||
trade: { | ||
side: constants.BID, | ||
side: BUY, | ||
numShares: 0, | ||
limitPrice: 0, | ||
tradeSummary: { | ||
totalEther: makeNumber(0, 'eth'), | ||
feeToPay: makeNumber(0, 'eth') | ||
}, | ||
/** | ||
+ | ||
+ @param {Number} outcomeId | ||
+ @param {Number|undefined} shares Pass undefined to keep the value unchanged | ||
+ @param {Number|undefined} limitPrice Pass undefined to keep the value unchanged | ||
*/ | ||
updateTradeOrder: (outcomeId, shares, limitPrice, side) => { | ||
const outcome = m.outcomes.find((outcome) => outcome.id === outcomeId); | ||
tradeSummary: {}, | ||
updateTradeOrder: (outcomeID, shares, limitPrice, side) => { | ||
const outcome = { | ||
...m.outcomes.find((outcome) => outcome.id === outcomeID) | ||
}; | ||
@@ -298,9 +249,53 @@ if (typeof shares !== 'undefined') { | ||
} | ||
outcome.trade.tradeSummary.feeToPay = makeNumber(Math.round(0.02 * outcome.trade.limitPrice * outcome.trade.numShares * 100) / 100, 'eth'); | ||
const totEth = side === constants.BID ? -(outcome.trade.numShares * outcome.trade.limitPrice) : outcome.trade.numShares * outcome.trade.limitPrice; | ||
const randLimitPrice = randomInt(1, 100) / 100; | ||
const totEth = outcome.trade.numShares * (outcome.trade.limitPrice || randLimitPrice); | ||
const totEthFinal = outcome.trade.side === BUY ? -1 * totEth : totEth; | ||
outcome.trade.tradeSummary.feeToPay = makeNumber(Math.round(0.02 * (outcome.trade.limitPrice || randLimitPrice) * outcome.trade.numShares * 100) / 100, 'eth'); | ||
const feeForTotalEther = -1 * outcome.trade.tradeSummary.feeToPay.value; | ||
outcome.trade.tradeSummary.totalEther = makeNumber(Math.round((totEthFinal + feeForTotalEther) * 100) / 100, 'eth'); | ||
outcome.trade.tradeSummary.totalEther = makeNumber(Math.round(totEth * 100) / 100, 'eth'); | ||
m.outcomes = m.outcomes.map(currentOutcome => { | ||
if (currentOutcome.id === outcomeID) { | ||
return outcome; | ||
} | ||
return currentOutcome; | ||
}); | ||
require('../selectors').update(); | ||
m.tradeSummary = m.outcomes.reduce((p, outcome) => { | ||
if (!outcome.trade || !outcome.trade.numShares) { | ||
return p; | ||
} | ||
p.totalShares += outcome.trade.side === BUY ? outcome.trade.numShares : -1 * outcome.trade.numShares; | ||
p.totalEther += outcome.trade.tradeSummary.totalEther.value; | ||
p.tradeOrders.push({ | ||
type: outcome.trade.side, | ||
shares: makeNumber(outcome.trade.numShares, 'shares'), | ||
ether: outcome.trade.tradeSummary.totalEther, | ||
data: { | ||
outcomeName: outcome.name, | ||
marketDescription: m.description, | ||
avgPrice: makeNumber(Math.round((outcome.trade.tradeSummary.totalEther.value / outcome.trade.numShares) * 100) / 100, 'eth'), | ||
} | ||
}); | ||
return p; | ||
}, { feeToPay: 0, totalShares: 0, totalEther: 0, totalFees: 0, totalGas: 0, tradeOrders: [] }); | ||
m.tradeSummary.feeToPay = makeNumber(outcome.trade.tradeSummary.feeToPay, 'eth'); | ||
m.tradeSummary.totalShares = makeNumber(outcome.trade.tradeSummary.totalShares, 'shares'); | ||
m.tradeSummary.totalEther = makeNumber(outcome.trade.tradeSummary.totalEther, 'eth'); | ||
m.tradeSummary.totalFees = makeNumber(outcome.trade.tradeSummary.totalFees); | ||
m.tradeSummary.totalGas = makeNumber(outcome.trade.tradeSummary.totalGas); | ||
require('../selectors').update({ | ||
markets: markets.map(currentMarket => { | ||
if (currentMarket.id === m.id) { | ||
return m; | ||
} | ||
return currentMarket; | ||
}) | ||
}); | ||
} | ||
@@ -307,0 +302,0 @@ }, |
@@ -16,3 +16,3 @@ export function makeNumber(num, denomination, omitSign) { | ||
const neverShowPlusSign = true; | ||
if (!omitSign && neverShowPlusSign) { | ||
if (!omitSign && !neverShowPlusSign) { | ||
if (o.value > 0) { | ||
@@ -19,0 +19,0 @@ o.formatted = `+${o.formatted}`; |
@@ -444,3 +444,3 @@ import { assert } from 'chai'; | ||
describe(`tradeOrder shape for ${i}`, () => { | ||
describe('shares', () => { | ||
@@ -481,3 +481,3 @@ it('should be defined', () => { | ||
}); | ||
describe('ether', () => { | ||
@@ -774,35 +774,2 @@ it('should be defined', () => { | ||
describe('orderSides', () => { | ||
let orderSides = market.orderSides; | ||
it('should receive constants and be an object', () => { | ||
assert.isDefined(orderSides, 'market.orderSides is not defined'); | ||
}); | ||
it('should be an object', () => { | ||
assert.isObject(orderSides, 'market.orderSides is not an object'); | ||
}); | ||
describe('BID', () => { | ||
it('should exist', () => { | ||
assert.isDefined(orderSides.BID, 'BID is not defined'); | ||
}); | ||
it("should be a string + equal 'bid'", () => { | ||
assert.strictEqual(orderSides.BID, 'bid', "BID is not strictly equal to 'bid'"); | ||
}); | ||
}); | ||
describe('ASK', () => { | ||
it('should exist', () => { | ||
assert.isDefined(orderSides.ASK, 'ASK is not defined'); | ||
}); | ||
it("should be a string + equal 'ask'", () => { | ||
assert.strictEqual(orderSides.ASK, 'ask', "ASK is not strictly equal to 'ask'"); | ||
}); | ||
}); | ||
}); | ||
describe('onSubmitPlaceTrade', () => { | ||
@@ -809,0 +776,0 @@ let onSubmitPlaceTrade = market.onSubmitPlaceTrade; |
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
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
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3448859
366
2
7579