update dashboard; toggle zero balances
This commit is contained in:
parent
abc5984647
commit
647fbcfa50
|
@ -50,26 +50,26 @@ const TokenList = () => {
|
||||||
const showTableView = width ? width > breakpoints.md : false
|
const showTableView = width ? width > breakpoints.md : false
|
||||||
const banks = useBanksWithBalances('balance')
|
const banks = useBanksWithBalances('balance')
|
||||||
|
|
||||||
// const filteredBanks = useMemo(() => {
|
|
||||||
// if (banks.length) {
|
|
||||||
// return showZeroBalances || !mangoAccountAddress
|
|
||||||
// ? banks
|
|
||||||
// : banks.filter((b) => Math.abs(b.balance) > 0)
|
|
||||||
// }
|
|
||||||
// return []
|
|
||||||
// }, [banks, mangoAccountAddress, showZeroBalances])
|
|
||||||
|
|
||||||
const filteredBanks = useMemo(() => {
|
const filteredBanks = useMemo(() => {
|
||||||
if (!banks.length) return []
|
if (banks.length) {
|
||||||
if (showZeroBalances || !mangoAccountAddress) return banks
|
return showZeroBalances || !mangoAccountAddress
|
||||||
const filtered = banks.filter((b) => {
|
? banks
|
||||||
const contribution =
|
: banks.filter((b) => Math.abs(b.balance) > 0)
|
||||||
initContributions.find((cont) => cont.asset === b.bank.name)
|
}
|
||||||
?.contribution || 0
|
return []
|
||||||
return Math.abs(contribution) > 0
|
}, [banks, mangoAccountAddress, showZeroBalances])
|
||||||
})
|
|
||||||
return filtered
|
// const filteredBanks = useMemo(() => {
|
||||||
}, [banks, mangoAccountAddress, showZeroBalances, initContributions])
|
// if (!banks.length) return []
|
||||||
|
// if (showZeroBalances || !mangoAccountAddress) return banks
|
||||||
|
// const filtered = banks.filter((b) => {
|
||||||
|
// const contribution =
|
||||||
|
// initContributions.find((cont) => cont.asset === b.bank.name)
|
||||||
|
// ?.contribution || 0
|
||||||
|
// return Math.abs(contribution) > 0
|
||||||
|
// })
|
||||||
|
// return filtered
|
||||||
|
// }, [banks, mangoAccountAddress, showZeroBalances, initContributions])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContentBox hideBorder hidePadding>
|
<ContentBox hideBorder hidePadding>
|
||||||
|
@ -80,7 +80,7 @@ const TokenList = () => {
|
||||||
disabled={!mangoAccount}
|
disabled={!mangoAccount}
|
||||||
onChange={() => setShowZeroBalances(!showZeroBalances)}
|
onChange={() => setShowZeroBalances(!showZeroBalances)}
|
||||||
>
|
>
|
||||||
{t('account:zero-collateral')}
|
{t('account:zero-balances')}
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
@ -154,7 +154,9 @@ const RiskDashboard: NextPage = () => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
'Loading'
|
<div className="mt-8 w-full text-center">
|
||||||
|
Loading... make take up to 60 seconds
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,5 +31,6 @@
|
||||||
"total-funding-earned": "Total Funding Earned",
|
"total-funding-earned": "Total Funding Earned",
|
||||||
"volume-chart": "Volume Chart",
|
"volume-chart": "Volume Chart",
|
||||||
"week-starting": "Week starting {{week}}",
|
"week-starting": "Week starting {{week}}",
|
||||||
"zero-collateral": "Zero Collateral"
|
"zero-collateral": "Zero Collateral",
|
||||||
|
"zero-balances": "Show Zero Balances"
|
||||||
}
|
}
|
Loading…
Reference in New Issue