add funding table empty states

This commit is contained in:
saml33 2024-05-08 10:42:03 +10:00
parent 3e30fe0eb1
commit d8967dcd71
7 changed files with 30 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import { Bank, PerpMarket } from '@blockworks-foundation/mango-v4' import { Bank, PerpMarket } from '@blockworks-foundation/mango-v4'
import { LinkButton } from '@components/shared/Button' import { LinkButton } from '@components/shared/Button'
import ConnectEmptyState from '@components/shared/ConnectEmptyState'
import FormatNumericValue from '@components/shared/FormatNumericValue' import FormatNumericValue from '@components/shared/FormatNumericValue'
import SheenLoader from '@components/shared/SheenLoader' import SheenLoader from '@components/shared/SheenLoader'
import { import {
@ -14,6 +15,8 @@ import {
import TokenLogo from '@components/shared/TokenLogo' import TokenLogo from '@components/shared/TokenLogo'
import MarketLogos from '@components/trade/MarketLogos' import MarketLogos from '@components/trade/MarketLogos'
import { Disclosure, Transition } from '@headlessui/react' import { Disclosure, Transition } from '@headlessui/react'
import { NoSymbolIcon } from '@heroicons/react/20/solid'
import { useWallet } from '@solana/wallet-adapter-react'
import mangoStore from '@store/mangoStore' import mangoStore from '@store/mangoStore'
import { useInfiniteQuery } from '@tanstack/react-query' import { useInfiniteQuery } from '@tanstack/react-query'
import useMangoAccount from 'hooks/useMangoAccount' import useMangoAccount from 'hooks/useMangoAccount'
@ -62,6 +65,7 @@ export const fetchMarginFunding = async (
const FundingTable = () => { const FundingTable = () => {
const { t } = useTranslation(['common', 'account']) const { t } = useTranslation(['common', 'account'])
const { mangoAccountAddress } = useMangoAccount() const { mangoAccountAddress } = useMangoAccount()
const { connected } = useWallet()
const { width } = useViewport() const { width } = useViewport()
const showTableView = width ? width > breakpoints.md : false const showTableView = width ? width > breakpoints.md : false
@ -136,7 +140,8 @@ const FundingTable = () => {
sortConfig, sortConfig,
} = useSortableData(tableData) } = useSortableData(tableData)
return ( return mangoAccountAddress &&
(sortedTableData?.length || isLoading || isFetchingNextPage) ? (
<> <>
{showTableView ? ( {showTableView ? (
<Table> <Table>
@ -324,6 +329,17 @@ const FundingTable = () => {
</LinkButton> </LinkButton>
) : null} ) : null}
</> </>
) : mangoAccountAddress || connected ? (
<div className="flex flex-1 flex-col items-center justify-center">
<div className="flex flex-col items-center p-8">
<NoSymbolIcon className="mb-2 h-6 w-6 text-th-fgd-4" />
<p>{t('account:no-funding')}</p>
</div>
</div>
) : (
<div className="flex flex-1 flex-col items-center justify-center p-8">
<ConnectEmptyState text={t('account:connect-funding')} />
</div>
) )
} }

View File

@ -8,6 +8,7 @@
"collateral": "Collateral", "collateral": "Collateral",
"collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours", "collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours",
"collateral-value": "Collateral Value", "collateral-value": "Collateral Value",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "Advanced options set", "custom-account-options-saved": "Advanced options set",
"cumulative-interest-chart": "Cumulative Interest Chart", "cumulative-interest-chart": "Cumulative Interest Chart",
"daily-fee": "Daily Fee", "daily-fee": "Daily Fee",
@ -18,6 +19,7 @@
"followed-accounts": "Followed Accounts", "followed-accounts": "Followed Accounts",
"funding-chart": "Funding Chart", "funding-chart": "Funding Chart",
"funding-rate": "Funding Rate", "funding-rate": "Funding Rate",
"funding-type": "Funding Type",
"hide-announcements": "Hide Announcements", "hide-announcements": "Hide Announcements",
"init-health": "Init Health", "init-health": "Init Health",
"maint-health": "Maint Health", "maint-health": "Maint Health",
@ -30,6 +32,7 @@
"maint-health-contributions": "Maint Health Contributions", "maint-health-contributions": "Maint Health Contributions",
"more-account-stats": "More Account Stats", "more-account-stats": "More Account Stats",
"no-data": "No data to display", "no-data": "No data to display",
"no-funding": "No funding earned or paid",
"no-pnl-history": "No PnL History", "no-pnl-history": "No PnL History",
"not-following-yet": "Your not following any accounts yet...", "not-following-yet": "Your not following any accounts yet...",
"okay-got-it": "Okay, Got It", "okay-got-it": "Okay, Got It",

View File

@ -8,6 +8,7 @@
"collateral": "Collateral", "collateral": "Collateral",
"collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours", "collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours",
"collateral-value": "Collateral Value", "collateral-value": "Collateral Value",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "Advanced options set", "custom-account-options-saved": "Advanced options set",
"cumulative-interest-chart": "Cumulative Interest Chart", "cumulative-interest-chart": "Cumulative Interest Chart",
"daily-fee": "Daily Fee", "daily-fee": "Daily Fee",
@ -30,6 +31,7 @@
"maint-health-contributions": "Maint Health Contributions", "maint-health-contributions": "Maint Health Contributions",
"more-account-stats": "More Account Stats", "more-account-stats": "More Account Stats",
"no-data": "No data to display", "no-data": "No data to display",
"no-funding": "No funding earned or paid",
"no-pnl-history": "No PnL History", "no-pnl-history": "No PnL History",
"not-following-yet": "Your not following any accounts yet...", "not-following-yet": "Your not following any accounts yet...",
"okay-got-it": "Okay, Got It", "okay-got-it": "Okay, Got It",

View File

@ -8,6 +8,7 @@
"collateral": "Collateral", "collateral": "Collateral",
"collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours", "collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours",
"collateral-value": "Valor do Colateral", "collateral-value": "Valor do Colateral",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "Opções avançadas definidas", "custom-account-options-saved": "Opções avançadas definidas",
"cumulative-interest-chart": "Gráfico de Juros Acumulados", "cumulative-interest-chart": "Gráfico de Juros Acumulados",
"daily-fee": "Daily Fee", "daily-fee": "Daily Fee",
@ -30,6 +31,7 @@
"maint-health-contributions": "Contribuições para a Saúde de Manutenção", "maint-health-contributions": "Contribuições para a Saúde de Manutenção",
"more-account-stats": "Mais Estatísticas da Conta", "more-account-stats": "Mais Estatísticas da Conta",
"no-data": "Sem dados para exibir", "no-data": "Sem dados para exibir",
"no-funding": "No funding earned or paid",
"no-pnl-history": "Sem Histórico de PnL", "no-pnl-history": "Sem Histórico de PnL",
"not-following-yet": "Ainda não está seguindo nenhuma conta...", "not-following-yet": "Ainda não está seguindo nenhuma conta...",
"okay-got-it": "Okay, Got It", "okay-got-it": "Okay, Got It",

View File

@ -8,6 +8,7 @@
"collateral": "Collateral", "collateral": "Collateral",
"collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours", "collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours",
"collateral-value": "Collateral Value", "collateral-value": "Collateral Value",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "Advanced options set", "custom-account-options-saved": "Advanced options set",
"cumulative-interest-chart": "Cumulative Interest Chart", "cumulative-interest-chart": "Cumulative Interest Chart",
"daily-fee": "Daily Fee", "daily-fee": "Daily Fee",
@ -30,6 +31,7 @@
"maint-health-contributions": "Maint Health Contributions", "maint-health-contributions": "Maint Health Contributions",
"more-account-stats": "More Account Stats", "more-account-stats": "More Account Stats",
"no-data": "No data to display", "no-data": "No data to display",
"no-funding": "No funding earned or paid",
"no-pnl-history": "No PnL History", "no-pnl-history": "No PnL History",
"not-following-yet": "Your not following any accounts yet...", "not-following-yet": "Your not following any accounts yet...",
"okay-got-it": "Okay, Got It", "okay-got-it": "Okay, Got It",

View File

@ -8,6 +8,7 @@
"collateral": "质押品", "collateral": "质押品",
"collateral-funding-modal-heading": "{{remaining_hours}}小时之后Mango将收取你的质押品费", "collateral-funding-modal-heading": "{{remaining_hours}}小时之后Mango将收取你的质押品费",
"collateral-value": "质押品价值", "collateral-value": "质押品价值",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "已改高级设定", "custom-account-options-saved": "已改高级设定",
"cumulative-interest-chart": "累积利息图表", "cumulative-interest-chart": "累积利息图表",
"daily-fee": "每日费用", "daily-fee": "每日费用",
@ -30,6 +31,7 @@
"maint-health-contributions": "维持健康度", "maint-health-contributions": "维持健康度",
"more-account-stats": "更多帐户统计", "more-account-stats": "更多帐户统计",
"no-data": "无数据可显示", "no-data": "无数据可显示",
"no-funding": "No funding earned or paid",
"no-pnl-history": "无盈亏历史", "no-pnl-history": "无盈亏历史",
"not-following-yet": "你尚未关注任何帐户...", "not-following-yet": "你尚未关注任何帐户...",
"okay-got-it": "好,动了", "okay-got-it": "好,动了",

View File

@ -8,6 +8,7 @@
"collateral": "質押品", "collateral": "質押品",
"collateral-funding-modal-heading": "{{remaining_hours}}小時之後Mango將收取你的質押品費", "collateral-funding-modal-heading": "{{remaining_hours}}小時之後Mango將收取你的質押品費",
"collateral-value": "質押品價值", "collateral-value": "質押品價值",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "已改高級設定", "custom-account-options-saved": "已改高級設定",
"cumulative-interest-chart": "累積利息圖表", "cumulative-interest-chart": "累積利息圖表",
"daily-fee": "每日費用", "daily-fee": "每日費用",
@ -30,6 +31,7 @@
"maint-health-contributions": "維持健康度", "maint-health-contributions": "維持健康度",
"more-account-stats": "更多帳戶統計", "more-account-stats": "更多帳戶統計",
"no-data": "無數據可顯示", "no-data": "無數據可顯示",
"no-funding": "No funding earned or paid",
"no-pnl-history": "無盈虧歷史", "no-pnl-history": "無盈虧歷史",
"not-following-yet": "你尚未關注任何帳戶...", "not-following-yet": "你尚未關注任何帳戶...",
"okay-got-it": "好,動了", "okay-got-it": "好,動了",