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

View File

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

View File

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