* MP-3480: remove favourite asset and prepare localStore * env: updated shuttle, keplr and version (#566) * fix: fixed dust left when trying to buy max amount without leverage (#565) * feat: added squidrouter to the bridges (#561) * feat: added squidrouter to the bridges * fix: copy update * MP-3521: updated the APR calculation (#572) * Table fixes (#563) * fix: fixed the sorting of the tables * fix: added sorting functions * fix: farm sorting for deposit cap * fix: fixed Row types * Build(deps-dev): bump prettier-plugin-tailwindcss from 0.5.5 to 0.5.6 (#567) Bumps [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) from 0.5.5 to 0.5.6. - [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.5...v0.5.6) --- 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> * Build(deps): bump react-router-dom from 6.16.0 to 6.17.0 (#571) Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.16.0 to 6.17.0. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.17.0/packages/react-router-dom) --- updated-dependencies: - dependency-name: react-router-dom 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> * ✨ HLS: Add info modal (#573) * MP-3484: remember summaryAccount tabs and auto expand both (#574) * User feedback (#575) * feat: added debt indicator and adjusted the borrowModal * fix: wallet interaction fix * Add usdc noble (#576) * env: added USDC.n * env: updated usdc noble variables * fix: fixed the pool on USDC for devnet purposes * 🐛 Fix initial status of chart (#577) * MP-3480: persist trading pair * fix: updated according to feedback * fix: remove pair from Trading View header --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { useMemo } from 'react'
|
|
|
|
import MigrationBanner from 'components/MigrationBanner'
|
|
import AccountDetailsCard from 'components/Trade/AccountDetailsCard'
|
|
import TradeChart from 'components/Trade/TradeChart'
|
|
import TradeModule from 'components/Trade/TradeModule'
|
|
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
|
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
|
import useLocalStorage from 'hooks/useLocalStorage'
|
|
import useStore from 'store'
|
|
import { byDenom } from 'utils/array'
|
|
import { getEnabledMarketAssets } from 'utils/assets'
|
|
|
|
export default function TradePage() {
|
|
const [tradingPair] = useLocalStorage<Settings['tradingPair']>(
|
|
LocalStorageKeys.TRADING_PAIR,
|
|
DEFAULT_SETTINGS.tradingPair,
|
|
)
|
|
const enabledMarketAssets = getEnabledMarketAssets()
|
|
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
|
|
|
const buyAsset = useMemo(
|
|
() => enabledMarketAssets.find(byDenom(tradingPair.buy)) ?? enabledMarketAssets[0],
|
|
[tradingPair, enabledMarketAssets],
|
|
)
|
|
const sellAsset = useMemo(
|
|
() => enabledMarketAssets.find(byDenom(tradingPair.sell)) ?? enabledMarketAssets[1],
|
|
[tradingPair, enabledMarketAssets],
|
|
)
|
|
|
|
if (!tradingPair) return null
|
|
|
|
return (
|
|
<div className='flex flex-col w-full h-full gap-4'>
|
|
<MigrationBanner />
|
|
<div className='grid h-full w-full grid-cols-[346px_auto] gap-4'>
|
|
<TradeModule buyAsset={buyAsset} sellAsset={sellAsset} />
|
|
<TradeChart buyAsset={buyAsset} sellAsset={sellAsset} />
|
|
<div />
|
|
<AccountDetailsCard />
|
|
</div>
|
|
{assetOverlayState !== 'closed' && (
|
|
<div
|
|
className='fixed top-0 left-0 z-40 block w-full h-full hover:cursor-pointer'
|
|
onClick={() => useStore.setState({ assetOverlayState: 'closed' })}
|
|
role='button'
|
|
/>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|