cleaning up code

This commit is contained in:
Anthony 2021-08-19 19:55:06 +02:00
parent 8c9af6aa1d
commit 29cec219d3
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
4 changed files with 16 additions and 78 deletions

View file

@ -336,8 +336,8 @@ function TxoList(props: Props) {
// </div> // </div>
} }
isBodyList isBodyList
body={ currency === 'credits' ? body={currency === 'credits'
<div> ? <div>
<div className="card__body-actions"> <div className="card__body-actions">
<div className="card__actions"> <div className="card__actions">
<div> <div>
@ -438,8 +438,8 @@ function TxoList(props: Props) {
<TransactionListTable txos={txoPage} /> <TransactionListTable txos={txoPage} />
<Paginate totalPages={Math.ceil(txoItemCount / Number(pageSize))} /> <Paginate totalPages={Math.ceil(txoItemCount / Number(pageSize))} />
</div> </div>
// fiat section
: <div> : <div>
{/* fiat section (buttons and transactions) */}
<div className="section card-stack"> <div className="section card-stack">
<div className="card__body-actions"> <div className="card__body-actions">
<div className="card__actions"> <div className="card__actions">
@ -464,14 +464,6 @@ function TxoList(props: Props) {
})} })}
label={__('Outgoing')} label={__('Outgoing')}
/> />
{/*<Button*/}
{/* button="alt"*/}
{/* onClick={(e) => handleChange({ dkey: TXO.ACTIVE, value: 'all', tab, currency: 'fiat' })}*/}
{/* className={classnames(`button-toggle`, {*/}
{/* 'button-toggle--active': active === 'all',*/}
{/* })}*/}
{/* label={__('Payouts')}*/}
{/*/>*/}
</div> </div>
</fieldset-section> </fieldset-section>
</div> </div>
@ -482,7 +474,7 @@ function TxoList(props: Props) {
{ fiatType === 'incoming' && <WalletFiatAccountHistory transactions={accountTransactionResponse} /> } { fiatType === 'incoming' && <WalletFiatAccountHistory transactions={accountTransactionResponse} /> }
{ fiatType === 'outgoing' && <WalletFiatPaymentHistory transactions={customerTransactions} /> } { fiatType === 'outgoing' && <WalletFiatPaymentHistory transactions={customerTransactions} /> }
{/* TODO: have to finish pagination */} {/* 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

@ -12,7 +12,6 @@ import I18nMessage from 'component/i18nMessage';
import { formatNumberWithCommas } from 'util/number'; import { formatNumberWithCommas } from 'util/number';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
type Props = { type Props = {
balance: number, balance: number,
totalBalance: number, totalBalance: number,

View file

@ -1,7 +1,6 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
import Card from 'component/common/card';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import moment from 'moment'; import moment from 'moment';
import { STRIPE_PUBLIC_KEY } from 'config'; import { STRIPE_PUBLIC_KEY } from 'config';
@ -22,10 +21,6 @@ const WalletBalance = (props: Props) => {
// receive transactions from parent component // receive transactions from parent component
const { transactions: accountTransactions } = props; const { transactions: accountTransactions } = props;
// const [accountStatusResponse, setAccountStatusResponse] = React.useState();
// const [subscriptions, setSubscriptions] = React.useState();
const [lastFour, setLastFour] = React.useState(); const [lastFour, setLastFour] = React.useState();
function getCustomerStatus() { function getCustomerStatus() {
@ -55,6 +50,7 @@ const WalletBalance = (props: Props) => {
<div className="section card-stack"> <div className="section card-stack">
<div className="table__wrapper"> <div className="table__wrapper">
<table className="table table--transactions"> <table className="table table--transactions">
{/* table header */}
<thead> <thead>
<tr> <tr>
<th className="date-header">{__('Date')}</th> <th className="date-header">{__('Date')}</th>
@ -65,11 +61,14 @@ const WalletBalance = (props: Props) => {
<th>{__('Anonymous')}</th> <th>{__('Anonymous')}</th>
</tr> </tr>
</thead> </thead>
{/* list data for transactions */}
<tbody> <tbody>
{accountTransactions && {accountTransactions &&
accountTransactions.map((transaction) => ( accountTransactions.map((transaction) => (
<tr key={transaction.name + transaction.created_at}> <tr key={transaction.name + transaction.created_at}>
{/* date */}
<td>{moment(transaction.created_at).format('LLL')}</td> <td>{moment(transaction.created_at).format('LLL')}</td>
{/* receiving channel name */}
<td> <td>
<Button <Button
className="" className=""
@ -78,6 +77,7 @@ const WalletBalance = (props: Props) => {
button="link" button="link"
/> />
</td> </td>
{/* link to content or channel */}
<td> <td>
<Button <Button
className="" className=""
@ -90,8 +90,12 @@ const WalletBalance = (props: Props) => {
button="link" button="link"
/> />
</td> </td>
{/* how much tipped */}
<td>${transaction.tipped_amount / 100}</td> <td>${transaction.tipped_amount / 100}</td>
{/* TODO: this is incorrect need it per transactions not per user */}
{/* last four of credit card */}
<td>{lastFour}</td> <td>{lastFour}</td>
{/* whether tip is anonymous or not */}
<td>{transaction.private_tip ? 'Yes' : 'No'}</td> <td>{transaction.private_tip ? 'Yes' : 'No'}</td>
</tr> </tr>
))} ))}

View file

@ -2,10 +2,6 @@
import React from 'react'; import React from 'react';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import WalletBalance from 'component/walletBalance'; 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 TxoList from 'component/txoList';
import Page from 'component/page'; import Page from 'component/page';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
@ -78,21 +74,6 @@ const WalletPage = (props: Props) => {
push(url); 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() { function getAccountStatus() {
return Lbryio.call( return Lbryio.call(
'account', '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 { totalBalance } = props;
const showIntro = totalBalance === 0; const showIntro = totalBalance === 0;
const loading = totalBalance === undefined; const loading = totalBalance === undefined;
@ -142,14 +97,13 @@ 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>{__('Analytics')}</Tab>*/}
</TabList> </TabList>
<TabPanels> <TabPanels>
{/* balances for lbc and fiat */} {/* balances for lbc and fiat */}
<TabPanel> <TabPanel>
<WalletBalance /> <WalletBalance />
</TabPanel> </TabPanel>
{/* transactions panel */}
<TabPanel> <TabPanel>
<div className="section card-stack"> <div className="section card-stack">
<div className="lbc-transactions"> <div className="lbc-transactions">
@ -174,17 +128,6 @@ const WalletPage = (props: Props) => {
</div> </div>
</div> </div>
</TabPanel> </TabPanel>
{/*<TabPanel>*/}
{/* <div className="section card-stack">*/}
{/* <WalletFiatPaymentHistory transactions={customerTransactions} />*/}
{/* <WalletFiatAccountHistory transactions={accountTransactionResponse} />*/}
{/* </div>*/}
{/*</TabPanel>*/}
{/*<TabPanel>*/}
{/* <div className="section card-stack">*/}
{/* <h2> Coming soon! </h2>*/}
{/* </div>*/}
{/*</TabPanel>*/}
</TabPanels> </TabPanels>
</Tabs> </Tabs>
</Page> </Page>