fix lot of linting errors and make command more userful

This commit is contained in:
Anthony 2021-08-12 13:53:28 +02:00
parent adc1e0e8e2
commit 6bb4d4ff39
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
8 changed files with 87 additions and 140 deletions

View file

@ -38,7 +38,7 @@
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null", "build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
"crossenv": "./node_modules/cross-env/dist/bin/cross-env", "crossenv": "./node_modules/cross-env/dist/bin/cross-env",
"lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'web/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow", "lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'web/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow",
"lint-fix": "eslint --fix 'ui/**/*.{js,jsx}' && eslint --fix 'web/**/*.{js,jsx}' && eslint --fix 'electron/**/*.js' && flow", "lint-fix": "eslint --fix --quiet 'ui/**/*.{js,jsx}' && eslint --fix --quiet 'web/**/*.{js,jsx}' && eslint --fix --quiet 'electron/**/*.js'",
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write", "format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
"flow-defs": "flow-typed install", "flow-defs": "flow-typed install",
"precommit": "lint-staged", "precommit": "lint-staged",

View file

@ -1,16 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types';
import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
import CreditAmount from 'component/common/credit-amount';
import Button from 'component/button'; import Button from 'component/button';
import HelpLink from 'component/common/help-link';
import Card from 'component/common/card'; import Card from 'component/common/card';
import Icon from 'component/common/icon';
import LbcSymbol from 'component/common/lbc-symbol';
import I18nMessage from 'component/i18nMessage';
import { formatNumberWithCommas } from 'util/number';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import moment from 'moment'; import moment from 'moment';
@ -20,43 +11,37 @@ type Props = {
}; };
const WalletBalance = (props: Props) => { const WalletBalance = (props: Props) => {
const {
} = props;
// receive transactions from parent component // receive transactions from parent component
let accountTransactions = props.transactions; let accountTransactions = props.transactions;
// reverse so most recent payments come first // reverse so most recent payments come first
if(accountTransactions){ if (accountTransactions) {
accountTransactions = accountTransactions.reverse(); accountTransactions = accountTransactions.reverse();
} }
if(accountTransactions && accountTransactions.length > 10 ){ if (accountTransactions && accountTransactions.length > 10) {
accountTransactions.length = 10; accountTransactions.length = 10;
} }
const [detailsExpanded, setDetailsExpanded] = React.useState(false); // const [detailsExpanded, setDetailsExpanded] = React.useState(false);
const [accountStatusResponse, setAccountStatusResponse] = React.useState(); const [accountStatusResponse, setAccountStatusResponse] = React.useState();
const [subscriptions, setSubscriptions] = React.useState([]); const [subscriptions, setSubscriptions] = React.useState([]);
var environment = 'test'; var environment = 'test';
function getAccountStatus(){ function getAccountStatus() {
return Lbryio.call( return Lbryio.call(
'account', 'account',
'status', 'status',
{ {
environment environment,
}, },
'post' 'post'
); );
} }
React.useEffect(() => { React.useEffect(() => {
(async function() {
(async function(){
const response = await getAccountStatus(); const response = await getAccountStatus();
setAccountStatusResponse(response); setAccountStatusResponse(response);
@ -68,7 +53,7 @@ const WalletBalance = (props: Props) => {
return ( return (
<><Card <><Card
title={'Tip History'} title={'Tip History'}
body={1 == 1 && ( body={(
<> <>
<div className="table__wrapper"> <div className="table__wrapper">
<table className="table table--transactions"> <table className="table table--transactions">
@ -116,7 +101,7 @@ const WalletBalance = (props: Props) => {
))} ))}
</tbody> </tbody>
</table> </table>
{!accountTransactions && <p style={{textAlign:"center", marginTop: '20px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Transactions</p>} {!accountTransactions && <p style={{textAlign: 'center', marginTop: '20px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Transactions</p>}
</div> </div>
</> </>
)} )}
@ -170,7 +155,7 @@ const WalletBalance = (props: Props) => {
))} ))}
</tbody> </tbody>
</table> </table>
{(!subscriptions || subscriptions.length === 0) && <p style={{textAlign:"center", marginTop: '22px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Subscriptions</p>} {(!subscriptions || subscriptions.length === 0) && <p style={{textAlign: 'center', marginTop: '22px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Subscriptions</p>}
</div> </div>
</> </>
} }

View file

@ -1,16 +1,12 @@
// @flow // @flow
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
import CreditAmount from 'component/common/credit-amount'; import CreditAmount from 'component/common/credit-amount';
import Button from 'component/button'; import Button from 'component/button';
import HelpLink from 'component/common/help-link';
import Card from 'component/common/card'; import Card from 'component/common/card';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import LbcSymbol from 'component/common/lbc-symbol';
import I18nMessage from 'component/i18nMessage'; import I18nMessage from 'component/i18nMessage';
import { formatNumberWithCommas } from 'util/number';
type Props = { type Props = {
accountDetails: any, accountDetails: any,
@ -27,8 +23,8 @@ const WalletBalance = (props: Props) => {
const [detailsExpanded, setDetailsExpanded] = React.useState(false); const [detailsExpanded, setDetailsExpanded] = React.useState(false);
return ( return (
<>{1 == 1 && <Card <>{<Card
title={<><Icon size="18" icon={ICONS.FINANCE} />{accountDetails && accountDetails.total_received_unpaid/100 || 0} USD</>} title={<><Icon size="18" icon={ICONS.FINANCE} />{(accountDetails && (accountDetails.total_received_unpaid / 100)) || 0} USD</>}
subtitle={ subtitle={
<I18nMessage> <I18nMessage>
This is your remaining balance that can still be withdrawn to your bank account This is your remaining balance that can still be withdrawn to your bank account
@ -37,11 +33,11 @@ const WalletBalance = (props: Props) => {
actions={ actions={
<> <>
<h2 className="section__title--small"> <h2 className="section__title--small">
${accountDetails && accountDetails.total_tipped / 100 || 0} Total Received Tips ${(accountDetails && (accountDetails.total_tipped / 100)) || 0} Total Received Tips
</h2> </h2>
<h2 className="section__title--small"> <h2 className="section__title--small">
${accountDetails && accountDetails.total_paid_out/100 || 0} Withdrawn ${(accountDetails && (accountDetails.total_paid_out / 100)) || 0} Withdrawn
<Button <Button
button="link" button="link"
label={detailsExpanded ? __('View less') : __('View more')} label={detailsExpanded ? __('View less') : __('View more')}
@ -56,7 +52,7 @@ const WalletBalance = (props: Props) => {
<dl> <dl>
<dt> <dt>
<span className="dt__text">{__('Earned from uploads')}</span> <span className="dt__text">{__('Earned from uploads')}</span>
{/*<span className="help--dt">({__('Earned from channel page')})</span>*/} {/* <span className="help--dt">({__('Earned from channel page')})</span> */}
</dt> </dt>
<dd> <dd>
<span className="dd__text"> <span className="dd__text">
@ -73,19 +69,19 @@ const WalletBalance = (props: Props) => {
<dt> <dt>
<span className="dt__text">{__('Earned from channel page')}</span> <span className="dt__text">{__('Earned from channel page')}</span>
{/*<span className="help--dt">({__('Delete or edit past content to spend')})</span>*/} {/* <span className="help--dt">({__('Delete or edit past content to spend')})</span> */}
</dt> </dt>
<dd> <dd>
<CreditAmount amount={1} precision={4} /> <CreditAmount amount={1} precision={4} />
</dd> </dd>
{/*<dt>*/} {/* <dt> */}
{/* <span className="dt__text">{__('...supporting content')}</span>*/} {/* <span className="dt__text">{__('...supporting content')}</span> */}
{/* <span className="help--dt">({__('Delete supports to spend')})</span>*/} {/* <span className="help--dt">({__('Delete supports to spend')})</span> */}
{/*</dt>*/} {/* </dt> */}
{/*<dd>*/} {/* <dd> */}
{/* <CreditAmount amount={1} precision={4} />*/} {/* <CreditAmount amount={1} precision={4} /> */}
{/*</dd>*/} {/* </dd> */}
</dl> </dl>
</div> </div>
)} )}

View file

@ -1,16 +1,11 @@
// @flow // @flow
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
import CreditAmount from 'component/common/credit-amount';
import Button from 'component/button'; import Button from 'component/button';
import HelpLink from 'component/common/help-link';
import Card from 'component/common/card'; import Card from 'component/common/card';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import LbcSymbol from 'component/common/lbc-symbol';
import I18nMessage from 'component/i18nMessage'; import I18nMessage from 'component/i18nMessage';
import { formatNumberWithCommas } from 'util/number';
type Props = { type Props = {
totalTippedAmount: number, totalTippedAmount: number,
@ -18,25 +13,23 @@ type Props = {
transactions: any, transactions: any,
}; };
const WalletBalance = (props: Props) => { const WalletBalance = (props: Props) => {
const { const {
accountDetails, // accountDetails,
totalTippedAmount, totalTippedAmount,
transactions, transactions,
} = props; } = props;
const [detailsExpanded, setDetailsExpanded] = React.useState(false); // const [detailsExpanded, setDetailsExpanded] = React.useState(false);
const [totalCreatorsSupported, setTotalCreatorsSupported] = React.useState(false); const [totalCreatorsSupported, setTotalCreatorsSupported] = React.useState(false);
// calculate how many unique users tipped // calculate how many unique users tipped
React.useEffect(() => { React.useEffect(() => {
if(transactions){ if (transactions) {
let channelNames = [] let channelNames = [];
for(const transaction of transactions){ for (const transaction of transactions) {
channelNames.push(transaction.channel_name) channelNames.push(transaction.channel_name);
console.log(transaction.channel_name); console.log(transaction.channel_name);
} }
@ -46,7 +39,7 @@ const WalletBalance = (props: Props) => {
}, [transactions]); }, [transactions]);
return ( return (
<>{1 == 1 && <Card <>{<Card
title={<><Icon size="18" icon={ICONS.FINANCE} />{totalTippedAmount} USD</>} title={<><Icon size="18" icon={ICONS.FINANCE} />{totalTippedAmount} USD</>}
subtitle={ subtitle={
<I18nMessage> <I18nMessage>

View file

@ -1,16 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types';
import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
import CreditAmount from 'component/common/credit-amount';
import Button from 'component/button'; import Button from 'component/button';
import HelpLink from 'component/common/help-link';
import Card from 'component/common/card'; import Card from 'component/common/card';
import Icon from 'component/common/icon';
import LbcSymbol from 'component/common/lbc-symbol';
import I18nMessage from 'component/i18nMessage';
import { formatNumberWithCommas } from 'util/number';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import moment from 'moment'; import moment from 'moment';
@ -21,49 +12,43 @@ type Props = {
}; };
const WalletBalance = (props: Props) => { const WalletBalance = (props: Props) => {
const {
} = props;
// receive transactions from parent component // receive transactions from parent component
let accountTransactions = props.transactions; let accountTransactions = props.transactions;
console.log('heres transactions') console.log('heres transactions');
console.log(accountTransactions); console.log(accountTransactions);
// let totalTippedAmount = props.totalTippedAmount; // let totalTippedAmount = props.totalTippedAmount;
// totalTippedAmount = 0; // totalTippedAmount = 0;
// reverse so most recent payments come first // reverse so most recent payments come first
if(accountTransactions){ if (accountTransactions) {
accountTransactions = accountTransactions.reverse(); accountTransactions = accountTransactions.reverse();
} }
const [detailsExpanded, setDetailsExpanded] = React.useState(false); // const [detailsExpanded, setDetailsExpanded] = React.useState(false);
const [accountStatusResponse, setAccountStatusResponse] = React.useState(); // const [accountStatusResponse, setAccountStatusResponse] = React.useState();
// const [totalTippedAmount, setTotalTippedAmount] = React.useState(0);
const [paymentHistoryTransactions, setPaymentHistoryTransactions] = React.useState(); const [paymentHistoryTransactions, setPaymentHistoryTransactions] = React.useState();
const [subscriptions, setSubscriptions] = React.useState(); const [subscriptions, setSubscriptions] = React.useState();
const [totalTippedAmount, setTotalTippedAmount] = React.useState(0);
const [lastFour, setLastFour] = React.useState(); const [lastFour, setLastFour] = React.useState();
var environment = 'test'; var environment = 'test';
function getPaymentHistory() { // function getPaymentHistory() {
return Lbryio.call( // return Lbryio.call(
'customer', // 'customer',
'list', // 'list',
{ // {
environment, // environment,
}, // },
'post' // 'post'
)}; // ); };
function getCustomerStatus(){ function getCustomerStatus() {
return Lbryio.call( return Lbryio.call(
'customer', 'customer',
'status', 'status',
@ -71,11 +56,11 @@ const WalletBalance = (props: Props) => {
environment, environment,
}, },
'post' 'post'
) );
} }
React.useEffect(() => { React.useEffect(() => {
(async function(){ (async function() {
let response = accountTransactions; let response = accountTransactions;
console.log('payment transactions'); console.log('payment transactions');
@ -91,15 +76,14 @@ const WalletBalance = (props: Props) => {
const subscriptions = [...response]; const subscriptions = [...response];
if(subscriptions && subscriptions.length > 2){ if (subscriptions && subscriptions.length > 2) {
subscriptions.length = 2 subscriptions.length = 2;
setSubscriptions([]) setSubscriptions([]);
} else { } else {
setSubscriptions([]) setSubscriptions([]);
} }
console.log(response); console.log(response);
})(); })();
}, [accountTransactions]); }, [accountTransactions]);
@ -153,7 +137,7 @@ const WalletBalance = (props: Props) => {
))} ))}
</tbody> </tbody>
</table> </table>
{(!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>
</> </>
} }
@ -207,7 +191,7 @@ const WalletBalance = (props: Props) => {
))} ))}
</tbody> </tbody>
</table> </table>
{(!subscriptions || subscriptions.length === 0) && <p style={{textAlign:"center", marginTop: '22px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Subscriptions</p>} {(!subscriptions || subscriptions.length === 0) && <p style={{textAlign: 'center', marginTop: '22px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Subscriptions</p>}
</div> </div>
</> </>
} }

View file

@ -8,7 +8,6 @@ import Page from 'component/page';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import { URL, WEBPACK_WEB_PORT, STRIPE_PUBLIC_KEY } from 'config'; import { URL, WEBPACK_WEB_PORT, STRIPE_PUBLIC_KEY } from 'config';
import moment from 'moment';
const isDev = process.env.NODE_ENV !== 'production'; const isDev = process.env.NODE_ENV !== 'production';
@ -186,7 +185,7 @@ class StripeAccountConnection extends React.Component<Props, State> {
unpaidBalance, unpaidBalance,
accountNotConfirmedButReceivedTips, accountNotConfirmedButReceivedTips,
pageTitle, pageTitle,
accountTransactions, // accountTransactions,
} = this.state; } = this.state;
const { user } = this.props; const { user } = this.props;

View file

@ -6,14 +6,12 @@ import Page from 'component/page';
import Card from 'component/common/card'; import Card from 'component/common/card';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import { STRIPE_PUBLIC_KEY } from 'config'; import { STRIPE_PUBLIC_KEY } from 'config';
import moment from 'moment';
import Plastic from 'react-plastic'; import Plastic from 'react-plastic';
import Button from 'component/button'; import Button from 'component/button';
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types'; import * as MODALS from 'constants/modal_types';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
let stripeEnvironment = 'test'; let stripeEnvironment = 'test';
// if the key contains pk_live it's a live key // if the key contains pk_live it's a live key
// update the environment for the calls to the backend to indicate which environment to hit // update the environment for the calls to the backend to indicate which environment to hit
@ -370,7 +368,7 @@ class SettingsStripeCard extends React.Component<Props, State> {
const { scriptFailedToLoad, openModal } = this.props; const { scriptFailedToLoad, openModal } = this.props;
const { currentFlowStage, customerTransactions, pageTitle, userCardDetails, paymentMethodId } = this.state; const { currentFlowStage, pageTitle, userCardDetails, paymentMethodId } = this.state;
return ( return (
<Page backout={{ title: pageTitle, backLabel: __('Done') }} noFooter noSideNavigation> <Page backout={{ title: pageTitle, backLabel: __('Done') }} noFooter noSideNavigation>

View file

@ -21,8 +21,7 @@ type Props = {
const WalletPage = (props: Props) => { const WalletPage = (props: Props) => {
console.log(props); console.log(props);
var stripeEnvironment = 'test'; const stripeEnvironment = 'test';
var environment = 'test';
const tab = new URLSearchParams(props.location.search).get('tab'); const tab = new URLSearchParams(props.location.search).get('tab');
@ -31,7 +30,6 @@ const WalletPage = (props: Props) => {
const [customerTransactions, setCustomerTransactions] = React.useState(); const [customerTransactions, setCustomerTransactions] = React.useState();
const [totalTippedAmount, setTotalTippedAmount] = React.useState(0); const [totalTippedAmount, setTotalTippedAmount] = React.useState(0);
function getPaymentHistory() { function getPaymentHistory() {
return Lbryio.call( return Lbryio.call(
'customer', 'customer',
@ -40,20 +38,20 @@ const WalletPage = (props: Props) => {
environment: stripeEnvironment, environment: stripeEnvironment,
}, },
'post' 'post'
)}; ); };
function getCustomerStatus(){ // function getCustomerStatus() {
return Lbryio.call( // return Lbryio.call(
'customer', // 'customer',
'status', // 'status',
{ // {
environment: stripeEnvironment, // environment: stripeEnvironment,
}, // },
'post' // 'post'
) // );
} // }
function getAccountStatus(){ function getAccountStatus() {
return Lbryio.call( return Lbryio.call(
'account', 'account',
'status', 'status',
@ -64,7 +62,7 @@ const WalletPage = (props: Props) => {
); );
} }
function getAccountTransactionsa(){ function getAccountTransactionsa() {
return Lbryio.call( return Lbryio.call(
'account', 'account',
'list', 'list',
@ -75,10 +73,9 @@ const WalletPage = (props: Props) => {
); );
} }
// calculate account transactions section // calculate account transactions section
React.useEffect(() => { React.useEffect(() => {
(async function(){ (async function() {
try { try {
const response = await getAccountStatus(); const response = await getAccountStatus();
@ -87,9 +84,8 @@ const WalletPage = (props: Props) => {
// TODO: some weird naming clash hence getAccountTransactionsa // TODO: some weird naming clash hence getAccountTransactionsa
const getAccountTransactions = await getAccountTransactionsa(); const getAccountTransactions = await getAccountTransactionsa();
setAccountTransactionResponse(getAccountTransactions) setAccountTransactionResponse(getAccountTransactions);
} catch (err) {
} catch (err){
console.log(err); console.log(err);
} }
})(); })();
@ -97,28 +93,27 @@ const WalletPage = (props: Props) => {
// populate customer payment data // populate customer payment data
React.useEffect(() => { React.useEffect(() => {
(async function(){ (async function() {
try { try {
// get card payments customer has made // get card payments customer has made
const customerTransactionResponse = await getPaymentHistory(); const customerTransactionResponse = await getPaymentHistory();
let totalTippedAmount = 0; let totalTippedAmount = 0;
for(const transaction of customerTransactionResponse){ for (const transaction of customerTransactionResponse) {
totalTippedAmount = totalTippedAmount + transaction.tipped_amount totalTippedAmount = totalTippedAmount + transaction.tipped_amount;
} }
setTotalTippedAmount(totalTippedAmount / 100); setTotalTippedAmount(totalTippedAmount / 100);
setCustomerTransactions(customerTransactionResponse) setCustomerTransactions(customerTransactionResponse);
} catch (err) {
} catch (err){
console.log(err); console.log(err);
} }
})(); })();
}, []); }, []);
function focusLBCTab(){ function focusLBCTab() {
document.getElementsByClassName('lbc-transactions')[0].style.display = 'inline'; document.getElementsByClassName('lbc-transactions')[0].style.display = 'inline';
document.getElementsByClassName('fiat-transactions')[0].style.display = 'none'; document.getElementsByClassName('fiat-transactions')[0].style.display = 'none';
document.getElementsByClassName('payment-history-tab')[0].style.display = 'none'; document.getElementsByClassName('payment-history-tab')[0].style.display = 'none';
@ -126,10 +121,9 @@ const WalletPage = (props: Props) => {
document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'underline'; document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'underline';
document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'none';
document.getElementsByClassName('fiat-payment-history-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('fiat-payment-history-switcher')[0].style.textDecoration = 'none';
} }
function focusAccountHistoryTab(){ function focusAccountHistoryTab() {
document.getElementsByClassName('lbc-transactions')[0].style.display = 'none'; document.getElementsByClassName('lbc-transactions')[0].style.display = 'none';
document.getElementsByClassName('payment-history-tab')[0].style.display = 'none'; document.getElementsByClassName('payment-history-tab')[0].style.display = 'none';
document.getElementsByClassName('fiat-transactions')[0].style.display = 'inline'; document.getElementsByClassName('fiat-transactions')[0].style.display = 'inline';
@ -137,10 +131,9 @@ const WalletPage = (props: Props) => {
document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'none';
document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'underline'; document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'underline';
document.getElementsByClassName('fiat-payment-history-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('fiat-payment-history-switcher')[0].style.textDecoration = 'none';
} }
function focusPaymentHistoryTab(){ function focusPaymentHistoryTab() {
document.getElementsByClassName('lbc-transactions')[0].style.display = 'none'; document.getElementsByClassName('lbc-transactions')[0].style.display = 'none';
document.getElementsByClassName('fiat-transactions')[0].style.display = 'none'; document.getElementsByClassName('fiat-transactions')[0].style.display = 'none';
document.getElementsByClassName('payment-history-tab')[0].style.display = 'inline'; document.getElementsByClassName('payment-history-tab')[0].style.display = 'inline';
@ -148,7 +141,6 @@ const WalletPage = (props: Props) => {
document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('lbc-tab-switcher')[0].style.textDecoration = 'none';
document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'none'; document.getElementsByClassName('fiat-tab-switcher')[0].style.textDecoration = 'none';
document.getElementsByClassName('fiat-payment-history-switcher')[0].style.textDecoration = 'underline'; document.getElementsByClassName('fiat-payment-history-switcher')[0].style.textDecoration = 'underline';
} }
// select the first tab // select the first tab
@ -156,11 +148,11 @@ const WalletPage = (props: Props) => {
if (tab === 'account-history') { if (tab === 'account-history') {
// if (1 === 2) { // if (1 === 2) {
focusAccountHistoryTab(); focusAccountHistoryTab();
} else if (tab === 'payment-history'){ } else if (tab === 'payment-history') {
// } else if (1 === 2){ // } else if (1 === 2){
focusPaymentHistoryTab(); focusPaymentHistoryTab();
} else { } else {
focusLBCTab() focusLBCTab();
} }
}, []); }, []);
@ -220,15 +212,15 @@ const WalletPage = (props: Props) => {
{/* account received transactions section */} {/* account received transactions section */}
<div className="fiat-transactions" style={{display: 'none'}}> <div className="fiat-transactions" style={{display: 'none'}}>
<WalletFiatBalance accountDetails={accountStatusResponse} /> <WalletFiatBalance accountDetails={accountStatusResponse} />
<div style={{paddingTop: '25px'}}></div> <div style={{paddingTop: '25px'}} />
<WalletFiatAccountHistory transactions={accountTransactionResponse}/> <WalletFiatAccountHistory transactions={accountTransactionResponse} />
</div> </div>
{/* fiat payment history for tips made by user */} {/* fiat payment history for tips made by user */}
<div className="payment-history-tab" style={{display: 'none'}}> <div className="payment-history-tab" style={{display: 'none'}}>
<WalletFiatPaymentBalance transactions={customerTransactions} totalTippedAmount={totalTippedAmount} accountDetails={accountStatusResponse} /> <WalletFiatPaymentBalance transactions={customerTransactions} totalTippedAmount={totalTippedAmount} accountDetails={accountStatusResponse} />
<div style={{paddingTop: '25px'}}></div> <div style={{paddingTop: '25px'}} />
<WalletFiatPaymentHistory transactions={customerTransactions}/> <WalletFiatPaymentHistory transactions={customerTransactions} />
</div> </div>
</Page> </Page>