coming along well

This commit is contained in:
Anthony 2021-08-19 19:41:58 +02:00
parent 32e6762ba8
commit 8c9af6aa1d
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
4 changed files with 23 additions and 43 deletions

View file

@ -104,7 +104,9 @@ function TxoList(props: Props) {
// console.log('amount of transactions'); // console.log('amount of transactions');
// console.log(customerTransactionResponse.length); // console.log(customerTransactionResponse.length);
customerTransactionResponse.reverse(); if(customerTransactionResponse && customerTransactionResponse.length){
customerTransactionResponse.reverse();
}
setCustomerTransactions(customerTransactionResponse); setCustomerTransactions(customerTransactionResponse);
} catch (err) { } catch (err) {
@ -477,8 +479,9 @@ function TxoList(props: Props) {
</div> </div>
</div> </div>
{/* listing of the transactions */} {/* listing of the transactions */}
{ fiatType === 'incoming' && <WalletFiatPaymentHistory transactions={accountTransactionResponse} /> } { fiatType === 'incoming' && <WalletFiatAccountHistory transactions={accountTransactionResponse} /> }
{ fiatType === 'outgoing' && <WalletFiatAccountHistory transactions={customerTransactions} /> } { fiatType === 'outgoing' && <WalletFiatPaymentHistory transactions={customerTransactions} /> }
{/* TODO: have to finish pagination */}
<Paginate totalPages={Math.ceil(txoItemCount / Number(pageSize))} /> <Paginate totalPages={Math.ceil(txoItemCount / Number(pageSize))} />
</div> </div>
</div> </div>

View file

@ -21,9 +21,9 @@ const WalletBalance = (props: Props) => {
} }
// if there are more than 10 transactions, limit it to 10 for the frontend // if there are more than 10 transactions, limit it to 10 for the frontend
if (accountTransactions && accountTransactions.length > 10) { // if (accountTransactions && accountTransactions.length > 10) {
accountTransactions.length = 10; // accountTransactions.length = 10;
} // }
return ( return (
<div className="table__wrapper"> <div className="table__wrapper">

View file

@ -22,10 +22,6 @@ const WalletBalance = (props: Props) => {
// receive transactions from parent component // receive transactions from parent component
const { transactions: accountTransactions } = props; const { transactions: accountTransactions } = props;
// console.log(accountTransactions.length);
// console.log('wallet transactions length');
// const [accountStatusResponse, setAccountStatusResponse] = React.useState(); // const [accountStatusResponse, setAccountStatusResponse] = React.useState();
// const [subscriptions, setSubscriptions] = React.useState(); // const [subscriptions, setSubscriptions] = React.useState();
@ -101,6 +97,7 @@ const WalletBalance = (props: Props) => {
))} ))}
</tbody> </tbody>
</table> </table>
{/* show some markup if there's no transactions */}
{(!accountTransactions || accountTransactions.length === 0) && <p style={{textAlign: 'center', marginTop: '20px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Transactions</p>} {(!accountTransactions || accountTransactions.length === 0) && <p style={{textAlign: 'center', marginTop: '20px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Transactions</p>}
</div> </div>
</div> </div>

View file

@ -122,27 +122,6 @@ const WalletPage = (props: Props) => {
const response = await getAccountStatus(); const response = await getAccountStatus();
setAccountStatusResponse(response); setAccountStatusResponse(response);
// TODO: some weird naming clash hence getAccountTransactionsa
const getAccountTransactions = await getAccountTransactionsa();
setAccountTransactionResponse(getAccountTransactions);
} catch (err) {
console.log(err);
}
})();
}, []);
// populate customer payment data
React.useEffect(() => {
(async function() {
try {
// get card payments customer has made
let customerTransactionResponse = await getPaymentHistory();
customerTransactionResponse.reverse();
setCustomerTransactions(customerTransactionResponse);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
@ -163,10 +142,11 @@ const WalletPage = (props: Props) => {
<TabList className="tabs__list--collection-edit-page"> <TabList className="tabs__list--collection-edit-page">
<Tab>{__('Balance')}</Tab> <Tab>{__('Balance')}</Tab>
<Tab>{__('Transactions')}</Tab> <Tab>{__('Transactions')}</Tab>
<Tab>{__('Subscriptions')}</Tab> {/*<Tab>{__('Subscriptions')}</Tab>*/}
{/*<Tab>{__('Analytics')}</Tab>*/} {/*<Tab>{__('Analytics')}</Tab>*/}
</TabList> </TabList>
<TabPanels> <TabPanels>
{/* balances for lbc and fiat */}
<TabPanel> <TabPanel>
<WalletBalance /> <WalletBalance />
</TabPanel> </TabPanel>
@ -194,17 +174,17 @@ const WalletPage = (props: Props) => {
</div> </div>
</div> </div>
</TabPanel> </TabPanel>
<TabPanel> {/*<TabPanel>*/}
<div className="section card-stack"> {/* <div className="section card-stack">*/}
<WalletFiatPaymentHistory transactions={customerTransactions} /> {/* <WalletFiatPaymentHistory transactions={customerTransactions} />*/}
<WalletFiatAccountHistory transactions={accountTransactionResponse} /> {/* <WalletFiatAccountHistory transactions={accountTransactionResponse} />*/}
</div> {/* </div>*/}
</TabPanel> {/*</TabPanel>*/}
<TabPanel> {/*<TabPanel>*/}
<div className="section card-stack"> {/* <div className="section card-stack">*/}
<h2> Coming soon! </h2> {/* <h2> Coming soon! </h2>*/}
</div> {/* </div>*/}
</TabPanel> {/*</TabPanel>*/}
</TabPanels> </TabPanels>
</Tabs> </Tabs>
</Page> </Page>