From 01902f8e0b6fe170792822255314738c654ff68f Mon Sep 17 00:00:00 2001 From: Anthony Date: Wed, 28 Jul 2021 23:10:46 +0200 Subject: [PATCH] transaction listing working --- ui/component/walletFiatBalance/view.jsx | 4 +- ui/component/walletFiatTransactions/view.jsx | 70 ++++++++++++++++---- ui/page/wallet/view.jsx | 46 +++++++++++-- 3 files changed, 99 insertions(+), 21 deletions(-) diff --git a/ui/component/walletFiatBalance/view.jsx b/ui/component/walletFiatBalance/view.jsx index 284e27caa..7e099cbe4 100644 --- a/ui/component/walletFiatBalance/view.jsx +++ b/ui/component/walletFiatBalance/view.jsx @@ -136,8 +136,8 @@ const WalletBalance = (props: Props) => { )}
-
} diff --git a/ui/component/walletFiatTransactions/view.jsx b/ui/component/walletFiatTransactions/view.jsx index 7c68ee2b2..61ef1c43f 100644 --- a/ui/component/walletFiatTransactions/view.jsx +++ b/ui/component/walletFiatTransactions/view.jsx @@ -12,6 +12,7 @@ import LbcSymbol from 'component/common/lbc-symbol'; import I18nMessage from 'component/i18nMessage'; import { formatNumberWithCommas } from 'util/number'; import { Lbryio } from 'lbryinc'; +import moment from 'moment'; type Props = { balance: number, @@ -30,6 +31,7 @@ type Props = { massClaimIsPending: boolean, utxoCounts: { [string]: number }, accountDetails: any, + transactions: any, }; export const WALLET_CONSOLIDATE_UTXOS = 400; @@ -51,6 +53,9 @@ const WalletBalance = (props: Props) => { massClaimIsPending, utxoCounts, } = props; + + const accountTransactions = props.transactions; + const [detailsExpanded, setDetailsExpanded] = React.useState(false); const [accountStatusResponse, setAccountStatusResponse] = React.useState(); @@ -92,19 +97,58 @@ const WalletBalance = (props: Props) => { return ( 313 USD} - subtitle={ - totalLocked > 0 ? ( - - This is your remaining balance that can still be withdrawn to your bank account - - ) : ( - {__('Your total balance.')} - ) - } - body={ -

Hello!

- } + title={'Tip History'} + body={accountTransactions && accountTransactions.length > 0 && ( + <> +
+ + + + + + + + + + + + + + {accountTransactions && + accountTransactions.map((transaction) => ( + + + + + + + + + + ))} + +
{__('Date')}{<>{__('Receiving Channel Name')}}{__('Tip Location')}{__('Amount (USD)')} {__('Processing Fee')}{__('Odysee Fee')}{__('Received Amount')}
{moment(transaction.created_at).format('LLL')} + + ${transaction.tipped_amount / 100}${transaction.transaction_fee / 100}${transaction.application_fee / 100}${transaction.received_amount / 100}
+
+ + )} actions={ <> {accountStatusResponse && accountStatusResponse.charges_enabled &&

Charges Enabled: True

} diff --git a/ui/page/wallet/view.jsx b/ui/page/wallet/view.jsx index 82076f149..8a470b8ea 100644 --- a/ui/page/wallet/view.jsx +++ b/ui/page/wallet/view.jsx @@ -19,18 +19,30 @@ type Props = { const WalletPage = (props: Props) => { console.log(props); - var environment = 'test'; + var stripeEnvironment = 'test'; const tab = new URLSearchParams(props.location.search).get('tab'); const [accountStatusResponse, setAccountStatusResponse] = React.useState(); + const [accountTransactionResponse, setAccountTransactionResponse] = React.useState(); function getAccountStatus(){ return Lbryio.call( 'account', 'status', { - environment + environment: stripeEnvironment, + }, + 'post' + ); + } + + function getAccountTransactionsa(){ + return Lbryio.call( + 'account', + 'list', + { + environment: stripeEnvironment, }, 'post' ); @@ -38,11 +50,33 @@ const WalletPage = (props: Props) => { React.useEffect(() => { (async function(){ - const response = await getAccountStatus(); + try { + const response = await getAccountStatus(); + + console.log('account status'); + + console.log(response); + + setAccountStatusResponse(response); + + // TODO: some weird naming clash + const getAccountTransactions = await getAccountTransactionsa(); + + console.log('transactions'); + + setAccountTransactionResponse(getAccountTransactions) + + console.log(getAccountTransactions); + + } catch (err){ + + + + + + } - setAccountStatusResponse(response); - console.log(response); })(); }, []); @@ -111,7 +145,7 @@ const WalletPage = (props: Props) => {
- {/**/} +
)}