transaction listing working
This commit is contained in:
parent
c5e6b0a5a7
commit
01902f8e0b
3 changed files with 99 additions and 21 deletions
|
@ -136,8 +136,8 @@ const WalletBalance = (props: Props) => {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="section__actions">
|
<div className="section__actions">
|
||||||
<Button button="primary" label={__('Receive Payout')} icon={ICONS.SEND} navigate={`/$/${PAGES.SEND}`} />
|
<Button button="primary" label={__('Receive Payout')} icon={ICONS.SEND} />
|
||||||
<Button button="secondary" label={__('Account Configuration')} icon={ICONS.SETTINGS} navigate={`/$/${PAGES.SEND}`} />
|
<Button button="secondary" label={__('Account Configuration')} icon={ICONS.SETTINGS} navigate={`/$/${PAGES.SETTINGS_STRIPE_ACCOUNT}`} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import LbcSymbol from 'component/common/lbc-symbol';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import { formatNumberWithCommas } from 'util/number';
|
import { formatNumberWithCommas } from 'util/number';
|
||||||
import { Lbryio } from 'lbryinc';
|
import { Lbryio } from 'lbryinc';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
balance: number,
|
balance: number,
|
||||||
|
@ -30,6 +31,7 @@ type Props = {
|
||||||
massClaimIsPending: boolean,
|
massClaimIsPending: boolean,
|
||||||
utxoCounts: { [string]: number },
|
utxoCounts: { [string]: number },
|
||||||
accountDetails: any,
|
accountDetails: any,
|
||||||
|
transactions: any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WALLET_CONSOLIDATE_UTXOS = 400;
|
export const WALLET_CONSOLIDATE_UTXOS = 400;
|
||||||
|
@ -51,6 +53,9 @@ const WalletBalance = (props: Props) => {
|
||||||
massClaimIsPending,
|
massClaimIsPending,
|
||||||
utxoCounts,
|
utxoCounts,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
const accountTransactions = props.transactions;
|
||||||
|
|
||||||
const [detailsExpanded, setDetailsExpanded] = React.useState(false);
|
const [detailsExpanded, setDetailsExpanded] = React.useState(false);
|
||||||
const [accountStatusResponse, setAccountStatusResponse] = React.useState();
|
const [accountStatusResponse, setAccountStatusResponse] = React.useState();
|
||||||
|
|
||||||
|
@ -92,19 +97,58 @@ const WalletBalance = (props: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={<><Icon size="18" icon={ICONS.FINANCE} />313 USD</>}
|
title={'Tip History'}
|
||||||
subtitle={
|
body={accountTransactions && accountTransactions.length > 0 && (
|
||||||
totalLocked > 0 ? (
|
<>
|
||||||
<I18nMessage>
|
<div className="table__wrapper">
|
||||||
This is your remaining balance that can still be withdrawn to your bank account
|
<table className="table table--transactions">
|
||||||
</I18nMessage>
|
<thead>
|
||||||
) : (
|
<tr>
|
||||||
<span>{__('Your total balance.')}</span>
|
<th className="date-header">{__('Date')}</th>
|
||||||
)
|
<th>{<>{__('Receiving Channel Name')}</>}</th>
|
||||||
}
|
<th>{__('Tip Location')}</th>
|
||||||
body={
|
<th>{__('Amount (USD)')} </th>
|
||||||
<h1>Hello!</h1>
|
<th>{__('Processing Fee')}</th>
|
||||||
|
<th>{__('Odysee Fee')}</th>
|
||||||
|
<th>{__('Received Amount')}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{accountTransactions &&
|
||||||
|
accountTransactions.map((transaction) => (
|
||||||
|
<tr key={transaction.name + transaction.created_at}>
|
||||||
|
<td>{moment(transaction.created_at).format('LLL')}</td>
|
||||||
|
<td>
|
||||||
|
<Button
|
||||||
|
className="stripe__card-link-text"
|
||||||
|
navigate={'/' + transaction.channel_name + ':' + transaction.channel_claim_id}
|
||||||
|
label={transaction.channel_name}
|
||||||
|
button="link"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Button
|
||||||
|
className="stripe__card-link-text"
|
||||||
|
navigate={'/' + transaction.channel_name + ':' + transaction.source_claim_id}
|
||||||
|
label={
|
||||||
|
transaction.channel_claim_id === transaction.source_claim_id
|
||||||
|
? 'Channel Page'
|
||||||
|
: 'File Page'
|
||||||
}
|
}
|
||||||
|
button="link"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>${transaction.tipped_amount / 100}</td>
|
||||||
|
<td>${transaction.transaction_fee / 100}</td>
|
||||||
|
<td>${transaction.application_fee / 100}</td>
|
||||||
|
<td>${transaction.received_amount / 100}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
actions={
|
actions={
|
||||||
<>
|
<>
|
||||||
{accountStatusResponse && accountStatusResponse.charges_enabled && <h2>Charges Enabled: True</h2>}
|
{accountStatusResponse && accountStatusResponse.charges_enabled && <h2>Charges Enabled: True</h2>}
|
||||||
|
|
|
@ -19,18 +19,30 @@ type Props = {
|
||||||
const WalletPage = (props: Props) => {
|
const WalletPage = (props: Props) => {
|
||||||
console.log(props);
|
console.log(props);
|
||||||
|
|
||||||
var environment = 'test';
|
var stripeEnvironment = 'test';
|
||||||
|
|
||||||
const tab = new URLSearchParams(props.location.search).get('tab');
|
const tab = new URLSearchParams(props.location.search).get('tab');
|
||||||
|
|
||||||
const [accountStatusResponse, setAccountStatusResponse] = React.useState();
|
const [accountStatusResponse, setAccountStatusResponse] = React.useState();
|
||||||
|
const [accountTransactionResponse, setAccountTransactionResponse] = React.useState();
|
||||||
|
|
||||||
function getAccountStatus(){
|
function getAccountStatus(){
|
||||||
return Lbryio.call(
|
return Lbryio.call(
|
||||||
'account',
|
'account',
|
||||||
'status',
|
'status',
|
||||||
{
|
{
|
||||||
environment
|
environment: stripeEnvironment,
|
||||||
|
},
|
||||||
|
'post'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAccountTransactionsa(){
|
||||||
|
return Lbryio.call(
|
||||||
|
'account',
|
||||||
|
'list',
|
||||||
|
{
|
||||||
|
environment: stripeEnvironment,
|
||||||
},
|
},
|
||||||
'post'
|
'post'
|
||||||
);
|
);
|
||||||
|
@ -38,11 +50,33 @@ const WalletPage = (props: Props) => {
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
(async function(){
|
(async function(){
|
||||||
|
try {
|
||||||
const response = await getAccountStatus();
|
const response = await getAccountStatus();
|
||||||
|
|
||||||
|
console.log('account status');
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
|
|
||||||
setAccountStatusResponse(response);
|
setAccountStatusResponse(response);
|
||||||
|
|
||||||
console.log(response);
|
// TODO: some weird naming clash
|
||||||
|
const getAccountTransactions = await getAccountTransactionsa();
|
||||||
|
|
||||||
|
console.log('transactions');
|
||||||
|
|
||||||
|
setAccountTransactionResponse(getAccountTransactions)
|
||||||
|
|
||||||
|
console.log(getAccountTransactions);
|
||||||
|
|
||||||
|
} catch (err){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -111,7 +145,7 @@ const WalletPage = (props: Props) => {
|
||||||
<div className="fiat-transactions" style={{display: 'none'}}>
|
<div className="fiat-transactions" style={{display: 'none'}}>
|
||||||
<WalletFiatBalance accountDetails={accountStatusResponse} />
|
<WalletFiatBalance accountDetails={accountStatusResponse} />
|
||||||
<div style={{paddingTop: '20px'}}></div>
|
<div style={{paddingTop: '20px'}}></div>
|
||||||
{/*<WalletFiatTransactions />*/}
|
<WalletFiatTransactions transactions={accountTransactionResponse}/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue