From 29cec219d35de44287b938db4bee6e9eb13b3286 Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 19 Aug 2021 19:55:06 +0200 Subject: [PATCH] cleaning up code --- ui/component/txoList/view.jsx | 20 ++----- ui/component/walletBalance/view.jsx | 1 - .../walletFiatPaymentHistory/view.jsx | 14 +++-- ui/page/wallet/view.jsx | 59 +------------------ 4 files changed, 16 insertions(+), 78 deletions(-) diff --git a/ui/component/txoList/view.jsx b/ui/component/txoList/view.jsx index db094eccb..9153842b5 100644 --- a/ui/component/txoList/view.jsx +++ b/ui/component/txoList/view.jsx @@ -104,7 +104,7 @@ function TxoList(props: Props) { // console.log('amount of transactions'); // console.log(customerTransactionResponse.length); - if(customerTransactionResponse && customerTransactionResponse.length){ + if (customerTransactionResponse && customerTransactionResponse.length) { customerTransactionResponse.reverse(); } @@ -317,7 +317,7 @@ function TxoList(props: Props) { } - titleActions={ <> + titleActions={<> //
// {!isFetchingTransactions && transactionsFile === null && ( // @@ -336,8 +336,8 @@ function TxoList(props: Props) { //
} isBodyList - body={ currency === 'credits' ? -
+ body={currency === 'credits' + ?
@@ -438,8 +438,8 @@ function TxoList(props: Props) {
- // fiat section :
+ {/* fiat section (buttons and transactions) */}
@@ -464,14 +464,6 @@ function TxoList(props: Props) { })} label={__('Outgoing')} /> - {/* handleChange({ dkey: TXO.ACTIVE, value: 'all', tab, currency: 'fiat' })}*/} - {/* className={classnames(`button-toggle`, {*/} - {/* 'button-toggle--active': active === 'all',*/} - {/* })}*/} - {/* label={__('Payouts')}*/} - {/*/>*/}
@@ -482,7 +474,7 @@ function TxoList(props: Props) { { fiatType === 'incoming' && } { fiatType === 'outgoing' && } {/* TODO: have to finish pagination */} - + {/* */}
} diff --git a/ui/component/walletBalance/view.jsx b/ui/component/walletBalance/view.jsx index 777ee838c..b30dc0760 100644 --- a/ui/component/walletBalance/view.jsx +++ b/ui/component/walletBalance/view.jsx @@ -12,7 +12,6 @@ import I18nMessage from 'component/i18nMessage'; import { formatNumberWithCommas } from 'util/number'; import Icon from 'component/common/icon'; - type Props = { balance: number, totalBalance: number, diff --git a/ui/component/walletFiatPaymentHistory/view.jsx b/ui/component/walletFiatPaymentHistory/view.jsx index c6cba4744..f6bf2e796 100644 --- a/ui/component/walletFiatPaymentHistory/view.jsx +++ b/ui/component/walletFiatPaymentHistory/view.jsx @@ -1,7 +1,6 @@ // @flow import React from 'react'; import Button from 'component/button'; -import Card from 'component/common/card'; import { Lbryio } from 'lbryinc'; import moment from 'moment'; import { STRIPE_PUBLIC_KEY } from 'config'; @@ -22,10 +21,6 @@ const WalletBalance = (props: Props) => { // receive transactions from parent component const { transactions: accountTransactions } = props; - // const [accountStatusResponse, setAccountStatusResponse] = React.useState(); - - // const [subscriptions, setSubscriptions] = React.useState(); - const [lastFour, setLastFour] = React.useState(); function getCustomerStatus() { @@ -55,6 +50,7 @@ const WalletBalance = (props: Props) => {
+ {/* table header */} @@ -65,11 +61,14 @@ const WalletBalance = (props: Props) => { + {/* list data for transactions */} {accountTransactions && accountTransactions.map((transaction) => ( + {/* date */} + {/* receiving channel name */} + {/* link to content or channel */} + {/* how much tipped */} + {/* TODO: this is incorrect need it per transactions not per user */} + {/* last four of credit card */} + {/* whether tip is anonymous or not */} ))} diff --git a/ui/page/wallet/view.jsx b/ui/page/wallet/view.jsx index 475085aed..011aeb332 100644 --- a/ui/page/wallet/view.jsx +++ b/ui/page/wallet/view.jsx @@ -2,10 +2,6 @@ import React from 'react'; import { useHistory } from 'react-router'; import WalletBalance from 'component/walletBalance'; -import WalletFiatBalance from 'component/walletFiatBalance'; -import WalletFiatPaymentBalance from 'component/walletFiatPaymentBalance'; -import WalletFiatAccountHistory from 'component/walletFiatAccountHistory'; -import WalletFiatPaymentHistory from 'component/walletFiatPaymentHistory'; import TxoList from 'component/txoList'; import Page from 'component/page'; import * as PAGES from 'constants/pages'; @@ -78,21 +74,6 @@ const WalletPage = (props: Props) => { push(url); } - const [accountStatusResponse, setAccountStatusResponse] = React.useState(); - const [accountTransactionResponse, setAccountTransactionResponse] = React.useState([]); - const [customerTransactions, setCustomerTransactions] = React.useState([]); - - function getPaymentHistory() { - return Lbryio.call( - 'customer', - 'list', - { - environment: stripeEnvironment, - }, - 'post' - ); - } - function getAccountStatus() { return Lbryio.call( 'account', @@ -104,32 +85,6 @@ const WalletPage = (props: Props) => { ); } - function getAccountTransactionsa() { - return Lbryio.call( - 'account', - 'list', - { - environment: stripeEnvironment, - }, - 'post' - ); - } - - // calculate account transactions section - React.useEffect(() => { - (async function() { - try { - const response = await getAccountStatus(); - - setAccountStatusResponse(response); - } catch (err) { - console.log(err); - } - })(); - }, []); - - // @endif - const { totalBalance } = props; const showIntro = totalBalance === 0; const loading = totalBalance === undefined; @@ -142,14 +97,13 @@ const WalletPage = (props: Props) => { {__('Balance')} {__('Transactions')} - {/*{__('Subscriptions')}*/} - {/*{__('Analytics')}*/} {/* balances for lbc and fiat */} + {/* transactions panel */}
@@ -174,17 +128,6 @@ const WalletPage = (props: Props) => {
- {/**/} - {/*
*/} - {/* */} - {/* */} - {/*
*/} - {/*
*/} - {/**/} - {/*
*/} - {/*

Coming soon!

*/} - {/*
*/} - {/*
*/}
{__('Date')}{__('Anonymous')}
{moment(transaction.created_at).format('LLL')} ${transaction.tipped_amount / 100}{lastFour}{transaction.private_tip ? 'Yes' : 'No'}