augur-ui-react-components
Advanced tools
Comparing version 3.1.19 to 3.1.20
{ | ||
"name": "augur-ui-react-components", | ||
"version": "3.1.19", | ||
"version": "3.1.20", | ||
"description": "Augur UI React Components", | ||
@@ -5,0 +5,0 @@ "author": "Augur Project", |
@@ -36,2 +36,3 @@ import activePage from '../test/assertions/active-page'; | ||
import tradeCommitLock from '../test/assertions/trade-commit-lock'; | ||
import reportableOutcomes from '../test/assertions/reportable-outcomes'; | ||
@@ -73,3 +74,4 @@ export default { | ||
loginAccountReports, | ||
tradeCommitLock | ||
tradeCommitLock, | ||
reportableOutcomes | ||
}; |
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import Checkbox from '../../common/components/checkbox'; | ||
import { BINARY, CATEGORICAL } from '../../markets/constants/market-types'; | ||
import BINARY_OUTCOMES from '../../reports/constants/binary-outcomes'; | ||
import { SCALAR } from '../../markets/constants/market-types'; | ||
@@ -53,20 +52,19 @@ export default class ReportForm extends React.Component { | ||
let outcomeOptions; | ||
if (p.type === CATEGORICAL) { | ||
if (p.type === SCALAR) { | ||
outcomeOptions = ( | ||
(p.reportableOutcomes || []).map(outcome => ( | ||
<label key={outcome.id} className={classnames('outcome-option', { disabled: s.isReported || s.isIndeterminate })}> | ||
<div> | ||
<label key="scalar-outcome"> | ||
<input | ||
type="radio" | ||
className="outcome-option-radio" | ||
name="outcome-option-radio" | ||
value={outcome.id} | ||
checked={s.reportedOutcomeID === outcome.id} | ||
type="text" | ||
className="outcome-scalar-input" | ||
name="outcome-scalar-input" | ||
value={s.reportedOutcomeID} | ||
disabled={s.isReported || s.isIndeterminate} | ||
onChange={this.handleOutcomeChange} | ||
/> | ||
{outcome.name} | ||
</label> | ||
)) | ||
<p>Enter the outcome of this event, if it was at least {p.minValue} and at most {p.maxValue}. If the outcome was outside this range, please report this event as Indeterminate.</p> | ||
</div> | ||
); | ||
} else if (p.type === BINARY) { | ||
} else { | ||
outcomeOptions = ( | ||
@@ -84,22 +82,6 @@ (p.reportableOutcomes || []).map(outcome => ( | ||
/> | ||
{BINARY_OUTCOMES[outcome.id - 1]} | ||
{outcome.name} | ||
</label> | ||
)) | ||
); | ||
} else { | ||
outcomeOptions = ( | ||
<div> | ||
<label key="scalar-outcome"> | ||
<input | ||
type="text" | ||
className="outcome-scalar-input" | ||
name="outcome-scalar-input" | ||
value={s.reportedOutcomeID} | ||
disabled={s.isReported || s.isIndeterminate} | ||
onChange={this.handleOutcomeChange} | ||
/> | ||
</label> | ||
<p>Enter the outcome of this event, if it was at least {p.minValue} and at most {p.maxValue}. If the outcome was outside this range, please report this event as Indeterminate.</p> | ||
</div> | ||
); | ||
} | ||
@@ -106,0 +88,0 @@ |
import { makeNumber } from '../utils/make-number'; | ||
import { makeDate } from '../utils/make-date'; | ||
import selectOrderBook from '../selectors/bids-asks/select-bids-asks'; | ||
import selectReportableOutcomes from '../selectors/reportable-outcomes'; | ||
@@ -61,4 +62,4 @@ import { BINARY, CATEGORICAL, SCALAR } from '../modules/markets/constants/market-types'; | ||
// reportable outcomes | ||
m.reportableOutcomes = m.outcomes.slice(); | ||
m.reportableOutcomes.push({ id: '1.5', name: 'indeterminate' }); | ||
m.reportableOutcomes = selectReportableOutcomes(m.type, m.outcomes); | ||
m.reportableOutcomes.push({ id: '1.5', name: 'indeterminate', userOpenOrders: [] }); | ||
@@ -134,6 +135,6 @@ m.onSubmitPlaceTrade = () => {}; // No action in dummy selector | ||
// console.log('OUTCOMES -- ', m.outcomes); | ||
m.userOpenOrdersSummary = { | ||
openOrdersCount: makeNumber(m.outcomes.reduce((openOrdersCount, outcome) => ( | ||
openOrdersCount + outcome.userOpenOrders.length | ||
), 0), 'Open Orders') | ||
openOrdersCount: makeNumber(m.outcomes.reduce((openOrdersCount, outcome) => (openOrdersCount + outcome && outcome.userOpenOrders && outcome.userOpenOrders.length), 0), 'Open Orders') | ||
}; | ||
@@ -140,0 +141,0 @@ |
@@ -5,2 +5,3 @@ import {assert} from 'chai'; | ||
import assertMarketLink from './common/market-link'; | ||
import assertReportableOutcomes from '../../test/assertions/reportable-outcomes'; | ||
@@ -265,5 +266,3 @@ export default function (market) { | ||
it('market.reportableOutcomes', () => { | ||
// NOTE -- shallow check here due to deep check further down of the same selector method | ||
assert.isDefined(market.reportableOutcomes); | ||
assert.isArray(market.reportableOutcomes); | ||
assertReportableOutcomes(market.reportableOutcomes); | ||
}); | ||
@@ -270,0 +269,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1974117
214
37475