merge main

This commit is contained in:
saml33 2023-01-18 22:41:44 +11:00
commit 4646393602
8 changed files with 91 additions and 69 deletions

View File

@ -78,7 +78,8 @@ const SwapHistoryTable = () => {
<thead>
<TrHead>
<Th className="text-left">{t('date')}</Th>
<Th className="w-1/3 text-left">{t('swap')}</Th>
<Th className="text-left">{t('swap:paid')}</Th>
<Th className="text-left">{t('swap:received')}</Th>
<Th className="text-right">{t('value')}</Th>
<Th className="text-right">{t('borrow')}</Th>
<Th className="text-right">{t('borrow-fee')}</Th>
@ -119,14 +120,14 @@ const SwapHistoryTable = () => {
if (mangoTokens.length) {
baseLogoURI = mangoTokens.find(
(t) => t.symbol === inSymbol
(t) => t.symbol.toUpperCase() === inSymbol.toUpperCase()
)?.logoURI
quoteLogoURI = mangoTokens.find(
(t) => t.symbol === outSymbol
(t) => t.symbol.toUpperCase() === outSymbol.toUpperCase()
)?.logoURI
}
const inDecimals = countLeadingZeros(swap_in_amount)
const inDecimals = countLeadingZeros(swap_in_amount) + 2
const outDecimals = countLeadingZeros(swap_out_amount) + 2
return (
<TrBody key={signature}>
@ -138,10 +139,9 @@ const SwapHistoryTable = () => {
{dayjs(block_datetime).format('h:mma')}
</p>
</Td>
<Td className="w-1/3">
<div className="flex items-center justify-between">
<div className="flex w-1/2 items-center">
<div className="mr-2 flex flex-shrink-0 items-center">
<Td>
<div className="flex items-center">
<div className="mr-2.5 flex flex-shrink-0 items-center">
<Image
alt=""
width="24"
@ -164,9 +164,10 @@ const SwapHistoryTable = () => {
</p>
</div>
</div>
<ArrowRightIcon className="mx-4 h-4 w-4 flex-shrink-0 text-th-fgd-4" />
<div className="flex w-1/2 items-center">
<div className="mr-2 flex flex-shrink-0 items-center">
</Td>
<Td>
<div className="flex items-center">
<div className="mr-2.5 flex flex-shrink-0 items-center">
<Image
alt=""
width="24"
@ -187,7 +188,6 @@ const SwapHistoryTable = () => {
</p>
</div>
</div>
</div>
</Td>
<Td>
<p className="text-right">
@ -284,13 +284,16 @@ const SwapHistoryTable = () => {
if (mangoTokens.length) {
baseLogoURI = mangoTokens.find(
(t) => t.symbol === inSymbol
(t) => t.symbol.toUpperCase() === inSymbol.toUpperCase()
)?.logoURI
quoteLogoURI = mangoTokens.find(
(t) => t.symbol === outSymbol
(t) => t.symbol.toUpperCase() === outSymbol.toUpperCase()
)?.logoURI
}
const inDecimals = countLeadingZeros(swap_in_amount) + 2
const outDecimals = countLeadingZeros(swap_out_amount) + 2
return (
<div key={signature} className="border-b border-th-bkg-3 p-4">
<div className="flex items-center justify-between">
@ -306,7 +309,7 @@ const SwapHistoryTable = () => {
</div>
<div>
<p className="whitespace-nowrap font-mono text-th-fgd-1">
{swap_in_amount.toFixed(2)}{' '}
{formatDecimal(swap_in_amount, inDecimals)}{' '}
<span className="font-body text-th-fgd-3">
{inSymbol}
</span>
@ -331,7 +334,7 @@ const SwapHistoryTable = () => {
</div>
<div>
<p className="whitespace-nowrap font-mono text-th-fgd-1">
{swap_out_amount.toFixed(2)}{' '}
{formatDecimal(swap_out_amount, outDecimals)}{' '}
<span className="font-body text-th-fgd-3">
{outSymbol}
</span>
@ -345,7 +348,10 @@ const SwapHistoryTable = () => {
</div>
</div>
</div>
<IconButton onClick={() => handleShowSwapDetails(signature)}>
<IconButton
onClick={() => handleShowSwapDetails(signature)}
size="medium"
>
<ChevronDownIcon
className={`${
showSwapDetails === signature

View File

@ -33,8 +33,12 @@ const MarketLogos = ({
)
} else {
jupiterBaseToken =
mangoTokens.find((t) => t.symbol === market.name.split('-')[0]) ||
mangoTokens.find((t) => t.symbol.includes(market.name.split('-')[0]))
mangoTokens.find(
(t) => t.symbol.toUpperCase() === market.name.split('-')[0]
) ||
mangoTokens.find((t) =>
t.symbol.toUpperCase()?.includes(market.name.split('-')[0])
)
}
const baseLogoURI = jupiterBaseToken ? jupiterBaseToken.logoURI : ''
const quoteLogoURI = jupiterQuoteToken ? jupiterQuoteToken.logoURI : ''

View File

@ -40,8 +40,8 @@ export default function useSelectedMarket() {
const baseLogoURI = useMemo(() => {
if (!baseSymbol || !mangoTokens.length) return ''
const token =
mangoTokens.find((t) => t.symbol === baseSymbol) ||
mangoTokens.find((t) => t.symbol?.includes(baseSymbol))
mangoTokens.find((t) => t.symbol.toUpperCase() === baseSymbol) ||
mangoTokens.find((t) => t.symbol.toUpperCase()?.includes(baseSymbol))
if (token) {
return token.logoURI
}
@ -64,7 +64,9 @@ export default function useSelectedMarket() {
const quoteLogoURI = useMemo(() => {
if (!quoteSymbol || !mangoTokens.length) return ''
const token = mangoTokens.find((t) => t.symbol === quoteSymbol)
const token = mangoTokens.find(
(t) => t.symbol.toUpperCase() === quoteSymbol
)
if (token) {
return token.logoURI
}

View File

@ -11,11 +11,13 @@
"maximum-cost": "Maximum Cost",
"minimum-received": "Minimum Received",
"no-history": "No swap history",
"paid": "Paid",
"pay": "You Pay",
"preset": "Preset",
"price-impact": "Price Impact",
"rate": "Rate",
"receive": "You Receive",
"received": "Received",
"review-swap": "Review Swap",
"show-fees": "Show Fees",
"slippage": "Slippage",

View File

@ -11,18 +11,20 @@
"maximum-cost": "Maximum Cost",
"minimum-received": "Minimum Received",
"no-history": "No swap history",
"paid": "Paid",
"pay": "You Pay",
"preset": "Preset",
"price-impact": "Price Impact",
"rate": "Rate",
"receive": "You Receive",
"received": "Received",
"review-swap": "Review Swap",
"show-fees": "Show Fees",
"slippage": "Slippage",
"swap-history": "Swap History",
"swap-route": "Swap Route",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
"use-margin": "Allow Margin"
}

View File

@ -11,18 +11,20 @@
"maximum-cost": "Maximum Cost",
"minimum-received": "Minimum Received",
"no-history": "No swap history",
"paid": "Paid",
"pay": "You Pay",
"preset": "Preset",
"price-impact": "Price Impact",
"rate": "Rate",
"receive": "You Receive",
"received": "Received",
"review-swap": "Review Swap",
"show-fees": "Show Fees",
"slippage": "Slippage",
"swap-history": "Swap History",
"swap-route": "Swap Route",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
"use-margin": "Allow Margin"
}

View File

@ -11,18 +11,20 @@
"maximum-cost": "Maximum Cost",
"minimum-received": "Minimum Received",
"no-history": "No swap history",
"paid": "Paid",
"pay": "You Pay",
"preset": "Preset",
"price-impact": "Price Impact",
"rate": "Rate",
"receive": "You Receive",
"received": "Received",
"review-swap": "Review Swap",
"show-fees": "Show Fees",
"slippage": "Slippage",
"swap-history": "Swap History",
"swap-route": "Swap Route",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
"use-margin": "Allow Margin"
}

View File

@ -11,18 +11,20 @@
"maximum-cost": "Maximum Cost",
"minimum-received": "Minimum Received",
"no-history": "No swap history",
"paid": "Paid",
"pay": "You Pay",
"preset": "Preset",
"price-impact": "Price Impact",
"rate": "Rate",
"receive": "You Receive",
"received": "Received",
"review-swap": "Review Swap",
"show-fees": "Show Fees",
"slippage": "Slippage",
"swap-history": "Swap History",
"swap-route": "Swap Route",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap",
"tooltip-borrow-balance": "You'll use your {{balance}} {{token}} balance and borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-borrow-no-balance": "You'll borrow {{borrowAmount}} {{token}} to execute this swap. The current {{token}} variable borrow rate is {{rate}}%",
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
"use-margin": "Allow Margin"
}