From bcb1197dfb536f783c711fdc20226759abc55d4c Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 19 Aug 2021 23:20:01 +0200 Subject: [PATCH] fixes for flow and linter --- ui/component/txoList/view.jsx | 19 ++++++++++++++----- ui/component/walletBalance/view.jsx | 1 - .../walletFiatAccountHistory/view.jsx | 1 - ui/component/walletFiatBalance/view.jsx | 13 +++---------- ui/page/wallet/view.jsx | 4 ---- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/ui/component/txoList/view.jsx b/ui/component/txoList/view.jsx index 436a11974..897da504e 100644 --- a/ui/component/txoList/view.jsx +++ b/ui/component/txoList/view.jsx @@ -39,9 +39,11 @@ type Props = { }; type Delta = { - dkey: string, - value: string, - tab: string + dkey?: string, + value?: string, + tab?: string, + currency?: string, + fiatType?: string }; function TxoList(props: Props) { @@ -197,10 +199,17 @@ function TxoList(props: Props) { function updateUrl(delta: Delta) { const newUrlParams = new URLSearchParams(); + // fix for flow, maybe there is a better way? + if (!delta.value) { + delta.value = ''; + } + const existingFiatType = newUrlParams.get('fiatType') || 'incoming'; - // set tab name to account for wallet page tab - newUrlParams.set('tab', delta.tab); + if (delta.tab) { + // set tab name to account for wallet page tab + newUrlParams.set('tab', delta.tab); + } // only update currency if it's being changed if (delta.currency) { diff --git a/ui/component/walletBalance/view.jsx b/ui/component/walletBalance/view.jsx index 4b6c06ca5..71d4dba67 100644 --- a/ui/component/walletBalance/view.jsx +++ b/ui/component/walletBalance/view.jsx @@ -10,7 +10,6 @@ import Card from 'component/common/card'; import LbcSymbol from 'component/common/lbc-symbol'; import I18nMessage from 'component/i18nMessage'; import { formatNumberWithCommas } from 'util/number'; -import Icon from 'component/common/icon'; import WalletFiatBalance from 'component/walletFiatBalance'; type Props = { diff --git a/ui/component/walletFiatAccountHistory/view.jsx b/ui/component/walletFiatAccountHistory/view.jsx index 07616c2f7..b9b7dbd19 100644 --- a/ui/component/walletFiatAccountHistory/view.jsx +++ b/ui/component/walletFiatAccountHistory/view.jsx @@ -1,7 +1,6 @@ // @flow import React from 'react'; import Button from 'component/button'; -import Card from 'component/common/card'; import moment from 'moment'; type Props = { diff --git a/ui/component/walletFiatBalance/view.jsx b/ui/component/walletFiatBalance/view.jsx index a58373e7f..f8bfc874f 100644 --- a/ui/component/walletFiatBalance/view.jsx +++ b/ui/component/walletFiatBalance/view.jsx @@ -7,16 +7,10 @@ import Card from 'component/common/card'; import Icon from 'component/common/icon'; import I18nMessage from 'component/i18nMessage'; import { Lbryio } from 'lbryinc'; -import { STRIPE_PUBLIC_KEY } from 'config'; +import { getStripeEnvironment } from 'util/stripe'; +let stripeEnvironment = getStripeEnvironment(); -let stripeEnvironment = 'test'; -// if the key contains pk_live it's a live key -// update the environment for the calls to the backend to indicate which environment to hit -if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) { - stripeEnvironment = 'live'; -} - -const WalletBalance = (props: Props) => { +const WalletBalance = () => { const [accountStatusResponse, setAccountStatusResponse] = React.useState(); function getAccountStatus() { @@ -40,7 +34,6 @@ const WalletBalance = (props: Props) => { const response = await getAccountStatus(); setAccountStatusResponse(response); - } catch (err) { console.log(err); } diff --git a/ui/page/wallet/view.jsx b/ui/page/wallet/view.jsx index a2c071327..cd667949a 100644 --- a/ui/page/wallet/view.jsx +++ b/ui/page/wallet/view.jsx @@ -7,9 +7,7 @@ import Page from 'component/page'; import * as PAGES from 'constants/pages'; import Spinner from 'component/spinner'; import YrblWalletEmpty from 'component/yrblWalletEmpty'; -import { Lbryio } from 'lbryinc'; import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs'; -import { getStripeEnvironment } from 'util/stripe'; const TAB_QUERY = 'tab'; @@ -19,8 +17,6 @@ const TABS = { PAYMENT_HISTORY: 'fiat-payment-history', }; -let stripeEnvironment = getStripeEnvironment(); - type Props = { history: { action: string, push: (string) => void, replace: (string) => void }, location: { search: string, pathname: string },