From 7281e6cd71f6ac4df2e6f30b8b26c3297df69e0a Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 13 Aug 2021 17:59:50 +0200 Subject: [PATCH] fix transactions bug --- ui/page/wallet/view.jsx | 46 ++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/ui/page/wallet/view.jsx b/ui/page/wallet/view.jsx index edfcdf29a..9df6c5f08 100644 --- a/ui/page/wallet/view.jsx +++ b/ui/page/wallet/view.jsx @@ -14,7 +14,6 @@ import YrblWalletEmpty from 'component/yrblWalletEmpty'; import { Lbryio } from 'lbryinc'; import { SIMPLE_SITE, STRIPE_PUBLIC_KEY } from 'config'; import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs'; -import Card from 'component/common/card'; import { PAGE_VIEW_QUERY } from '../channel/view'; const TAB_QUERY = 'tab'; @@ -44,6 +43,7 @@ const WalletPage = (props: Props) => { push, } = useHistory(); + // @if TARGET='web' const urlParams = new URLSearchParams(search); const currentView = urlParams.get(TAB_QUERY) || TABS.LBRY_CREDITS_TAB; @@ -82,7 +82,6 @@ const WalletPage = (props: Props) => { const [accountStatusResponse, setAccountStatusResponse] = React.useState(); const [accountTransactionResponse, setAccountTransactionResponse] = React.useState([]); const [customerTransactions, setCustomerTransactions] = React.useState([]); - const [totalTippedAmount, setTotalTippedAmount] = React.useState(0); function getPaymentHistory() { return Lbryio.call( @@ -142,14 +141,6 @@ const WalletPage = (props: Props) => { // get card payments customer has made const customerTransactionResponse = await getPaymentHistory(); - let totalTippedAmount = 0; - - for (const transaction of customerTransactionResponse) { - totalTippedAmount = totalTippedAmount + transaction.tipped_amount; - } - - setTotalTippedAmount(totalTippedAmount / 100); - setCustomerTransactions(customerTransactionResponse); } catch (err) { console.log(err); @@ -157,14 +148,15 @@ const WalletPage = (props: Props) => { })(); }, []); - const { location, totalBalance } = props; - // const { search } = location; + // @endif + + const { totalBalance } = props; const showIntro = totalBalance === 0; const loading = totalBalance === undefined; + // @if TARGET='web' return ( - {__('LBRY Credits')} @@ -205,7 +197,7 @@ const WalletPage = (props: Props) => {
- +
@@ -213,6 +205,32 @@ const WalletPage = (props: Props) => {
); + // @endif + // @if TARGET='app' + // eslint-disable-next-line no-unreachable + return ( + + {loading && ( +
+ +
+ )} + {!loading && ( + <> + {showIntro ? ( + + ) : ( +
+ + +
+ )} + + )} +
+ ); + // @endif + }; export default WalletPage;