limit price display fix
This commit is contained in:
@@ -138,7 +138,7 @@ export function initWidget(el) {
|
|||||||
enabled_features: ['saveload_separate_drawings_storage'],
|
enabled_features: ['saveload_separate_drawings_storage'],
|
||||||
drawings_access: {type: 'white', tools: [],}, // show no tools
|
drawings_access: {type: 'white', tools: [],}, // show no tools
|
||||||
custom_themes: tvCustomThemes,
|
custom_themes: tvCustomThemes,
|
||||||
theme: 'dark',
|
theme: useStore().theme,
|
||||||
});
|
});
|
||||||
|
|
||||||
// debug dump all events
|
// debug dump all events
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ function buildSymbolIndex() {
|
|||||||
// return str
|
// return str
|
||||||
// }
|
// }
|
||||||
|
|
||||||
function invertedDefault(tokenAddrA, tokenAddrB) {
|
export function invertedDefault(tokenAddrA, tokenAddrB) {
|
||||||
// lower priority is more important (earlier in the list)
|
// lower priority is more important (earlier in the list)
|
||||||
const a = tokenMap[tokenAddrA];
|
const a = tokenMap[tokenAddrA];
|
||||||
const b = tokenMap[tokenAddrB];
|
const b = tokenMap[tokenAddrB];
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import {usePrefStore, useStore} from "@/store/store";
|
import {usePrefStore, useStore} from "@/store/store";
|
||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import {getToken} from "@/blockchain/token.js";
|
import {getToken} from "@/blockchain/token.js";
|
||||||
import {flipInversionPreference, inversionPreference, pairPrice} from "@/misc.js";
|
import {flipInversionPreference, inversionPreference} from "@/misc.js";
|
||||||
|
|
||||||
const props = defineProps(['value', 'base', 'quote', 'showBtn'])
|
const props = defineProps(['value', 'base', 'quote', 'showBtn'])
|
||||||
|
|
||||||
@@ -35,6 +35,23 @@ const pair = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function pairPrice(chainId, baseToken, quoteToken, price) {
|
||||||
|
if (price === null || price === undefined)
|
||||||
|
return null
|
||||||
|
const decimals = baseToken.d - quoteToken.d
|
||||||
|
// console.log('pairPrice', chainId, baseToken, quoteToken, price, decimals)
|
||||||
|
// console.log('adjusted pairPrice', price)
|
||||||
|
if (decimals >= 0)
|
||||||
|
price /= 10 ** decimals
|
||||||
|
else
|
||||||
|
price *= 10 ** -decimals
|
||||||
|
if (inversionPreference(chainId, baseToken, quoteToken))
|
||||||
|
price = 1 / price
|
||||||
|
// console.log('inverted?', price)
|
||||||
|
return price
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
17
src/misc.js
17
src/misc.js
@@ -163,23 +163,6 @@ export function inversionPreference(chainId, base, quote) {
|
|||||||
return prefs.inverted[key] !== inputInverted
|
return prefs.inverted[key] !== inputInverted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function pairPrice(chainId, baseToken, quoteToken, price) {
|
|
||||||
if (price === null || price === undefined)
|
|
||||||
return null
|
|
||||||
const decimals = quoteToken.d - baseToken.d
|
|
||||||
// console.log('pairPrice', chainId, baseToken, quoteToken, price, decimals)
|
|
||||||
if (decimals >= 0)
|
|
||||||
price /= 10 ** decimals
|
|
||||||
else
|
|
||||||
price *= 10 ** -decimals
|
|
||||||
// console.log('adjusted pairPrice', price)
|
|
||||||
if (inversionPreference(chainId, baseToken, quoteToken))
|
|
||||||
price = 1 / price
|
|
||||||
// console.log('inverted?', price)
|
|
||||||
return price
|
|
||||||
}
|
|
||||||
|
|
||||||
export const sleep = ms => new Promise(r => setTimeout(r, ms))
|
export const sleep = ms => new Promise(r => setTimeout(r, ms))
|
||||||
|
|
||||||
export function uuid() {
|
export function uuid() {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export const useStore = defineStore('app', ()=> {
|
|||||||
const timeZone = ref('Etc/UTC')
|
const timeZone = ref('Etc/UTC')
|
||||||
|
|
||||||
const nav = ref(false) // controls opening navigation drawer
|
const nav = ref(false) // controls opening navigation drawer
|
||||||
const theme = ref('dark')
|
const theme = ref('light') // todo 'dark'
|
||||||
|
|
||||||
const connected = ref(false)
|
const connected = ref(false)
|
||||||
const allowed = ref(!REQUIRE_AUTH)
|
const allowed = ref(!REQUIRE_AUTH)
|
||||||
|
|||||||
Reference in New Issue
Block a user