@@ -42,44 +42,57 @@ const props = defineProps({
4242 },
4343})
4444
45+ const router = useRouter ()
46+
4547/** Filter by vote option */
4648const optionFilter = ref ()
49+ const cachedOptionFilter = ref ()
4750
4851const hasActiveFilters = computed (() => !! optionFilter .value )
4952
5053const isOptionPopoverOpen = ref (false )
5154const handleOpenOptionPopover = () => {
5255 isOptionPopoverOpen .value = true
56+
57+ cachedOptionFilter .value = optionFilter .value
5358}
5459const onOptionPopoverClose = () => {
5560 isOptionPopoverOpen .value = false
5661
57- optionFilter .value = null
62+ optionFilter .value = cachedOptionFilter . value
5863}
5964const handleApplyOptionFilters = () => {
6065 isOptionPopoverOpen .value = false
6166
6267 emit (" updateFilters" , " option" , optionFilter .value , true )
6368}
6469const handleResetOptionFilter = () => {
70+ isOptionPopoverOpen .value = false
71+
6572 emit (" onFiltersReset" , " option" , true )
6673 optionFilter .value = null
6774}
6875
6976/** Pagination */
70- const totalPages = computed (() => Math .ceil (optionFilter .value ? props .proposal [optionFilter .value ] / 10 : props .votesTotal / 10 ))
7177const handlePrevPage = () => {
7278 if (props .page === 1 ) return
7379 emit (" onPrevPage" )
7480}
7581
7682const isNextPageDisabled = computed (() => {
77- return totalPages . value === props .page || ! totalPages . value
83+ return ! props .votes . length || props . votes . length !== 10
7884})
7985const handleNextPage = () => {
8086 if (isNextPageDisabled .value ) return
8187 emit (" onNextPage" )
8288}
89+
90+ watch (
91+ () => props .filters .option ,
92+ () => {
93+ if (! props .filters .option ) optionFilter .value = null
94+ },
95+ )
8396 </script >
8497
8598<template >
@@ -119,9 +132,9 @@ const handleNextPage = () => {
119132 </Flex >
120133
121134 <Flex gap =" 8" >
122- <Button @click =" handleApplyOptionFilters" type =" secondary" size =" mini" wide :disabled =" !optionFilter"
123- > Apply</ Button
124- >
135+ <Button @click =" handleApplyOptionFilters" type =" secondary" size =" mini" wide :disabled =" !optionFilter" >
136+ Apply
137+ </ Button >
125138 <Button v-if =" optionFilter" @click =" handleResetOptionFilter" type =" tertiary" size =" mini" wide >Reset</Button >
126139 </Flex >
127140 </Flex >
@@ -135,8 +148,8 @@ const handleNextPage = () => {
135148 <tr >
136149 <th ><Text size =" 12" weight =" 600" color =" tertiary" >Option</Text ></th >
137150 <th ><Text size =" 12" weight =" 600" color =" tertiary" >Voter</Text ></th >
151+ <th ><Text size =" 12" weight =" 600" color =" tertiary" >Height</Text ></th >
138152 <th ><Text size =" 12" weight =" 600" color =" tertiary" >Time</Text ></th >
139- <th ><Text size =" 12" weight =" 600" color =" tertiary" >Validator</Text ></th >
140153 </tr >
141154 </thead >
142155
@@ -150,7 +163,7 @@ const handleNextPage = () => {
150163 </Text >
151164 </Flex >
152165 </td >
153- <td >
166+ <td v-if = " !vote.validator " >
154167 <NuxtLink :to =" `/address/${vote.voter.hash}`" >
155168 <Flex align =" center" >
156169 <Text size =" 13" weight =" 600" color =" primary" class =" table_column_alias" >
@@ -159,6 +172,29 @@ const handleNextPage = () => {
159172 </Flex >
160173 </NuxtLink >
161174 </td >
175+ <td v-else >
176+ <Flex v-if =" vote.validator" align =" center" >
177+ <Tooltip delay =" 500" >
178+ <Text size =" 13" height =" 120" weight =" 600" color =" primary" >
179+ {{ vote.validator.moniker }}
180+ </Text >
181+
182+ <template #content > {{ space(vote.validator.cons_address) }} </template >
183+ </Tooltip >
184+ </Flex >
185+ <Text v-else size =" 12" weight =" 600" color =" support" >No Validator</Text >
186+ </td >
187+ <td >
188+ <Flex align =" center" :class =" $style.link" >
189+ <Outline @click.prevent =" router.push(`/block/${vote.height}`)" >
190+ <Flex align =" center" gap =" 6" >
191+ <Icon name =" block" size =" 14" color =" secondary" />
192+
193+ <Text size =" 13" weight =" 600" color =" primary" tabular >{{ comma(vote.height) }}</Text >
194+ </Flex >
195+ </Outline >
196+ </Flex >
197+ </td >
162198 <td >
163199 <Flex justify =" center" direction =" column" gap =" 4" >
164200 <Text size =" 12" weight =" 600" color =" primary" >
@@ -169,40 +205,6 @@ const handleNextPage = () => {
169205 </Text >
170206 </Flex >
171207 </td >
172- <td >
173- <Flex v-if =" vote.validator" align =" center" >
174- <Tooltip delay =" 500" >
175- <template #default >
176- <Flex direction =" column" gap =" 4" >
177- <Text size =" 12" height =" 120" weight =" 600" color =" primary" >
178- {{ vote.validator.moniker }}
179- </Text >
180-
181- <Flex align =" center" gap =" 6" >
182- <Text size =" 12" weight =" 600" color =" tertiary" mono >
183- {{ vote.validator.cons_address.slice(0, 4) }}
184- </Text >
185- <Flex align =" center" gap =" 3" >
186- <div v-for =" dot in 3" class =" dot" />
187- </Flex >
188- <Text size =" 12" weight =" 600" color =" tertiary" mono >
189- {{
190- vote.validator.cons_address.slice(
191- vote.validator.cons_address.length - 4,
192- vote.validator.cons_address.length,
193- )
194- }}
195- </Text >
196- <CopyButton :text =" vote.validator.cons_address" size =" 10" />
197- </Flex >
198- </Flex >
199- </template >
200-
201- <template #content > {{ space(vote.validator.cons_address) }} </template >
202- </Tooltip >
203- </Flex >
204- <Text v-else size =" 12" weight =" 600" color =" support" >No Validator</Text >
205- </td >
206208 </tr >
207209 </tbody >
208210 </table >
@@ -230,9 +232,7 @@ const handleNextPage = () => {
230232 </Button >
231233
232234 <Button type =" secondary" size =" mini" disabled >
233- <Text size =" 12" weight =" 600" color =" primary" >
234- Page {{ comma(page) }} <template v-if =" totalPages " >of {{ comma(totalPages) }}</template >
235- </Text >
235+ <Text size =" 12" weight =" 600" color =" primary" > Page {{ comma(page) }} </Text >
236236 </Button >
237237
238238 <Button @click =" handleNextPage" type =" secondary" size =" mini" :disabled =" isNextPageDisabled" >
0 commit comments