From 86e3e8593a83d5484c15d59b002c61252e519112 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 27 Aug 2021 13:07:16 +0800 Subject: [PATCH] Lint/prettier to reduce delta in next PR. This is mainly to make the next PR's delta readable. Seems like lint/prettier is being bypassed in the commit hook. --- ui/component/txoList/view.jsx | 259 +++++++++--------- .../walletFiatAccountHistory/view.jsx | 77 +++--- ui/component/walletFiatBalance/view.jsx | 71 +++-- .../walletFiatPaymentHistory/view.jsx | 103 +++---- 4 files changed, 273 insertions(+), 237 deletions(-) diff --git a/ui/component/txoList/view.jsx b/ui/component/txoList/view.jsx index 3c1a574b5..f88dcdc1c 100644 --- a/ui/component/txoList/view.jsx +++ b/ui/component/txoList/view.jsx @@ -86,7 +86,7 @@ function TxoList(props: Props) { // calculate account transactions section React.useEffect(() => { - (async function() { + (async function () { try { const accountTransactionResponse = await getAccountTransactions(); @@ -109,7 +109,7 @@ function TxoList(props: Props) { // populate customer payment data React.useEffect(() => { - (async function() { + (async function () { try { // get card payments customer has made let customerTransactionResponse = await getPaymentHistory(); @@ -122,7 +122,11 @@ function TxoList(props: Props) { } // TODO: remove this once pagination is implemented - if (customerTransactionResponse && customerTransactionResponse.length && customerTransactionResponse.length > 25) { + if ( + customerTransactionResponse && + customerTransactionResponse.length && + customerTransactionResponse.length > 25 + ) { customerTransactionResponse.length = 25; } @@ -312,9 +316,10 @@ function TxoList(props: Props) { return (
{__(`Transactions`)}
+ <> +
{__(`Transactions`)}
- + {/* toggle between LBC and fiat buttons */}
{/* toggle to LBC */} @@ -339,49 +344,30 @@ function TxoList(props: Props) {
- } isBodyList - body={currency === 'credits' - ?
- {/* LBC transactions section */} -
-
-
-
- {/* LBC transaction type dropdown */} - - {__('Type')} - - - } - value={type || 'all'} - onChange={(e) => handleChange({ changedParameterKey: TXO.TYPE, value: e.target.value, tab })} - > - {Object.values(TXO.DROPDOWN_TYPES).map((v) => { - const stringV = String(v); - return ( - - ); - })} - -
- {(type === TXO.SENT || type === TXO.RECEIVED) && ( + body={ + currency === 'credits' ? ( +
+ {/* LBC transactions section */} +
+
+
+ {/* LBC transaction type dropdown */} handleChange({ changedParameterKey: TXO.SUB_TYPE, value: e.target.value, tab })} + name="type" + label={ + <> + {__('Type')} + + + } + value={type || 'all'} + onChange={(e) => handleChange({ changedParameterKey: TXO.TYPE, value: e.target.value, tab })} > - {Object.values(TXO.DROPDOWN_SUBTYPES).map((v) => { + {Object.values(TXO.DROPDOWN_TYPES).map((v) => { const stringV = String(v); return (
- )} - {!hideStatus && ( + {(type === TXO.SENT || type === TXO.RECEIVED) && ( +
+ + handleChange({ changedParameterKey: TXO.SUB_TYPE, value: e.target.value, tab }) + } + > + {Object.values(TXO.DROPDOWN_SUBTYPES).map((v) => { + const stringV = String(v); + return ( + + ); + })} + +
+ )} + {!hideStatus && ( +
+ + +
+ {/* active transactions button */} +
+
+
+ )} +
+ + {/* export and refresh buttons */} +
+ {!isFetchingTransactions && transactionsFile === null && ( + + )} +
+ fetchTransactions()} + progressMsg={isFetchingTransactions ? __('Fetching data') : ''} + /> +
+
+
+
+ {/* listing of the lbc transactions */} + + +
+ ) : ( +
+ {/* FIAT SECTION ( toggle buttons and transactions) */} +
+
+
- +
- {/* active transactions button */} + {/* incoming transactions button */}
- )} -
- {/* export and refresh buttons */} -
- {!isFetchingTransactions && transactionsFile === null && ( - - )} -
- fetchTransactions()} - progressMsg={isFetchingTransactions ? __('Fetching data') : ''} - /> -
-
-
-
- {/* listing of the lbc transactions */} - - -
- :
- {/* FIAT SECTION ( toggle buttons and transactions) */} -
-
-
-
- - -
- {/* incoming transactions button */} -
-
+ {/* listing of the transactions */} + {fiatType === 'incoming' && } + {fiatType === 'outgoing' && } + {/* TODO: have to finish pagination */} + {/* */}
- {/* listing of the transactions */} - { fiatType === 'incoming' && } - { fiatType === 'outgoing' && } - {/* TODO: have to finish pagination */} - {/* */}
-
+ ) } - /> ); } diff --git a/ui/component/walletFiatAccountHistory/view.jsx b/ui/component/walletFiatAccountHistory/view.jsx index 7e9b688c9..4f5fe1991 100644 --- a/ui/component/walletFiatAccountHistory/view.jsx +++ b/ui/component/walletFiatAccountHistory/view.jsx @@ -28,52 +28,49 @@ const WalletBalance = (props: Props) => {
- - - - - - - - - + + + + + + + + + - {accountTransactions && - accountTransactions.map((transaction) => ( - - - - - - - - - - ))} + {accountTransactions && + accountTransactions.map((transaction) => ( + + + + + + + + + + ))}
{__('Date')}{<>{__('Receiving Channel Name')}}{__('Tip Location')}{__('Amount (USD)')} {__('Processing Fee')}{__('Odysee Fee')}{__('Received Amount')}
{__('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}
{moment(transaction.created_at).format('LLL')} + + ${transaction.tipped_amount / 100}${transaction.transaction_fee / 100}${transaction.application_fee / 100}${transaction.received_amount / 100}
{!accountTransactions &&

No Transactions

}
- ); }; diff --git a/ui/component/walletFiatBalance/view.jsx b/ui/component/walletFiatBalance/view.jsx index a4ef1bb28..9ec24b32e 100644 --- a/ui/component/walletFiatBalance/view.jsx +++ b/ui/component/walletFiatBalance/view.jsx @@ -41,33 +41,56 @@ const WalletBalance = () => { }, [stripeEnvironment]); return ( - <>{{(accountStatusResponse && ((accountStatusResponse.total_received_unpaid - accountStatusResponse.total_paid_out) / 100)) || 0} USD} - subtitle={accountStatusResponse && accountStatusResponse.total_received_unpaid > 0 ? ( - - This is your pending balance that will be automatically sent to your bank account - ) : ( - - When you begin to receive tips your balance will be updated here - ) - } - actions={ - <> -

- ${(accountStatusResponse && (accountStatusResponse.total_received_unpaid / 100)) || 0} Total Received Tips -

+ <> + { + + + {(accountStatusResponse && + (accountStatusResponse.total_received_unpaid - accountStatusResponse.total_paid_out) / 100) || + 0}{' '} + USD + + } + subtitle={ + accountStatusResponse && accountStatusResponse.total_received_unpaid > 0 ? ( + + This is your pending balance that will be automatically sent to your bank account + + ) : ( + When you begin to receive tips your balance will be updated here + ) + } + actions={ + <> +

+ ${(accountStatusResponse && accountStatusResponse.total_received_unpaid / 100) || 0} Total Received Tips +

-

- ${(accountStatusResponse && (accountStatusResponse.total_paid_out / 100)) || 0} Withdrawn -

+

+ ${(accountStatusResponse && accountStatusResponse.total_paid_out / 100) || 0} Withdrawn +

-
-
- +
+
+ + } + /> } - />} + ); }; diff --git a/ui/component/walletFiatPaymentHistory/view.jsx b/ui/component/walletFiatPaymentHistory/view.jsx index 2113947c0..144e53328 100644 --- a/ui/component/walletFiatPaymentHistory/view.jsx +++ b/ui/component/walletFiatPaymentHistory/view.jsx @@ -30,12 +30,15 @@ const WalletBalance = (props: Props) => { // TODO: this is actually incorrect, last4 should be populated based on the transaction not the current customer details React.useEffect(() => { - (async function() { - const customerStatusResponse = await getCustomerStatus(); + (async function () { + const customerStatusResponse = await getCustomerStatus(); - const lastFour = customerStatusResponse.PaymentMethods && customerStatusResponse.PaymentMethods.length && customerStatusResponse.PaymentMethods[0].card.last4; + const lastFour = + customerStatusResponse.PaymentMethods && + customerStatusResponse.PaymentMethods.length && + customerStatusResponse.PaymentMethods[0].card.last4; - setLastFour(lastFour); + setLastFour(lastFour); })(); }, []); @@ -46,60 +49,60 @@ const WalletBalance = (props: Props) => { {/* table header */} - - - - - - - - + + + + + + + + {/* 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 */} - - - ))} + {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 */} + + + ))}
{__('Date')}{<>{__('Receiving Channel Name')}}{__('Tip Location')}{__('Amount (USD)')} {__('Card Last 4')}{__('Anonymous')}
{__('Date')}{<>{__('Receiving Channel Name')}}{__('Tip Location')}{__('Amount (USD)')} {__('Card Last 4')}{__('Anonymous')}
{moment(transaction.created_at).format('LLL')} - - ${transaction.tipped_amount / 100}{lastFour}{transaction.private_tip ? 'Yes' : 'No'}
{moment(transaction.created_at).format('LLL')} + + ${transaction.tipped_amount / 100}{lastFour}{transaction.private_tip ? 'Yes' : 'No'}
{/* show some markup if there's no transactions */} - {(!accountTransactions || accountTransactions.length === 0) &&

No Transactions

} + {(!accountTransactions || accountTransactions.length === 0) && ( +

No Transactions

+ )}
- + ); };