augur-ui-react-components
Advanced tools
Comparing version 3.1.21 to 3.1.22
{ | ||
"name": "augur-ui-react-components", | ||
"version": "3.1.21", | ||
"version": "3.1.22", | ||
"description": "Augur UI React Components", | ||
@@ -5,0 +5,0 @@ "author": "Augur Project", |
@@ -13,3 +13,3 @@ import React, { PropTypes } from 'react'; | ||
{p.formatted && | ||
<span className="value">{p.formatted}</span> | ||
<span className="value" title={p.fullPrecision}>{p.formatted}</span> | ||
} | ||
@@ -30,2 +30,3 @@ {p.denomination && | ||
formatted: PropTypes.string, | ||
fullPrecision: PropTypes.string, | ||
denomination: PropTypes.string, | ||
@@ -32,0 +33,0 @@ prefix: PropTypes.string, |
@@ -13,2 +13,3 @@ import React from 'react'; | ||
formatted={p.bidAsk.shares.rounded} | ||
fullPrecision={p.bidAsk.shares.fullPrecision} | ||
denomination={undefined} | ||
@@ -15,0 +16,0 @@ /> |
@@ -7,3 +7,3 @@ import { makeNumber } from '../../utils/make-number'; | ||
{ | ||
shares: makeNumber(776, 'Shares'), | ||
shares: makeNumber(776, ' shares'), | ||
price: makeNumber(0.5, ' ETH'), | ||
@@ -13,12 +13,16 @@ isOfCurrentUser: true | ||
{ | ||
shares: makeNumber(87, 'Shares'), | ||
shares: makeNumber(87, ' shares'), | ||
price: makeNumber(0.45, ' ETH') | ||
}, | ||
{ | ||
shares: makeNumber(2.22, 'Shares'), | ||
shares: makeNumber(2.22, ' shares'), | ||
price: makeNumber(0.35, ' ETH') | ||
}, | ||
{ | ||
shares: makeNumber(6544.43, 'Shares'), | ||
shares: makeNumber(6544.43, ' shares'), | ||
price: makeNumber(0.25, ' ETH') | ||
}, | ||
{ | ||
shares: makeNumber(1234567.987654321, ' shares', null, true), | ||
price: makeNumber(0.123456789, ' ETH', null, true) | ||
} | ||
@@ -28,7 +32,11 @@ ], | ||
{ | ||
shares: makeNumber(180, 'Shares'), | ||
shares: makeNumber(10000000000, ' shares', null, true), | ||
price: makeNumber(0.9, ' ETH', null, true) | ||
}, | ||
{ | ||
shares: makeNumber(180, ' shares'), | ||
price: makeNumber(0.63, ' ETH') | ||
}, | ||
{ | ||
shares: makeNumber(2000, 'Shares'), | ||
shares: makeNumber(2000, ' shares'), | ||
price: makeNumber(0.72, ' ETH'), | ||
@@ -38,7 +46,7 @@ isOfCurrentUser: Math.random() > 0.3 | ||
{ | ||
shares: makeNumber(5, 'Shares'), | ||
shares: makeNumber(5, ' shares'), | ||
price: makeNumber(0.82, ' ETH') | ||
}, | ||
{ | ||
shares: makeNumber(888, 'Shares'), | ||
shares: makeNumber(888, ' shares'), | ||
price: makeNumber(0.99, ' ETH') | ||
@@ -45,0 +53,0 @@ } |
@@ -1,4 +0,6 @@ | ||
export function makeNumber(num, denomination, omitSign) { | ||
export function makeNumber(num, denomination, omitSign, noRandom) { | ||
let rndNum = num; | ||
if (Math.round(num) !== num) rndNum = Math.round(num * 100) / 100; | ||
if (!noRandom || Math.round(num) !== num) { | ||
rndNum = Math.round(num * 10000) / 10000; | ||
} | ||
@@ -8,8 +10,13 @@ const o = { | ||
formattedValue: rndNum, | ||
formatted: rndNum.toString(), | ||
formatted: rndNum.toFixed(2), | ||
roundedValue: Math.round(rndNum), | ||
rounded: Math.round(rndNum).toString(), | ||
minimized: rndNum.toString(), | ||
rounded: Math.round(rndNum).toFixed(2), | ||
minimized: rndNum.toFixed(2), | ||
denomination: denomination || '' | ||
}; | ||
if (denomination === ' shares') { | ||
o.formatted = addBigUnitPostfix(rndNum); | ||
o.rounded = addBigUnitPostfix(rndNum); | ||
o.fullPrecision = rndNum.toString(); | ||
} | ||
@@ -29,1 +36,17 @@ const neverShowPlusSign = true; | ||
} | ||
function addBigUnitPostfix(value) { | ||
let postfixed; | ||
if (value > 1000000000000) { | ||
postfixed = '> 1T'; | ||
} else if (value > 10000000000) { | ||
postfixed = '{(value / 1000000000).toFixed(0)}B'; | ||
} else if (value > 10000000) { | ||
postfixed = '{(value / 1000000).toFixed(0)}M'; | ||
} else if (value > 10000) { | ||
postfixed = '{(value / 1000).toFixed(0)}K'; | ||
} else { | ||
postfixed = value.toFixed(2); | ||
} | ||
return postfixed; | ||
} |
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
1974852
37499