From ce2d9c4aa837b2a75acd854d371cf0576b35e87c Mon Sep 17 00:00:00 2001 From: yuetloo Date: Tue, 14 Nov 2023 00:35:26 -0500 Subject: [PATCH] add dates to round and leaderboard --- contracts/tasks/exportRound.ts | 2 ++ vue-app/src/api/round.ts | 6 ++++-- vue-app/src/api/rounds.ts | 7 +++++-- vue-app/src/components.d.ts | 1 + vue-app/src/components/DatePeriod.vue | 18 +++++++++++++++++ vue-app/src/components/RoundInformation.vue | 9 ++++++++- vue-app/src/graphql/API.ts | 3 ++- vue-app/src/graphql/queries/GetRounds.graphql | 1 + vue-app/src/locales/cn.json | 1 + vue-app/src/locales/en.json | 1 + vue-app/src/locales/es.json | 1 + vue-app/src/plugins/i18n/index.ts | 13 ++++++++++++ vue-app/src/views/Leaderboard.vue | 13 +++++++++++- vue-app/src/views/RoundList.vue | 20 +++++++++++++++++++ 14 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 vue-app/src/components/DatePeriod.vue diff --git a/contracts/tasks/exportRound.ts b/contracts/tasks/exportRound.ts index ae4993bf3..83304385b 100644 --- a/contracts/tasks/exportRound.ts +++ b/contracts/tasks/exportRound.ts @@ -23,6 +23,7 @@ type RoundListEntry = { network: string address: string startTime: number + votingDeadline: number isFinalized: boolean } @@ -378,6 +379,7 @@ task('export-round', 'Export round data for the leaderboard') network: network.name, address: round.address, startTime: round.startTime, + votingDeadline: round.endTime, isFinalized: round.isFinalized && !round.isCancelled, }) } diff --git a/vue-app/src/api/round.ts b/vue-app/src/api/round.ts index 44865c682..006a0e501 100644 --- a/vue-app/src/api/round.ts +++ b/vue-app/src/api/round.ts @@ -63,7 +63,7 @@ export async function getCurrentRound(): Promise { return isVoidedRound(fundingRoundAddress) ? null : fundingRoundAddress } -function toRoundInfo(data: any, network: string): RoundInfo { +export function toRoundInfo(data: any, network: string): RoundInfo { const nativeTokenDecimals = Number(data.nativeTokenDecimals) // leaderboard does not need coordinator key, generate a dummy number const keypair = Keypair.createFromSeed(utils.hexlify(utils.randomBytes(32))) @@ -97,7 +97,9 @@ function toRoundInfo(data: any, network: string): RoundInfo { status, startTime: DateTime.fromSeconds(data.startTime), signUpDeadline: DateTime.fromSeconds(Number(data.startTime) + Number(data.signUpDuration)), - votingDeadline: DateTime.fromSeconds(Number(data.startTime) + Number(data.votingDuration)), + votingDeadline: DateTime.fromSeconds( + Number(data.startTime) + Number(data.signUpDuration) + Number(data.votingDuration), + ), totalFunds, matchingPool, contributions, diff --git a/vue-app/src/api/rounds.ts b/vue-app/src/api/rounds.ts index 2d036752f..05f5d18c4 100644 --- a/vue-app/src/api/rounds.ts +++ b/vue-app/src/api/rounds.ts @@ -8,6 +8,7 @@ export interface Round { network?: string hasLeaderboard: boolean startTime: number + votingDeadline: number } export function isVoidedRound(address: string): boolean { @@ -29,8 +30,8 @@ export async function getRounds(): Promise { return [] } - const rounds: Round[] = extraRounds.map(({ address, network, startTime }, index): Round => { - return { index, address, network, hasLeaderboard: true, startTime } + const rounds: Round[] = extraRounds.map(({ address, network, startTime, votingDeadline }, index): Round => { + return { index, address, network, hasLeaderboard: true, startTime, votingDeadline } }) const leaderboardRounds = new Set(rounds.map(r => toRoundId({ network: r.network || '', address: r.address }))) @@ -50,6 +51,7 @@ export async function getRounds(): Promise { address, hasLeaderboard: false, startTime: Number(fundingRound.startTime), + votingDeadline: Number(fundingRound.votingDeadline), }) } } @@ -62,6 +64,7 @@ export async function getRounds(): Promise { address: r.address, hasLeaderboard: r.hasLeaderboard, startTime: r.startTime, + votingDeadline: r.votingDeadline, network: r.network, } }) diff --git a/vue-app/src/components.d.ts b/vue-app/src/components.d.ts index 7ccfb0c87..a96a5cb24 100644 --- a/vue-app/src/components.d.ts +++ b/vue-app/src/components.d.ts @@ -23,6 +23,7 @@ declare module '@vue/runtime-core' { ContributionModal: typeof import('./components/ContributionModal.vue')['default'] CopyButton: typeof import('./components/CopyButton.vue')['default'] CriteriaModal: typeof import('./components/CriteriaModal.vue')['default'] + DatePeriod: typeof import('./components/DatePeriod.vue')['default'] ErrorModal: typeof import('./components/ErrorModal.vue')['default'] FilterDropdown: typeof import('./components/FilterDropdown.vue')['default'] FormNavigation: typeof import('./components/FormNavigation.vue')['default'] diff --git a/vue-app/src/components/DatePeriod.vue b/vue-app/src/components/DatePeriod.vue new file mode 100644 index 000000000..2ad28955f --- /dev/null +++ b/vue-app/src/components/DatePeriod.vue @@ -0,0 +1,18 @@ + + + diff --git a/vue-app/src/components/RoundInformation.vue b/vue-app/src/components/RoundInformation.vue index 020980fbe..d0c9a2b16 100644 --- a/vue-app/src/components/RoundInformation.vue +++ b/vue-app/src/components/RoundInformation.vue @@ -166,6 +166,12 @@ +
+
{{ $t('roundInfo.round_period') }}
+
+ +
+
@@ -280,8 +286,9 @@