@@ -75,25 +75,26 @@ const isRefetching = ref(false)
7575const proposals = ref ([])
7676const count = ref (1 )
7777
78- const getProposalsCount = async () => {
79- const { data: proposalsCount } = await fetchProposalsCount ()
80- count .value = proposalsCount .value
81- }
78+ // const getProposalsCount = async () => {
79+ // const { data: proposalsCount } = await fetchProposalsCount()
80+ // count.value = proposalsCount.value
81+ // }
8282
8383// await getProposalsCount()
8484
8585const page = ref (route .query .page ? parseInt (route .query .page ) : 1 )
86- const pages = computed (() => Math .ceil (count .value / 20 ))
86+ const pages = computed (() => Math .ceil (count .value / limit))
87+ const limit = 20
8788
88- const { data } = await fetchProposals ({ limit: 20 , offset: (page .value - 1 ) * 20 })
89+ const { data } = await fetchProposals ({ limit: limit , offset: (page .value - 1 ) * limit })
8990proposals .value = data .value .filter ((proposal ) => proposal .status !== " removed" )
9091
9192watch (
9293 () => page .value ,
9394 async () => {
9495 isRefetching .value = true
9596
96- const { data } = await fetchProposals ({ limit: 20 , offset: (page .value - 1 ) * 20 })
97+ const { data } = await fetchProposals ({ limit: limit , offset: (page .value - 1 ) * limit })
9798 proposals .value = data .value
9899
99100 isRefetching .value = false
@@ -103,13 +104,13 @@ watch(
103104)
104105
105106const handlePrev = () => {
106- // if (page.value === 1) return
107- // page.value -= 1
107+ if (page .value === 1 ) return
108+ page .value -= 1
108109}
109110
110111const handleNext = () => {
111112 // if (page.value === pages.value) return
112- // page.value += 1
113+ page .value += 1
113114}
114115
115116const handleLast = async () => {
@@ -136,23 +137,26 @@ const handleLast = async () => {
136137 </Flex >
137138
138139 <Flex align =" center" gap =" 6" >
139- <Button @click =" page = 1" type =" secondary" size =" mini" disabled >
140+ <Button @click =" page = 1" type =" secondary" size =" mini" : disabled= " page === 1 " >
140141 <Icon name =" arrow-left-stop" size =" 12" color =" primary" />
141142 </Button >
142- <Button type =" secondary" @click =" handlePrev" size =" mini" disabled >
143+ <Button type =" secondary" @click =" handlePrev" size =" mini" : disabled= " page === 1 " >
143144 <Icon name =" arrow-left" size =" 12" color =" primary" />
144145 </Button >
145146
146- <Button type =" secondary" size =" mini" disabled >
147+ <!-- < Button type="secondary" size="mini" disabled>
147148 <Text size="12" weight="600" color="primary"> {{ comma(page) }} of {{ comma(pages) }} </Text>
149+ </Button> -->
150+ <Button type =" secondary" size =" mini" disabled >
151+ <Text size =" 12" weight =" 600" color =" primary" > Page {{ comma(page) }} </Text >
148152 </Button >
149153
150- <Button @click =" handleNext" type =" secondary" size =" mini" disabled >
154+ <Button @click =" handleNext" type =" secondary" size =" mini" : disabled= " proposals.length < limit " >
151155 <Icon name =" arrow-right" size =" 12" color =" primary" />
152156 </Button >
153- <Button @click =" handleLast" type =" secondary" size =" mini" disabled >
157+ <!-- < Button @click="handleLast" type="secondary" size="mini" disabled>
154158 <Icon name="arrow-right-stop" size="12" color="primary" />
155- </Button >
159+ </Button> -->
156160 </Flex >
157161 </Flex >
158162
@@ -292,14 +296,14 @@ const handleLast = async () => {
292296 </Flex >
293297 </NuxtLink >
294298 </td >
295- <td >
299+ <td v-if = " proposal.end_time " >
296300 <NuxtLink :to =" `/proposal/${proposal.id}`" >
297301 <Flex justify =" center" direction =" column" gap =" 4" >
298302 <Text size =" 12" weight =" 600" color =" primary" >
299- {{ DateTime.fromISO(proposal.deposit_time ).toRelative({ locale: "en", style: "short" }) }}
303+ {{ DateTime.fromISO(proposal.end_time ).toRelative({ locale: "en", style: "short" }) }}
300304 </Text >
301305 <Text size =" 12" weight =" 500" color =" tertiary" >
302- {{ DateTime.fromISO(proposal.deposit_time ).setLocale("en").toFormat("LLL d, t") }}
306+ {{ DateTime.fromISO(proposal.end_time ).setLocale("en").toFormat("LLL d, t") }}
303307 </Text >
304308 </Flex >
305309 </NuxtLink >
0 commit comments