Skip to content

Commit 29814d8

Browse files
committed
Some ref
1 parent ee3f214 commit 29814d8

4 files changed

Lines changed: 205 additions & 61 deletions

File tree

components/modules/upgrade/SignalsTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const props = defineProps({
3737
<tr v-for="s in signals">
3838
<td>
3939
<NuxtLink :to="`/validator/${s.validator.id}`">
40-
<Flex align="center" gap="4" wide>
40+
<Flex align="center" wide>
4141
<Text size="13" weight="600" color="primary" mono style="text-overflow: ellipsis; overflow: hidden;">
4242
{{ s.validator.moniker ? s.validator.moniker : shortHex(s.validator.cons_address) }}
4343
</Text>

components/modules/upgrade/UpgradeOverview.vue

Lines changed: 117 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ const signals = ref([])
5252
const totalStake = computed(() => (props.upgrade?.voting_power && props.upgrade?.voting_power !== "0") ? props.upgrade.voting_power : appStore.lastHead?.total_voting_power)
5353
const votingShare = computed(() => parseFloat(props.upgrade.voted_power) * 100 / parseFloat(totalStake.value))
5454
55-
const page = ref(route.query.page && isValidQueryParam(route.query.page) ? parseInt(route.query.page) : 1)
5655
const limit = 10
57-
const handleNextCondition = ref(true)
56+
const page = ref(route.query.page && isValidQueryParam(route.query.page) ? parseInt(route.query.page) : 1)
57+
const pages = computed(() => Math.ceil(props.upgrade?.signals_count / limit))
5858
5959
const handleNext = () => {
60-
if (!handleNextCondition.value) return
60+
if (page.value === pages.value) return
6161
6262
page.value += 1
6363
}
@@ -79,8 +79,6 @@ const getSignals = async () => {
7979
signals.value = data.value
8080
cacheStore.current.signals = signals.value
8181
82-
handleNextCondition.value = signals.value?.length === limit
83-
8482
isRefetching.value = false
8583
}
8684
@@ -96,14 +94,14 @@ const handleViewRawSignals = () => {
9694
/** Initital fetch */
9795
if (activeTab.value?.toLowerCase() === "signals") await getSignals()
9896
99-
onMounted(() => {
100-
router.replace({
101-
query: {
102-
tab: activeTab.value?.toLowerCase(),
103-
page: page.value,
104-
},
105-
})
106-
})
97+
watch(
98+
() => route.query,
99+
() => {
100+
if (route.query.page && isValidQueryParam(route.query.page)) {
101+
page.value = parseInt(route.query.page)
102+
}
103+
},
104+
)
107105
108106
watch(
109107
() => page.value,
@@ -113,6 +111,15 @@ watch(
113111
router.replace({ query: { page: page.value } })
114112
},
115113
)
114+
115+
onMounted(() => {
116+
router.replace({
117+
query: {
118+
tab: activeTab.value?.toLowerCase(),
119+
page: page.value,
120+
},
121+
})
122+
})
116123
</script>
117124
118125
<template>
@@ -236,7 +243,21 @@ watch(
236243
</Flex>
237244
238245
<Flex align="center" justify="between">
239-
<Text size="12" weight="600" color="tertiary">Total Stake</Text>
246+
<Flex align="center" gap="6">
247+
<Text size="12" weight="600" color="tertiary">Total Stake</Text>
248+
249+
<Tooltip>
250+
<Icon
251+
name="warning"
252+
size="12"
253+
color="tertiary"
254+
/>
255+
256+
<template #content>
257+
{{ upgrade.end_height ? "At the time of the upgrade." : "The current value of the total stake." }}
258+
</template>
259+
</Tooltip>
260+
</Flex>
240261
<AmountInCurrency :amount="{ value: totalStake, unit: 'TIA' }" />
241262
</Flex>
242263
<Flex align="center" justify="between">
@@ -256,7 +277,21 @@ watch(
256277
</Flex>
257278
258279
<Flex align="center" justify="between">
259-
<Text size="12" weight="600" color="tertiary">Initial Block</Text>
280+
<Flex align="center" gap="6">
281+
<Text size="12" weight="600" color="tertiary">Initial Block</Text>
282+
283+
<Tooltip>
284+
<Icon
285+
name="warning"
286+
size="12"
287+
color="tertiary"
288+
/>
289+
290+
<template #content>
291+
When the first signal was sent.
292+
</template>
293+
</Tooltip>
294+
</Flex>
260295
261296
<NuxtLink :to="`/block/${upgrade.height}`" target="_blank">
262297
<Flex align="center" gap="6">
@@ -267,7 +302,21 @@ watch(
267302
</Flex>
268303
269304
<Flex align="center" justify="between">
270-
<Text size="12" weight="600" color="tertiary">Initial Time</Text>
305+
<Flex align="center" gap="6">
306+
<Text size="12" weight="600" color="tertiary">Initial Time</Text>
307+
308+
<Tooltip>
309+
<Icon
310+
name="warning"
311+
size="12"
312+
color="tertiary"
313+
/>
314+
315+
<template #content>
316+
When the first signal was sent.
317+
</template>
318+
</Tooltip>
319+
</Flex>
271320
272321
<Flex gap="6">
273322
<Text size="12" weight="600" color="secondary">
@@ -280,7 +329,21 @@ watch(
280329
</Flex>
281330
282331
<Flex v-if="upgrade.end_height" align="center" justify="between">
283-
<Text size="12" weight="600" color="tertiary">End Block</Text>
332+
<Flex align="center" gap="6">
333+
<Text size="12" weight="600" color="tertiary">End Block</Text>
334+
335+
<Tooltip>
336+
<Icon
337+
name="warning"
338+
size="12"
339+
color="tertiary"
340+
/>
341+
342+
<template #content>
343+
When a successful TryUpgrade transaction was sent.
344+
</template>
345+
</Tooltip>
346+
</Flex>
284347
285348
<NuxtLink :to="`/block/${upgrade.end_height}`" target="_blank">
286349
<Flex align="center" gap="6">
@@ -291,7 +354,21 @@ watch(
291354
</Flex>
292355
293356
<Flex v-if="upgrade.end_time" align="center" justify="between">
294-
<Text size="12" weight="600" color="tertiary">End Time</Text>
357+
<Flex align="center" gap="6">
358+
<Text size="12" weight="600" color="tertiary">End Time</Text>
359+
360+
<Tooltip>
361+
<Icon
362+
name="warning"
363+
size="12"
364+
color="tertiary"
365+
/>
366+
367+
<template #content>
368+
When a successful TryUpgrade transaction was sent.
369+
</template>
370+
</Tooltip>
371+
</Flex>
295372
296373
<Flex gap="6">
297374
<Text size="12" weight="600" color="secondary">
@@ -304,7 +381,23 @@ watch(
304381
</Flex>
305382
306383
<Flex v-if="upgrade.signer" align="center" justify="between">
307-
<Text size="12" weight="600" color="tertiary">Tx Signer</Text>
384+
<Flex align="center" gap="6">
385+
<Text size="12" weight="600" color="tertiary">Tx Signer</Text>
386+
387+
<Tooltip>
388+
<Icon
389+
name="warning"
390+
size="12"
391+
color="tertiary"
392+
/>
393+
394+
<template #content>
395+
Address that sent a successful TryUpgrade transaction.
396+
</template>
397+
</Tooltip>
398+
</Flex>
399+
400+
308401
<Flex gap="6">
309402
<AddressBadge :account="upgrade.signer" color="tertiary" />
310403
<CopyButton :text="upgrade.signer.hash" />
@@ -352,12 +445,15 @@ watch(
352445
</Button>
353446
354447
<Button type="secondary" size="mini" disabled>
355-
<Text size="12" weight="600" color="primary">Page {{ page }}</Text>
448+
<Text size="12" weight="600" color="primary"> {{ page }} of {{ pages }} </Text>
356449
</Button>
357450
358-
<Button @click="handleNext" type="secondary" size="mini" :disabled="!handleNextCondition">
451+
<Button @click="handleNext" type="secondary" size="mini" :disabled="page === pages">
359452
<Icon name="arrow-right" size="12" color="primary" />
360453
</Button>
454+
<Button @click="page = pages" type="secondary" size="mini" :disabled="page === pages">
455+
<Icon name="arrow-right-stop" size="12" color="primary" />
456+
</Button>
361457
</Flex>
362458
</Flex>
363459
</Flex>

0 commit comments

Comments
 (0)