improve UI

This commit is contained in:
liangping 2023-05-15 16:05:39 +08:00
parent b7dfc04f5e
commit 77cb720bc7
7 changed files with 24 additions and 24 deletions

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { Commit } from '@/types'; import type { Commit } from '@/types';
import { computed, type PropType } from 'vue';
const props = defineProps({ const props = defineProps({
blocks: { type: Array as PropType<Commit[]> }, blocks: { type: Array as PropType<Commit[]> },
@ -8,6 +9,7 @@ const props = defineProps({
const bars = computed(() => { const bars = computed(() => {
const uptime = Array(50).fill({ height: 0, color: 'bg-secondary' }); const uptime = Array(50).fill({ height: 0, color: 'bg-secondary' });
if(!props.blocks) return uptime
props.blocks.forEach((element) => { props.blocks.forEach((element) => {
const has = element.signatures?.findIndex( const has = element.signatures?.findIndex(
(sig) => sig.validator_address === props.validator (sig) => sig.validator_address === props.validator
@ -29,10 +31,14 @@ const bars = computed(() => {
<span <span
:class="item.color" :class="item.color"
class="rounded" class="rounded"
style="width: 1.5%" style="width: 1.3%"
>&nbsp; >&nbsp;
</span> </span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<style>
</style>

View File

@ -8,7 +8,7 @@ const props = defineProps(['value']);
<table class="table w-full text-sm"> <table class="table w-full text-sm">
<tbody> <tbody>
<tr v-for="(v, k) of value"> <tr v-for="(v, k) of value">
<td class="text-capitalize" style="max-width: 200px">{{ k }}</td> <td class="text-capitalize" style="max-width: 100px">{{ String(k).replaceAll("_", " ") }}</td>
<td> <td>
<div <div
class="overflow-hidden w-auto whitespace-normal" class="overflow-hidden w-auto whitespace-normal"

View File

@ -155,7 +155,7 @@ const processList = computed(() => {
{ name: 'Turnout', value: turnout.value, class: 'bg-info' }, { name: 'Turnout', value: turnout.value, class: 'bg-info' },
{ name: 'Yes', value: yes.value, class: 'bg-success' }, { name: 'Yes', value: yes.value, class: 'bg-success' },
{ name: 'No', value: no.value, class: 'bg-error' }, { name: 'No', value: no.value, class: 'bg-error' },
{ name: 'No With Veto', value: veto.value, class: 'bg-primary' }, { name: 'No With Veto', value: veto.value, class: 'bg-red-800' },
{ name: 'Abstain', value: abstain.value, class: 'bg-warning' }, { name: 'Abstain', value: abstain.value, class: 'bg-warning' },
]; ];
}); });

View File

@ -315,7 +315,7 @@ const rank = function (position: number) {
<label <label
v-else v-else
for="delegate" for="delegate"
class="btn btn-xs bg-primary" class="btn btn-xs bg-primary capitalize"
@click=" @click="
dialog.open('delegate', { dialog.open('delegate', {
validator_address: v.operator_address, validator_address: v.operator_address,

View File

@ -49,9 +49,8 @@ const messages = computed(() => {
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<div class="badge badge-primary badge-sm">oioio</div>
<div <div
class="text-xs truncate relative py-2 px-4 rounded-full w-fit mr-2" class="text-xs truncate relative py-2 px-4 w-fit mr-2"
:class="`text-${ :class="`text-${
tx.tx_response.code === 0 ? 'success' : 'error' tx.tx_response.code === 0 ? 'success' : 'error'
}`" }`"

View File

View File

@ -30,7 +30,8 @@ const local = ref(
string[] string[]
> >
); );
const selected = ref(local.value[chainStore.chainName] as string[]); // favorite validators on selected blockchain const currentPined = local.value[chainStore.chainName]
const selected = ref(currentPined || []); // favorite validators on selected blockchain
const signingInfo = ref({} as Record<string, SigningInfo>); const signingInfo = ref({} as Record<string, SigningInfo>);
@ -49,7 +50,7 @@ onMounted(() => {
latest.value = b; latest.value = b;
commits.value.unshift(b.block.last_commit); commits.value.unshift(b.block.last_commit);
const height = Number(b.block.header?.height || 0); const height = Number(b.block.header?.height || 0);
if (height > 0) { if (height === 0) {
// constructs sequence for loading blocks // constructs sequence for loading blocks
let promise = Promise.resolve(); let promise = Promise.resolve();
for (let i = height - 1; i > height - 50; i -= 1) { for (let i = height - 1; i > height - 50; i -= 1) {
@ -84,7 +85,6 @@ const commits2 = computed(() => {
return all.length > 50 ? all.slice(all.length - 50): all return all.length > 50 ? all.slice(all.length - 50): all
}) })
onUnmounted(() => { onUnmounted(() => {
live.value = false; live.value = false;
}); });
@ -110,23 +110,18 @@ watchEffect(() => {
<span class="">Favorite</span> <span class="">Favorite</span>
</button> </button>
</div> </div>
<div <div
class="grid grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-x-4 mt-4" class="grid grid-cols-1 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-x-4 mt-4"
> >
<div v-for="(v, i) in validators" :key="i" > <div v-for="(v, i) in validators" :key="i" >
<div class="flex items-center justify-between"> <div class="flex items-center justify-between py-0">
<VCheckbox <label class="text-truncate text-sm">
<input type="checkbox"
v-model="selected" v-model="selected"
color="warning"
:value="v.operator_address" :value="v.operator_address"
> />
<template v-slot:label> <span class="ml-1 text-black dark:text-white">{{ i + 1 }}.{{ v.description.moniker }}</span>
<span class="text-truncate text-sm" </label>
>{{ i + 1 }}. {{ v.description.moniker }}</span
>
</template>
</VCheckbox>
<div <div
v-if=" v-if="
Number( Number(