// @flow import React from 'react'; import { withRouter } from 'react-router'; import WalletBalance from 'component/walletBalance'; import WalletFiatBalance from 'component/walletFiatBalance'; import WalletFiatTransactions from 'component/walletFiatTransactions'; import TxoList from 'component/txoList'; import Page from 'component/page'; import Spinner from 'component/spinner'; import YrblWalletEmpty from 'component/yrblWalletEmpty'; import { Lbryio } from 'lbryinc'; type Props = { history: { action: string, push: (string) => void, replace: (string) => void }, location: { search: string, pathname: string }, totalBalance: ?number, }; const WalletPage = (props: Props) => { console.log(props); 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: stripeEnvironment, }, 'post' ); } function getAccountTransactionsa(){ return Lbryio.call( 'account', 'list', { environment: stripeEnvironment, }, 'post' ); } React.useEffect(() => { (async function(){ 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){ } })(); }, []); React.useEffect(() => { // if (tab === 'currency') { if (1 === 1) { document.getElementsByClassName('lbc-transactions')[0].style.display = 'none'; document.getElementsByClassName('fiat-transactions')[0].style.display = 'inline'; document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'underline'; } }, []); const { location, totalBalance } = props; const { search } = location; const showIntro = totalBalance === 0; const loading = totalBalance === undefined; return ( {/* tabs to switch between fiat and lbc */}

{ document.getElementsByClassName('lbc-transactions')[0].style.display = 'inline'; document.getElementsByClassName('fiat-transactions')[0].style.display = 'none'; document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'underline'; document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'none'; }} >LBC Transactions

{ document.getElementsByClassName('lbc-transactions')[0].style.display = 'none'; document.getElementsByClassName('fiat-transactions')[0].style.display = 'inline'; document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'underline'; }} >USD Transactions

{/* if the transactions are loading */} { loading && (
)} {/* when the transactions are finished loading */} { !loading && ( <> {showIntro ? ( ) : (
)} )}
{( <>
)}
); }; export default withRouter(WalletPage);