improve logo

This commit is contained in:
liangping 2023-06-19 08:18:15 +08:00
parent 30ffac1b93
commit f69546d44f

View File

@ -125,18 +125,18 @@ function isFeatured(endpoints: string[], who?: {website?: string, moniker: strin
const list = computed(() => { const list = computed(() => {
if (tab.value === 'active') { if (tab.value === 'active') {
return staking.validators.map((x, i) => ({v: x, rank: calculateRank(i)})); return staking.validators.map((x, i) => ({v: x, rank: calculateRank(i), logo: logo(x.description.identity)}));
} else if (tab.value === 'featured') { } else if (tab.value === 'featured') {
const endpoint = chainStore.current?.endpoints?.rest?.map(x => x.provider) const endpoint = chainStore.current?.endpoints?.rest?.map(x => x.provider)
if(endpoint) { if(endpoint) {
endpoint.push('ping') endpoint.push('ping')
return staking.validators return staking.validators
.filter(x => isFeatured(endpoint, x.description)) .filter(x => isFeatured(endpoint, x.description))
.map((x, i) => ({v: x, rank: 'primary'})); .map((x, i) => ({v: x, rank: 'primary', logo: logo(x.description.identity)}));
} }
return [] return []
} }
return unbondList.value.map((x, i) => ({v: x, rank: 'primary'})); return unbondList.value.map((x, i) => ({v: x, rank: 'primary', logo: logo(x.description.identity)}));
}); });
const loadAvatars = () => { const loadAvatars = () => {
@ -175,7 +175,7 @@ const loadAvatars = () => {
}; };
const logo = (identity?: string) => { const logo = (identity?: string) => {
if (!identity) return ''; if (!identity || !avatars.value[identity]) return '';
const url = avatars.value[identity] || ''; const url = avatars.value[identity] || '';
return url.startsWith('http') return url.startsWith('http')
? url ? url
@ -286,7 +286,7 @@ loadAvatars();
</thead> </thead>
<tbody> <tbody>
<tr <tr
v-for="({v, rank}, i) in list" v-for="({v, rank, logo}, i) in list"
:key="v.operator_address" :key="v.operator_address"
class="hover:bg-gray-100 dark:hover:bg-[#384059]" class="hover:bg-gray-100 dark:hover:bg-[#384059]"
> >
@ -317,8 +317,8 @@ loadAvatars();
></div> ></div>
<div class="w-8 h-8 rounded-full"> <div class="w-8 h-8 rounded-full">
<img <img
v-if="v.description?.identity" v-if="logo"
:src="logo(v.description?.identity )" :src="logo"
class="object-contain" class="object-contain"
/> />
<Icon <Icon