* env: enable HLS * feat: added background and orb fading * tidy: updated the token logos (#629) * tidy: updated the token logos * feat: added dydx * fix: increase load spead of trading charts * feat: first version of the UI shift * Deployment for HLS testing * ✨ add APY to HLS staking * ✨ add APY account overview and summary * fix: fixed the intro component visibility * ✨ add warning messages HLS * fix: menu order * ✨ implement live APRs * auto-select first account, add no balance message * enable tabs for hls, fix net APY for deposit * fix button for hls, sorting apy and console warnings * disable feature flag HLS * fix slider * update routing --------- Co-authored-by: Linkie Link <linkielink.dev@gmail.com>
37 lines
874 B
TypeScript
37 lines
874 B
TypeScript
export function getRoute(page: Page, address?: string, accountId?: string | null) {
|
|
let nextUrl = ''
|
|
|
|
if (address) {
|
|
nextUrl += `/wallets/${address}`
|
|
}
|
|
|
|
nextUrl += `/${page}`
|
|
|
|
let url = new URL(nextUrl, 'https://app.marsprotocol.io')
|
|
|
|
if (accountId) {
|
|
url.searchParams.append('accountId', accountId)
|
|
} else {
|
|
url.searchParams.delete('accountId')
|
|
}
|
|
|
|
return url.pathname + url.search
|
|
}
|
|
|
|
export function getPage(pathname: string): Page {
|
|
const pages: Page[] = ['trade', 'borrow', 'farm', 'lend', 'portfolio', 'hls-farm', 'hls-staking']
|
|
const segments = pathname.split('/')
|
|
|
|
const page = segments.find((segment) => pages.includes(segment as Page))
|
|
|
|
if (page) {
|
|
if (page === 'portfolio') {
|
|
const path = pathname.split('portfolio')[1]
|
|
return (page + path) as Page
|
|
}
|
|
return page as Page
|
|
}
|
|
|
|
return 'trade' as Page
|
|
}
|