forked from cerc-io/cosmos-explorer
Fix: trust color
This commit is contained in:
parent
a42eb4fae7
commit
c5b88d73c2
@ -12,7 +12,7 @@ import {
|
|||||||
useParamStore,
|
useParamStore,
|
||||||
} from '@/stores';
|
} from '@/stores';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useIndexModule } from './indexStore';
|
import { useIndexModule, colorMap } from './indexStore';
|
||||||
import { computed } from '@vue/reactivity';
|
import { computed } from '@vue/reactivity';
|
||||||
|
|
||||||
import CardStatisticsVertical from '@/components/CardStatisticsVertical.vue';
|
import CardStatisticsVertical from '@/components/CardStatisticsVertical.vue';
|
||||||
@ -99,6 +99,10 @@ const color = computed(() => {
|
|||||||
function updateState() {
|
function updateState() {
|
||||||
walletStore.loadMyAsset()
|
walletStore.loadMyAsset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trustColor(v: string) {
|
||||||
|
return `text-${colorMap(v)}`
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -158,7 +162,7 @@ function updateState() {
|
|||||||
<li v-for="(item, index) in store.coinInfo.tickers" :key="index" @click="store.selectTicker(index)">
|
<li v-for="(item, index) in store.coinInfo.tickers" :key="index" @click="store.selectTicker(index)">
|
||||||
<div class="flex items-center justify-between hover:bg-base-100">
|
<div class="flex items-center justify-between hover:bg-base-100">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<div class="text-main text-sm">
|
<div class="text-main text-sm" :class="trustColor(item.trust_score)">
|
||||||
{{ item?.market?.name }}
|
{{ item?.market?.name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-gray-500 dark:text-gray-400">
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
||||||
@ -178,7 +182,7 @@ function updateState() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a :color="store.trustColor" class="my-5 !text-white btn !bg-yes !border-yes w-full" :href="ticker.trade_url"
|
<a class="my-5 !text-white btn w-full" :class="store.trustColor" :href="ticker.trade_url"
|
||||||
target="_blank">
|
target="_blank">
|
||||||
Buy {{ coinInfo.symbol || '' }}
|
Buy {{ coinInfo.symbol || '' }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -13,7 +13,7 @@ import type { Coin, Tally } from '@/types';
|
|||||||
import numeral from 'numeral';
|
import numeral from 'numeral';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
function colorMap(color: string) {
|
export function colorMap(color: string) {
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case 'yellow':
|
case 'yellow':
|
||||||
return 'warning';
|
return 'warning';
|
||||||
@ -128,7 +128,7 @@ export const useIndexModule = defineStore('module-index', {
|
|||||||
trustColor(): string {
|
trustColor(): string {
|
||||||
if(!this.coinInfo?.tickers) return ""
|
if(!this.coinInfo?.tickers) return ""
|
||||||
const change = this.coinInfo?.tickers[this.tickerIndex]?.trust_score;
|
const change = this.coinInfo?.tickers[this.tickerIndex]?.trust_score;
|
||||||
return colorMap(change);
|
return `btn-${colorMap(change)}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
pool() {
|
pool() {
|
||||||
|
Loading…
Reference in New Issue
Block a user