Merge branch 'main' of github.com:blockworks-foundation/mango-v4-ui

This commit is contained in:
Adrian Brzeziński 2024-05-08 14:57:31 +02:00
commit 59719cc810
10 changed files with 40 additions and 11 deletions

View File

@ -1,5 +1,6 @@
import { Bank, PerpMarket } from '@blockworks-foundation/mango-v4'
import { LinkButton } from '@components/shared/Button'
import ConnectEmptyState from '@components/shared/ConnectEmptyState'
import FormatNumericValue from '@components/shared/FormatNumericValue'
import SheenLoader from '@components/shared/SheenLoader'
import {
@ -14,6 +15,8 @@ import {
import TokenLogo from '@components/shared/TokenLogo'
import MarketLogos from '@components/trade/MarketLogos'
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 { useInfiniteQuery } from '@tanstack/react-query'
import useMangoAccount from 'hooks/useMangoAccount'
@ -62,6 +65,7 @@ export const fetchMarginFunding = async (
const FundingTable = () => {
const { t } = useTranslation(['common', 'account'])
const { mangoAccountAddress } = useMangoAccount()
const { connected } = useWallet()
const { width } = useViewport()
const showTableView = width ? width > breakpoints.md : false
@ -136,7 +140,8 @@ const FundingTable = () => {
sortConfig,
} = useSortableData(tableData)
return (
return mangoAccountAddress &&
(sortedTableData?.length || isLoading || isFetchingNextPage) ? (
<>
{showTableView ? (
<Table>
@ -194,9 +199,11 @@ const FundingTable = () => {
<div className="flex items-center justify-end">
{marketOrBank ? (
marketOrBank instanceof PerpMarket ? (
<MarketLogos market={marketOrBank} />
<MarketLogos market={marketOrBank} size="small" />
) : (
<TokenLogo bank={marketOrBank} />
<div className="mr-1.5">
<TokenLogo bank={marketOrBank} size={16} />
</div>
)
) : null}
<p className="font-body">{asset}</p>
@ -256,7 +263,9 @@ const FundingTable = () => {
marketOrBank instanceof PerpMarket ? (
<MarketLogos market={marketOrBank} size="small" />
) : (
<TokenLogo bank={marketOrBank} size={16} />
<div className="mr-1.5">
<TokenLogo bank={marketOrBank} size={16} />
</div>
)
) : null}
<p className="text-right">{asset}</p>
@ -324,6 +333,17 @@ const FundingTable = () => {
</LinkButton>
) : 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

@ -328,11 +328,7 @@ const DashboardSuggestedValues = ({
)
return (
<Modal
panelClassNames="!max-w-[800px] !max-h-[700px] overflow-auto"
isOpen={isOpen}
onClose={onClose}
>
<Modal panelClassNames="!max-w-[800px]" isOpen={isOpen} onClose={onClose}>
<h3 className="mb-6">
<span>
{bank.name} - Suggested tier: {PRESETS[suggestedTierKey].preset_name}{' '}

View File

@ -62,7 +62,7 @@ function Modal({
} h-full w-full bg-th-bkg-1 font-body ${
fullScreen
? ''
: 'p-4 sm:h-auto sm:max-w-md sm:rounded-lg sm:border sm:border-th-bkg-3 sm:p-6'
: 'thin-scroll max-h-[calc(100vh-48px)] overflow-y-auto p-4 sm:h-auto sm:max-w-md sm:rounded-lg sm:border sm:border-th-bkg-3 sm:p-6'
} relative ${panelClassNames}`}
>
<div>{children}</div>

View File

@ -58,7 +58,7 @@ const RateCurveChart = ({ bank }: { bank: Bank | undefined }) => {
const rateCurveChartData = useMemo(() => {
if (!bank) return []
const defaults = [
{ util: 0, rate: 0 },
{ util: 0, rate: bank.loanFeeRate.toNumber() * 100 },
{
util: bank.util0.toNumber() * 100,
rate:

View File

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

View File

@ -8,6 +8,7 @@
"collateral": "Collateral",
"collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours",
"collateral-value": "Collateral Value",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "Advanced options set",
"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 to display",
"no-funding": "No funding earned or paid",
"no-pnl-history": "No PnL History",
"not-following-yet": "Your not following any accounts yet...",
"okay-got-it": "Okay, Got It",

View File

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

View File

@ -8,6 +8,7 @@
"collateral": "Collateral",
"collateral-funding-modal-heading": "You'll be charged collateral fees in {{remaining_hours}} hours",
"collateral-value": "Collateral Value",
"connect-funding": "Connect to view your account funding",
"custom-account-options-saved": "Advanced options set",
"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 to display",
"no-funding": "No funding earned or paid",
"no-pnl-history": "No PnL History",
"not-following-yet": "Your not following any accounts yet...",
"okay-got-it": "Okay, Got It",

View File

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

View File

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