diff --git a/src/components/ProposalListItem.vue b/src/components/ProposalListItem.vue index a10aaf73..7b32a13a 100644 --- a/src/components/ProposalListItem.vue +++ b/src/components/ProposalListItem.vue @@ -8,6 +8,7 @@ import { ref } from 'vue'; defineProps({ proposals: { type: Object as PropType }, + votable: { type: Boolean, default: false } }); const format = useFormatter(); @@ -30,12 +31,12 @@ const proposalInfo = ref(); diff --git a/src/modules/[chain]/uptime/favorite.vue b/src/modules/[chain]/uptime/favorite.vue deleted file mode 100644 index e69de29b..00000000 diff --git a/src/modules/[chain]/uptime/index.vue b/src/modules/[chain]/uptime/index.vue index a86a8f03..9f25e1ab 100644 --- a/src/modules/[chain]/uptime/index.vue +++ b/src/modules/[chain]/uptime/index.vue @@ -16,23 +16,14 @@ import type { SigningInfo } from '@/types/slashing'; const props = defineProps(['chain']); const stakingStore = useStakingStore(); +const format = useFormatter(); const baseStore = useBaseStore(); const chainStore = useBlockchain(); -const latest = ref({} as Block); +const latest = ref(0); const commits = ref([] as Commit[]); const keyword = ref(''); const live = ref(true); -// storage local favorite validator ids -const local = ref( - JSON.parse(localStorage.getItem('uptime-validators') || '{}') as Record< - string, - string[] - > -); -const currentPined = local.value[chainStore.chainName] -const selected = ref(currentPined || []); // favorite validators on selected blockchain - const signingInfo = ref({} as Record); // filter validators by keywords @@ -44,10 +35,18 @@ const validators = computed(() => { return stakingStore.validators; }); +const list = computed(() => { + return validators.value.map(v => ({ + v, + signing: signingInfo.value[consensusPubkeyToHexAddress(v.consensus_pubkey)], + hex: toBase64(fromHex(consensusPubkeyToHexAddress(v.consensus_pubkey))) + })) +}) + onMounted(() => { live.value = true; baseStore.fetchLatest().then(b => { - latest.value = b; + latest.value = Number(b.block.header.height); commits.value.unshift(b.block.last_commit); const height = Number(b.block.header?.height || 0); if (height === 0) { @@ -82,77 +81,102 @@ onMounted(() => { const commits2 = computed(() => { const la = baseStore.recents.map(b => b.block.last_commit) const all = [...commits.value, ...la] - return all.length > 50 ? all.slice(all.length - 50): all + return all.length > 50 ? all.slice(all.length - 50) : all }) onUnmounted(() => { live.value = false; }); +const tab = ref("3") +function changeTab(v: string) { + tab.value = v +} - -watchEffect(() => { - local.value[chainStore.chainName] = selected.value; - localStorage.setItem('uptime-validators', JSON.stringify(local.value)); -}); diff --git a/src/modules/[chain]/uptime/overview.vue b/src/modules/[chain]/uptime/overview.vue new file mode 100644 index 00000000..d627f458 --- /dev/null +++ b/src/modules/[chain]/uptime/overview.vue @@ -0,0 +1,211 @@ + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 20ca2ac5..682f75e4 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -13,7 +13,9 @@ router.beforeEach((to) => { const { chain } = to.params if(chain){ const blockchain = useBlockchain() - blockchain.setCurrent(chain.toString()) + if(chain !== blockchain.chainName) { + blockchain.setCurrent(chain.toString()) + } } }) diff --git a/src/stores/useBlockchain.ts b/src/stores/useBlockchain.ts index 9e11c3c8..502c8f94 100644 --- a/src/stores/useBlockchain.ts +++ b/src/stores/useBlockchain.ts @@ -122,11 +122,16 @@ export const useBlockchain = defineStore('blockchain', { }, async randomSetupEndpoint() { - const all = this.current?.endpoints?.rest; - if (all) { - const rn = Math.random(); - const endpoint = all[Math.floor(rn * all.length)]; - await this.setRestEndpoint(endpoint); + const end = localStorage.getItem(`endpoint-${this.chainName}`) + if(end) { + this.setRestEndpoint(JSON.parse(end)) + } else { + const all = this.current?.endpoints?.rest; + if (all) { + const rn = Math.random(); + const endpoint = all[Math.floor(rn * all.length)]; + await this.setRestEndpoint(endpoint); + } } }, @@ -134,9 +139,12 @@ export const useBlockchain = defineStore('blockchain', { this.connErr = ''; this.endpoint = endpoint; this.rpc = new CosmosRestClient(endpoint.address, DEFAULT); + localStorage.setItem(`endpoint-${this.chainName}`, JSON.stringify(endpoint)) }, setCurrent(name: string) { - this.chainName = name; + if(name !== this.chainName) { + this.chainName = name; + } }, }, });