WIP address comments

This commit is contained in:
Daniel Ternyak 2017-06-18 14:47:00 -05:00
parent 00e5962ae0
commit fb73be4214
5 changed files with 22 additions and 27 deletions

View File

@ -6,35 +6,35 @@ export const SWAP_DESTINATION_AMOUNT = 'SWAP_DESTINATION_AMOUNT';
export const SWAP_UPDATE_BITY_RATES = 'SWAP_UPDATE_BITY_RATES';
export const SWAP_ORIGIN_KIND_TO = (value: any) => {
export const SWAP_ORIGIN_KIND_TO = (value) => {
return {
type: SWAP_ORIGIN_KIND,
value
};
};
export const SWAP_DESTINATION_KIND_TO = (value: any) => {
export const SWAP_DESTINATION_KIND_TO = (value) => {
return {
type: SWAP_DESTINATION_KIND,
value
}
}
export const SWAP_ORIGIN_AMOUNT_TO = (value: any) => {
export const SWAP_ORIGIN_AMOUNT_TO = (value) => {
return {
type: SWAP_ORIGIN_AMOUNT,
value
};
};
export const SWAP_DESTINATION_AMOUNT_TO = (value: any) => {
export const SWAP_DESTINATION_AMOUNT_TO = (value) => {
return {
type: SWAP_DESTINATION_AMOUNT,
value
}
}
export const SWAP_UPDATE_BITY_RATES_TO = (value: any) => {
export const SWAP_UPDATE_BITY_RATES_TO = (value) => {
return {
type: SWAP_UPDATE_BITY_RATES,
value

View File

@ -2,7 +2,7 @@ import axios from 'axios';
// https://stackoverflow.com/questions/9828684/how-to-get-all-arguments-of-a-callback-function
export function combineAndUpper() {
let args = [];
const args = [];
let newString = '';
for (let i = 0; i < arguments.length; ++i) args[i] = arguments[i];
args.forEach((each) => {
@ -36,8 +36,8 @@ export default class Bity {
}
_getRate(bityRates, origin, destination) {
let pairName = combineAndUpper(origin, destination);
let rateObjects = bityRates.data.objects;
const pairName = combineAndUpper(origin, destination);
const rateObjects = bityRates.data.objects;
return this.findRateFromBityRateList(rateObjects, pairName);
}
@ -46,14 +46,14 @@ export default class Bity {
* @param arrayOfOriginAndDestinationDicts - [{origin: 'BTC', destination: 'ETH'}, {origin: 'BTC', destination: 'REP}]
*/
getMultipleRates(arrayOfOriginAndDestinationDicts) {
let mappedRates = {};
const mappedRates = {};
return this.requestAllRates()
.then((bityRates) => {
arrayOfOriginAndDestinationDicts.forEach((each) => {
let origin = each.origin;
let destination = each.destination;
let pairName = combineAndUpper(origin, destination);
let rate = this._getRate(bityRates, origin, destination);
const origin = each.origin;
const destination = each.destination;
const pairName = combineAndUpper(origin, destination);
const rate = this._getRate(bityRates, origin, destination);
mappedRates[pairName] = parseFloat(rate.rate_we_sell)
});
return mappedRates
@ -62,11 +62,11 @@ export default class Bity {
}
getAllRates() {
let mappedRates = {};
const mappedRates = {};
return this.requestAllRates()
.then((bityRates) => {
bityRates.data.objects.forEach((each) => {
let pairName = each.pair;
const pairName = each.pair;
mappedRates[pairName] = parseFloat(each.rate_we_sell)
});
return mappedRates
@ -75,8 +75,8 @@ export default class Bity {
}
requestAllRates() {
let path = '/v1/rate2/';
let bityURL = this.bityAPI + path
const path = '/v1/rate2/';
const bityURL = this.bityAPI + path;
return axios.get(bityURL)
}
}

View File

@ -27,11 +27,6 @@ class App extends Component {
nodeSelection: PropTypes.object
};
componentWillMount() {
let { handleWindowResize } = this.props;
window.addEventListener('resize', handleWindowResize);
}
render() {
let {
children,
@ -41,11 +36,11 @@ class App extends Component {
changeNode,
nodeSelection
} = this.props;
let headerProps = {
changeLanguage,
languageSelection,
location,
changeNode,
nodeSelection
};

View File

@ -79,7 +79,7 @@ export default class WantToSwapMy extends Component {
}
render() {
let {
const {
originAmount,
destinationAmount,
originKind,
@ -90,7 +90,7 @@ export default class WantToSwapMy extends Component {
return (
<article className="swap-panel">
<h1 className="ng-scope">{translate('SWAP_init_1')}</h1>
<h1>{translate('SWAP_init_1')}</h1>
<input
className={`form-control ${(this.props.originAmount !== '' && this.props.originAmount > 0) ? 'is-valid' : 'is-invalid'}`}

View File

@ -6,7 +6,7 @@ import {
SWAP_UPDATE_BITY_RATES
} from 'actions/swap';
import {without} from 'lodash';
import without from 'lodash/without';
const ALL_CRYPTO_KIND_OPTIONS = ['BTC', 'ETH', 'REP'];
const initialState = {