diff --git a/docs/index.html b/docs/index.html index 87e4c3c..1dcb240 100644 --- a/docs/index.html +++ b/docs/index.html @@ -93,11 +93,11 @@ clear local data
-
+

Assets

    - +
    { - if (tradeType === 'buy') { - button.title = `Buy ${params.asset} worth ${button.textContent} of total rupee` - } else { - button.title = `Sell ${button.textContent} of total ${params.asset}` - } - }) + if (params.hasOwnProperty('asset') && params.asset !== '') { + if (getRef('listed_assets').querySelector('.listed-asset--active')) + getRef('listed_assets').querySelector('.listed-asset--active').classList.remove('listed-asset--active') + getRef('listed_assets').querySelector(`[href="#/exchange?asset=${params.asset}"]`).classList.add('listed-asset--active') + getRef('get_price').value = parseFloat(floGlobals.exchangeRates[params.asset].toFixed(2)) + getRef('traded_asset').textContent = `Trade ${params.asset}` + getRef('trade_button').textContent = `${tradeType} ${params.asset}` + getRef('quantity_type').textContent = tradeType === 'buy' ? formatAmount(allTokens.rupee.net) : `${parseFloat(allTokens[params.asset].net.toFixed(3))} ${params.asset}` + getRef('quantity_selector').querySelectorAll('.button').forEach(button => { + if (tradeType === 'buy') { + button.title = `Buy ${params.asset} worth ${button.textContent} of total rupee` + } else { + button.title = `Sell ${button.textContent} of total ${params.asset}` + } + }) + } + if (params.hasOwnProperty('asset') && params.asset !== '') { + getRef('exchange_wrapper').children[0].classList.add('hide-on-mobile') + getRef('exchange_wrapper').children[1].classList.remove('hide-on-mobile') + } else { + getRef('exchange_wrapper').children[1].classList.add('hide-on-mobile') + getRef('exchange_wrapper').children[0].classList.remove('hide-on-mobile') + } break; case 'my_orders': break; @@ -1010,6 +1019,26 @@ this.render() } } + function animateTo(element, keyframes, options) { + const anime = element.animate(keyframes, { ...options, fill: 'both' }) + anime.finished.then(() => { + anime.commitStyles() + anime.cancel() + }) + return anime + } + let isMobileView = false + const mobileQuery = window.matchMedia('(max-width: 40rem)') + function handleMobileChange(e) { + isMobileView = e.matches + if (!isMobileView) { + getRef('exchange_wrapper').children[0].style = '' + getRef('exchange_wrapper').children[1].style = '' + } + } + mobileQuery.addEventListener('change', handleMobileChange) + + handleMobileChange(mobileQuery)