From ec556141f74455f60d012eca0425e878a46215a1 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Thu, 5 Dec 2019 10:52:53 -0500 Subject: [PATCH] replace eth with weth for publishing --- src/components/base/CurrencySelect.jsx | 18 +++++++++++++++--- src/components/projects/CreateProject.jsx | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/base/CurrencySelect.jsx b/src/components/base/CurrencySelect.jsx index f33e659..6c57693 100644 --- a/src/components/base/CurrencySelect.jsx +++ b/src/components/base/CurrencySelect.jsx @@ -18,7 +18,18 @@ CurrencySelect.propTypes = { showBalances: PropTypes.bool, enableToggles: PropTypes.bool, className: PropTypes.string, - InputProps: PropTypes.object + InputProps: PropTypes.object, + publishing: PropTypes.bool +} + +const orderCurrencies = (currencies, publishing) => { + if (publishing) { + const temp = [...currencies] + let weth = currencies.findIndex(e => e.label === 'WETH') + temp[0] = temp[weth] + return temp.filter(e => e !== undefined) + } + return currencies } function CurrencySelect({ @@ -30,7 +41,8 @@ function CurrencySelect({ showBalances, enableToggles, className, - InputProps + InputProps, + publishing }) { const context = useContext(FundingContext) const { account } = context @@ -87,7 +99,7 @@ function CurrencySelect({ onBlur={onBlur} value={value || ''} > - {!!currencies && currencies.map((option, idx) => ( + {!!currencies && orderCurrencies(currencies, publishing).map((option, idx) => (
{option.icon || { onChange={handleChange} onBlur={handleBlur} value={values.goalToken} + publishing />