Various fixes (#485)
* fix: fixed info icon * fix: remove margin trading on asset select * fix: force abbreviated values larger than 1_000 to be max two decimals * fix: added AssetRate to Select Option * fix: fixed reduceMotion default setting on resetSettings * fix: disable autoLend on AXL and stATOM * Build(deps): bump @splinetool/runtime from 0.9.443 to 0.9.452 (#484) Bumps @splinetool/runtime from 0.9.443 to 0.9.452. --- updated-dependencies: - dependency-name: "@splinetool/runtime" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Build(deps-dev): bump prettier from 3.0.2 to 3.0.3 (#483) Bumps [prettier](https://github.com/prettier/prettier) from 3.0.2 to 3.0.3. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.0.2...3.0.3) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Build(deps-dev): bump prettier-plugin-tailwindcss from 0.5.3 to 0.5.4 (#481) Bumps [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) from 0.5.3 to 0.5.4. - [Release notes](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/compare/v0.5.3...v0.5.4) --- updated-dependencies: - dependency-name: prettier-plugin-tailwindcss dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Linkie Link <linkielink.dev@gmail.com> * Build(deps): bump @tanstack/react-table from 8.9.3 to 8.10.0 (#482) Bumps [@tanstack/react-table](https://github.com/tanstack/table) from 8.9.3 to 8.10.0. - [Release notes](https://github.com/tanstack/table/releases) - [Commits](https://github.com/tanstack/table/compare/v8.9.3...v8.10.0) --- updated-dependencies: - dependency-name: "@tanstack/react-table" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Linkie Link <linkielink.dev@gmail.com> * fix: get the info icon out of the users FACE --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
4a8d511499
commit
f87403eb4d
@ -25,7 +25,7 @@ function RateTooltip(props: TooltipProps) {
|
||||
type='info'
|
||||
className={props.orientation === 'ltr' ? 'mr-1' : 'ml-1'}
|
||||
>
|
||||
<InfoCircle className='w-4 h-4' />
|
||||
<InfoCircle className='w-4 h-4 text-white/40 hover:text-inherit' />
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M7.99992 10.6673V8.00065M7.99992 5.33398H8.00659M14.6666 8.00065C14.6666 11.6826 11.6818 14.6673 7.99992 14.6673C4.31802 14.6673 1.33325 11.6826 1.33325 8.00065C1.33325 4.31875 4.31802 1.33398 7.99992 1.33398C11.6818 1.33398 14.6666 4.31875 14.6666 8.00065Z"
|
||||
stroke="currentColor"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M8.00019 0.730774C3.98577 0.730774 0.730957 3.98558 0.730957 8C0.730957 12.0144 3.98577 15.2692 8.00019 15.2692C12.0146 15.2692 15.2694 12.0144 15.2694 8C15.2694 3.98558 12.0146 0.730774 8.00019 0.730774ZM9.51461 11.9976C9.13961 12.1442 8.84153 12.2572 8.61798 12.3341C8.39442 12.4111 8.13721 12.4495 7.84153 12.4495C7.38961 12.4495 7.03625 12.3389 6.78384 12.1178C6.53384 11.899 6.40884 11.6178 6.40884 11.2764C6.40884 11.1442 6.41846 11.0096 6.43769 10.8726C6.45452 10.7332 6.48577 10.5793 6.52663 10.4039L6.99538 8.75C7.03625 8.59135 7.0723 8.44231 7.10115 8.30049C7.13 8.15866 7.14201 8.02885 7.14201 7.91106C7.14201 7.70193 7.09875 7.55289 7.01221 7.47116C6.92327 7.38702 6.7574 7.34616 6.51221 7.34616C6.39202 7.34616 6.26702 7.36539 6.13961 7.40145C6.01221 7.43991 5.90403 7.47597 5.81269 7.50962L5.93769 7C6.24298 6.875 6.53625 6.76924 6.8175 6.68029C7.09634 6.59135 7.36317 6.54568 7.61077 6.54568C8.06028 6.54568 8.40884 6.65625 8.65163 6.8726C8.89442 7.08895 9.01702 7.3726 9.01702 7.71875C9.01702 7.79087 9.0098 7.91827 8.99298 8.09856C8.97615 8.27885 8.9449 8.44472 8.89923 8.59856L8.43288 10.2476C8.39442 10.3798 8.36077 10.5313 8.32952 10.6995C8.30067 10.8678 8.28625 10.9976 8.28625 11.0841C8.28625 11.3029 8.33432 11.4543 8.43288 11.5337C8.52903 11.613 8.69971 11.6514 8.9425 11.6514C9.05548 11.6514 9.18288 11.6322 9.32711 11.5938C9.46894 11.5529 9.5723 11.5192 9.63721 11.488L9.51461 11.9976ZM9.43048 5.30289C9.21413 5.50481 8.95211 5.60577 8.64682 5.60577C8.34153 5.60577 8.07711 5.50481 7.85836 5.30289C7.63961 5.10097 7.53144 4.85577 7.53144 4.56972C7.53144 4.28366 7.64202 4.03606 7.85836 3.83174C8.07711 3.62741 8.34153 3.52645 8.64682 3.52645C8.95211 3.52645 9.21413 3.62741 9.43048 3.83174C9.64923 4.03606 9.7574 4.28366 9.7574 4.56972C9.7574 4.85577 9.64923 5.10097 9.43048 5.30289Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 1.9 KiB |
@ -177,7 +177,7 @@ export default function SettingsModal() {
|
||||
handleDisplayCurrency(DEFAULT_SETTINGS.displayCurrency)
|
||||
handlePreferredAsset(DEFAULT_SETTINGS.preferredAsset)
|
||||
handleSlippage(DEFAULT_SETTINGS.slippage)
|
||||
handleReduceMotion(!DEFAULT_SETTINGS.reduceMotion)
|
||||
handleReduceMotion(DEFAULT_SETTINGS.reduceMotion)
|
||||
handleLendAssets(DEFAULT_SETTINGS.lendAssets)
|
||||
}, [
|
||||
handleDisplayCurrency,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import classNames from 'classnames'
|
||||
|
||||
import AssetImage from 'components/Asset/AssetImage'
|
||||
import AssetRate from 'components/Asset/AssetRate'
|
||||
import DisplayCurrency from 'components/DisplayCurrency'
|
||||
import { ChevronDown, ChevronRight } from 'components/Icons'
|
||||
import Text from 'components/Text'
|
||||
@ -78,14 +79,14 @@ export default function Option(props: Props) {
|
||||
rounded: true,
|
||||
})}
|
||||
</Text>
|
||||
<Text size='sm' className='col-span-2 text-white/50'>
|
||||
{formatValue(convertAprToApy((marketAsset?.borrowRate ?? 0) * 100, 365), {
|
||||
maxDecimals: 2,
|
||||
minDecimals: 0,
|
||||
prefix: 'APY ',
|
||||
suffix: '%',
|
||||
})}
|
||||
</Text>
|
||||
<AssetRate
|
||||
rate={convertAprToApy((marketAsset?.borrowRate ?? 0) * 100, 365)}
|
||||
isEnabled={marketAsset?.borrowEnabled ?? false}
|
||||
className='col-span-2 text-white/50'
|
||||
type='apy'
|
||||
orientation='rtl'
|
||||
suffix
|
||||
/>
|
||||
<DisplayCurrency
|
||||
className='col-span-2 text-sm text-right text-white/50'
|
||||
coin={BNCoin.fromDenomAndBigNumber(asset.denom, balance)}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { InfoCircle } from 'components/Icons'
|
||||
import Switch from 'components/Switch'
|
||||
import Text from 'components/Text'
|
||||
import { Tooltip } from 'components/Tooltip'
|
||||
@ -13,7 +12,7 @@ interface Props {
|
||||
|
||||
export default function MarginToggle(props: Props) {
|
||||
return (
|
||||
<div className='flex flex-1 flex-row justify-between bg-white/5 px-4 py-2'>
|
||||
<div className='flex flex-row justify-between flex-1 px-4 py-2 bg-white/5'>
|
||||
<Text size='sm'>Margin</Text>
|
||||
|
||||
<ConditionalWrapper
|
||||
@ -34,9 +33,6 @@ export default function MarginToggle(props: Props) {
|
||||
>
|
||||
<div className='flex flex-row'>
|
||||
<Switch {...props} name='margin' />
|
||||
{props.disabled && (
|
||||
<InfoCircle width={16} height={16} className='ml-2 mt-0.5 opacity-20' />
|
||||
)}
|
||||
</div>
|
||||
</ConditionalWrapper>
|
||||
</div>
|
||||
|
@ -2,6 +2,7 @@ import classNames from 'classnames'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
import ActionButton from 'components/Button/ActionButton'
|
||||
import { FormattedNumber } from 'components/FormattedNumber'
|
||||
import useSwapRoute from 'hooks/useSwapRoute'
|
||||
import { getAssetByDenom } from 'utils/assets'
|
||||
import { formatAmountWithSymbol, formatPercent } from 'utils/formatters'
|
||||
@ -60,12 +61,18 @@ export default function TradeSummary(props: Props) {
|
||||
<>
|
||||
<div className={className.infoLine}>
|
||||
<span className={className.infoLineLabel}>Borrowing</span>
|
||||
<span>
|
||||
{formatAmountWithSymbol({
|
||||
denom: sellAsset.denom,
|
||||
amount: borrowAmount.toString(),
|
||||
})}
|
||||
</span>
|
||||
<FormattedNumber
|
||||
amount={borrowAmount.toNumber()}
|
||||
options={{
|
||||
decimals: sellAsset.decimals,
|
||||
maxDecimals: sellAsset.decimals,
|
||||
minDecimals: 0,
|
||||
suffix: ` ${sellAsset.symbol}`,
|
||||
abbreviated: true,
|
||||
rounded: true,
|
||||
}}
|
||||
animate
|
||||
/>
|
||||
</div>
|
||||
<div className={className.infoLine}>
|
||||
<span className={className.infoLineLabel}>Borrow rate</span>
|
||||
|
@ -194,6 +194,7 @@ export default function SwapForm(props: Props) {
|
||||
useEffect(() => {
|
||||
setBuyAssetAmount(BN_ZERO)
|
||||
setSellAssetAmount(BN_ZERO)
|
||||
setMarginChecked(false)
|
||||
simulateTrade(
|
||||
BNCoin.fromDenomAndBigNumber(buyAsset.denom, BN_ZERO),
|
||||
BNCoin.fromDenomAndBigNumber(sellAsset.denom, BN_ZERO),
|
||||
|
@ -52,7 +52,7 @@ export const ASSETS: Asset[] = [
|
||||
isEnabled: !IS_TESTNET,
|
||||
isMarket: !IS_TESTNET,
|
||||
isDisplayCurrency: !IS_TESTNET,
|
||||
isAutoLendEnabled: true,
|
||||
isAutoLendEnabled: false,
|
||||
poolId: 803,
|
||||
},
|
||||
{
|
||||
@ -139,7 +139,7 @@ export const ASSETS: Asset[] = [
|
||||
isEnabled: !IS_TESTNET,
|
||||
isMarket: !IS_TESTNET,
|
||||
isDisplayCurrency: !IS_TESTNET,
|
||||
isAutoLendEnabled: true,
|
||||
isAutoLendEnabled: false,
|
||||
pythPriceFeedId: '60144b1d5c9e9851732ad1d9760e3485ef80be39b984f6bf60f82b28a2b7f126',
|
||||
poolId: 812,
|
||||
},
|
||||
|
@ -45,6 +45,7 @@ export const formatValue = (amount: number | string, options?: FormatOptions): s
|
||||
let numberOfZeroDecimals: number | null = null
|
||||
const minDecimals = options?.minDecimals ?? 2
|
||||
const maxDecimals = options?.maxDecimals ?? 2
|
||||
let enforcedDecimals = maxDecimals
|
||||
const thousandSeparator = options?.thousandSeparator ?? true
|
||||
|
||||
if (typeof amount === 'string') {
|
||||
@ -94,21 +95,25 @@ export const formatValue = (amount: number | string, options?: FormatOptions): s
|
||||
}
|
||||
}
|
||||
|
||||
if (amountSuffix === 'B' || amountSuffix === 'M' || amountSuffix === 'K') {
|
||||
enforcedDecimals = 2
|
||||
}
|
||||
|
||||
if (thousandSeparator) {
|
||||
convertedAmount = BN(convertedAmount).toNumber().toLocaleString('en', {
|
||||
useGrouping: true,
|
||||
minimumFractionDigits: minDecimals,
|
||||
maximumFractionDigits: maxDecimals,
|
||||
maximumFractionDigits: enforcedDecimals,
|
||||
})
|
||||
}
|
||||
|
||||
let returnValue = ''
|
||||
|
||||
if (numberOfZeroDecimals) {
|
||||
if (numberOfZeroDecimals < maxDecimals) {
|
||||
if (numberOfZeroDecimals < enforcedDecimals) {
|
||||
returnValue = Number(returnValue).toFixed(numberOfZeroDecimals)
|
||||
} else {
|
||||
returnValue = Number(returnValue).toFixed(maxDecimals)
|
||||
returnValue = Number(returnValue).toFixed(enforcedDecimals)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user