diff --git a/app/components/Contacts/SubmitChannelForm.js b/app/components/Contacts/SubmitChannelForm.js index 5a656c88..4d5d5d0f 100644 --- a/app/components/Contacts/SubmitChannelForm.js +++ b/app/components/Contacts/SubmitChannelForm.js @@ -37,6 +37,9 @@ class SubmitChannelForm extends React.Component { } const formSubmitted = () => { + // dont submit to LND if they havent set channel capacity amount + if (contactCapacity > 0) { return } + // submit the channel to LND openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactCapacity }) diff --git a/app/components/Wallet/Wallet.js b/app/components/Wallet/Wallet.js index 74de945d..847d396b 100644 --- a/app/components/Wallet/Wallet.js +++ b/app/components/Wallet/Wallet.js @@ -23,10 +23,19 @@ const Wallet = ({ openRequestForm, showPayLoadingScreen, showSuccessPayScreen, - successTransactionScreen + successTransactionScreen, + currentCurrencyFilters, + currencyName, + setCurrency, + setWalletCurrencyFilters }) => { const usdAmount = btc.satoshisToUsd((parseInt(balance.walletBalance, 10) + parseInt(balance.channelBalance, 10)), currentTicker.price_usd) + const onCurrencyFilterClick = (currency) => { + setCurrency(currency) + setWalletCurrencyFilters(false) + } + return (
@@ -45,19 +54,31 @@ const Wallet = ({
- + + +

- {btc.renderCurrency(ticker.currency)} - - - +
+ {currencyName} + setWalletCurrencyFilters(!info.showWalletCurrencyFilters)}> + + + +
    + { + currentCurrencyFilters.map(filter => +
  • onCurrencyFilterClick(filter.key)}>{filter.name}
  • ) + } +
+

≈ ${usdAmount ? usdAmount.toLocaleString() : ''} diff --git a/app/components/Wallet/Wallet.scss b/app/components/Wallet/Wallet.scss index 2ad5670f..7b9b8ecd 100644 --- a/app/components/Wallet/Wallet.scss +++ b/app/components/Wallet/Wallet.scss @@ -43,8 +43,12 @@ display: flex; flex-direction: row; + .qrCode { + cursor: pointer; + } + .bitcoinLogo svg { - width: 32px; + width: 20px; height: 32px; } @@ -83,6 +87,40 @@ .currency { margin-left: 2.5px; } + + .currencyContainer { + position: relative; + display: inline-block; + + svg { + width: 25px; + height: 32px; + color: $white; + } + + ul { + visibility: hidden; + position: absolute; + top: 30px; + + &.active { + visibility: visible; + } + + li { + font-size: 12px; + padding: 0px 15px; + background: #191919; + cursor: pointer; + transition: 0.25s hover; + border-bottom: 1px solid #0f0f0f; + + &:hover { + background: #0f0f0f; + } + } + } + } } .tickerButtons { diff --git a/app/reducers/contactsform.js b/app/reducers/contactsform.js index 6c9f6f8c..5dd7ee1d 100644 --- a/app/reducers/contactsform.js +++ b/app/reducers/contactsform.js @@ -15,7 +15,7 @@ const initialState = { searchQuery: '', manualSearchQuery: '', - contactCapacity: 0.1, + contactCapacity: 0, node: {}, showErrors: { manualInput: false diff --git a/app/reducers/info.js b/app/reducers/info.js index 69f16f33..1de99d91 100644 --- a/app/reducers/info.js +++ b/app/reducers/info.js @@ -7,6 +7,7 @@ import { blockExplorer } from 'utils' // ------------------------------------ export const GET_INFO = 'GET_INFO' export const RECEIVE_INFO = 'RECEIVE_INFO' +export const SET_WALLET_CURRENCY_FILTERS = 'SET_WALLET_CURRENCY_FILTERS' // ------------------------------------ // Actions @@ -17,6 +18,13 @@ export function getInfo() { } } +export function setWalletCurrencyFilters(showWalletCurrencyFilters) { + return { + type: SET_WALLET_CURRENCY_FILTERS, + showWalletCurrencyFilters + } +} + // Send IPC event for getinfo export const fetchInfo = () => async (dispatch) => { dispatch(getInfo()) @@ -36,7 +44,8 @@ export const receiveInfo = (event, data) => (dispatch) => { // ------------------------------------ const ACTION_HANDLERS = { [GET_INFO]: state => ({ ...state, infoLoading: true }), - [RECEIVE_INFO]: (state, { data }) => ({ ...state, infoLoading: false, data }) + [RECEIVE_INFO]: (state, { data }) => ({ ...state, infoLoading: false, data }), + [SET_WALLET_CURRENCY_FILTERS]: (state, { showWalletCurrencyFilters }) => ({ ...state, showWalletCurrencyFilters }) } // ------------------------------------ @@ -44,7 +53,8 @@ const ACTION_HANDLERS = { // ------------------------------------ const initialState = { infoLoading: false, - data: {} + data: {}, + showWalletCurrencyFilters: false } // Selectors diff --git a/app/reducers/ticker.js b/app/reducers/ticker.js index 0350aff2..4069643a 100644 --- a/app/reducers/ticker.js +++ b/app/reducers/ticker.js @@ -64,7 +64,7 @@ export const receiveCryptocurrency = (event, currency) => (dispatch) => { // Action Handlers // ------------------------------------ const ACTION_HANDLERS = { - [SET_CURRENCY]: (state, { currency }) => ({ ...state, currency }), + [SET_CURRENCY]: (state, { currency }) => ({ ...state, fromCurrency: state.currency, currency }), [SET_CRYPTO]: (state, { crypto }) => ({ ...state, crypto }), [GET_TICKERS]: state => ({ ...state, tickerLoading: true }), [RECIEVE_TICKERS]: (state, { btcTicker, ltcTicker }) => ( @@ -113,6 +113,7 @@ export { tickerSelectors } const initialState = { tickerLoading: false, currency: '', + fromCurrency: 'sats', crypto: '', btcTicker: null, ltcTicker: null, diff --git a/app/routes/activity/containers/ActivityContainer.js b/app/routes/activity/containers/ActivityContainer.js index 8f2b1f75..3fc3702e 100644 --- a/app/routes/activity/containers/ActivityContainer.js +++ b/app/routes/activity/containers/ActivityContainer.js @@ -25,6 +25,8 @@ import { setFormType } from 'reducers/form' import { payFormSelectors } from 'reducers/payform' +import { setWalletCurrencyFilters } from 'reducers/info' + import Activity from '../components/Activity' const mapDispatchToProps = { @@ -42,7 +44,8 @@ const mapDispatchToProps = { openWalletModal, fetchBalance, updateSearchText, - setFormType + setFormType, + setWalletCurrencyFilters } const mapStateToProps = state => ({ @@ -64,6 +67,8 @@ const mapStateToProps = state => ({ invoiceModalOpen: invoiceSelectors.invoiceModalOpen(state), currentTicker: tickerSelectors.currentTicker(state), + currentCurrencyFilters: tickerSelectors.currentCurrencyFilters(state), + currencyName: tickerSelectors.currencyName(state), currentActivity: activitySelectors.currentActivity(state)(state), nonActiveFilters: activitySelectors.nonActiveFilters(state), @@ -81,8 +86,11 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { showPayLoadingScreen: stateProps.showPayLoadingScreen, showSuccessPayScreen: stateProps.payment.showSuccessPayScreen, successTransactionScreen: stateProps.transaction.successTransactionScreen, + currentCurrencyFilters: stateProps.currentCurrencyFilters, + currencyName: stateProps.currencyName, setCurrency: dispatchProps.setCurrency, + setWalletCurrencyFilters: dispatchProps.setWalletCurrencyFilters, newAddress: dispatchProps.newAddress, openReceiveModal: dispatchProps.openWalletModal, openPayForm: () => dispatchProps.setFormType('PAY_FORM'), diff --git a/app/utils/btc.js b/app/utils/btc.js index 5abef070..cc17ac97 100644 --- a/app/utils/btc.js +++ b/app/utils/btc.js @@ -52,6 +52,7 @@ export function bitsToUsd(bits, price) { export function satoshisToBtc(satoshis) { if (satoshis === undefined || satoshis === null || satoshis === '') return null + console.log('satoshis: ', satoshis) const btcAmount = sb.toBitcoin(satoshis).toFixed(8) return btcAmount > 0 ? btcAmount : btcAmount * -1 }