fix: handle when no funding stats exist for acct

This commit is contained in:
Tyler Shipe 2021-10-18 18:00:47 -04:00
parent 9344defc06
commit c53c35b2e4
3 changed files with 19 additions and 17 deletions

View File

@ -4,6 +4,7 @@ import Chart from '../Chart'
import Loading from '../Loading' import Loading from '../Loading'
import Select from '../Select' import Select from '../Select'
import { Table, Td, Th, TrBody, TrHead } from '../TableElements' import { Table, Td, Th, TrBody, TrHead } from '../TableElements'
import { isEmpty } from 'lodash'
const AccountFunding = () => { const AccountFunding = () => {
const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current)
@ -109,7 +110,7 @@ const AccountFunding = () => {
</Table> </Table>
<> <>
{hourlyFunding && !loading ? ( {!isEmpty(hourlyFunding) && !loading ? (
<> <>
<div className="flex items-center justify-between my-4 w-full"> <div className="flex items-center justify-between my-4 w-full">
<Select <Select
@ -149,20 +150,21 @@ const AccountFunding = () => {
))} ))}
</div> </div>
</div> </div>
{hourlyFunding[selectedAsset].length ? (
<div <div
className="border border-th-bkg-4 relative md:mb-0 p-4 rounded-md" className="border border-th-bkg-4 relative md:mb-0 p-4 rounded-md"
style={{ height: '330px' }} style={{ height: '330px' }}
> >
<Chart <Chart
title="Hourly Funding" title="Hourly Funding"
xAxis="time" xAxis="time"
yAxis="total_funding" yAxis="total_funding"
data={hourlyFunding[selectedAsset]} data={hourlyFunding[selectedAsset]}
labelFormat={(x) => x.toFixed(6)} labelFormat={(x) => x.toFixed(6)}
type="area" type="area"
/> />
</div> </div>
) : null}
</> </>
) : loading ? ( ) : loading ? (
<div className="flex justify-center my-8"> <div className="flex justify-center my-8">

View File

@ -5,6 +5,7 @@ import Chart from '../Chart'
import Loading from '../Loading' import Loading from '../Loading'
import Select from '../Select' import Select from '../Select'
import { Table, Td, Th, TrBody, TrHead } from '../TableElements' import { Table, Td, Th, TrBody, TrHead } from '../TableElements'
import { isEmpty } from 'lodash'
interface InterestStats { interface InterestStats {
[key: string]: { [key: string]: {
@ -127,7 +128,7 @@ const AccountInterest = () => {
</tbody> </tbody>
</Table> </Table>
<> <>
{hourlyInterestStats && !loading ? ( {!isEmpty(hourlyInterestStats) && !loading ? (
<> <>
<div className="flex items-center justify-between my-4 w-full"> <div className="flex items-center justify-between my-4 w-full">
<Select <Select

View File

@ -50,7 +50,6 @@ const useSrmAccount = () => {
? nativeToUi(msrmAccountData.amount, MSRM_DECIMALS) ? nativeToUi(msrmAccountData.amount, MSRM_DECIMALS)
: 0 : 0
const feeTier = getFeeTier(totalMsrm, totalSrm) const feeTier = getFeeTier(totalMsrm, totalSrm)
console.log('feeTier', feeTier)
const { maker, taker } = getFeeRates(feeTier) const { maker, taker } = getFeeRates(feeTier)