Skip to content

Commit

Permalink
fix(upvote-election): added seconds section for upvote timer (#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenibir authored Mar 2, 2023
1 parent 9a54c63 commit 92d8d2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/pages/dho/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export default {
const MS_PER_DAY = 1000 * 60 * 60 * 24
const MS_PER_HOUR = 1000 * 60 * 60
const MS_PER_MIN = 1000 * 60
const MS = 1000
const timeRemaining = this.votingTimeLeft()
if (timeRemaining > 0) {
const days = Math.floor(timeRemaining / MS_PER_DAY)
Expand All @@ -334,10 +335,12 @@ export default {
lesstime = lesstime - (hours * MS_PER_HOUR)
const min = Math.floor(lesstime / MS_PER_MIN)
lesstime = lesstime - (min * MS_PER_MIN)
const sec = Math.floor(lesstime / MS)
return {
days: days,
hours: hours,
mins: min
mins: min,
sec: sec
}
}
return 0
Expand Down Expand Up @@ -378,6 +381,10 @@ q-page.page-home
.mins {{ formatTimeLeft().mins }}
.subtext(v-if="formatTimeLeft().mins > 1") mins
.subtext(v-else) min
.row.items-end
.seconds {{ formatTimeLeft().sec }}
.subtext(v-if="formatTimeLeft().sec > 1") secs
.subtext(v-else) sec
template(v-slot:buttons)
.row.justify-between
.flex.items-center()
Expand Down
9 changes: 8 additions & 1 deletion src/pages/upvote-election/UpvoteElection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export default {
const MS_PER_DAY = 1000 * 60 * 60 * 24
const MS_PER_HOUR = 1000 * 60 * 60
const MS_PER_MIN = 1000 * 60
const MS = 1000
const timeRemaining = this.votingTimeLeft()
if (timeRemaining > 0) {
const days = Math.floor(timeRemaining / MS_PER_DAY)
Expand All @@ -145,10 +146,12 @@ export default {
lesstime = lesstime - (hours * MS_PER_HOUR)
const min = Math.floor(lesstime / MS_PER_MIN)
lesstime = lesstime - (min * MS_PER_MIN)
const sec = Math.floor(lesstime / MS)
return {
days: days,
hours: hours,
mins: min
mins: min,
sec: sec
}
}
return 0
Expand Down Expand Up @@ -253,6 +256,10 @@ export default {
.mins {{ formatTimeLeft().mins }}
.subtext(v-if="formatTimeLeft().mins > 1") mins
.subtext(v-else) min
.row.items-end
.seconds {{ formatTimeLeft().sec }}
.subtext(v-if="formatTimeLeft().sec > 1") secs
.subtext(v-else) sec
template(v-if="this.$apollo.queries.upvoteElectionQuery.loading || this.$apollo.queries.upvoteElectionVotedUsers.loading")
.flex.full-width.justify-center
loading-spinner(
Expand Down

0 comments on commit 92d8d2f

Please sign in to comment.