diff --git a/src/components/BlockNumber.vue b/src/components/BlockNumber.vue index bc32872e6c14dbfcbcc0bc7982f628f7a2c9af0b..4647ad68bae1f973f9a6995ca6fc86ac6d0885f3 100644 --- a/src/components/BlockNumber.vue +++ b/src/components/BlockNumber.vue @@ -1,6 +1,6 @@ <script setup lang="ts"> import { currentBlockHeight, wipFirstBlock } from '@/global' -import { estimate_date } from '@/utils' +import { estimateDate } from '@/utils' const LIMIT = 201600 // two weeks in block number const PORTAL = 'https://duniter-portal.axiom-team.fr/#/explorer/query/' @@ -35,6 +35,6 @@ defineProps<{ <span v-else> <i title="future">{{ n }}</i> <span class="red" v-if="n - currentBlockHeight < LIMIT"> soon!</span> - <span class="gray" title="estimated date"> ({{ estimate_date(n).toDateString() }})</span> + <span class="gray" title="estimated date"> ({{ estimateDate(n).toDateString() }})</span> </span> </template> diff --git a/src/utils.ts b/src/utils.ts index 4bce048ff9d78d5350cc205982d48246e23f6560..11114dd3037707cbe7668a91295fd8ac35946250 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -46,7 +46,7 @@ export function normAmount(amount: number) { } // estimate date of future block -export function estimate_date(future_block: number): Date { +export function estimateDate(future_block: number): Date { // number of expected milliseconds in a block const MILLIS_PER_BLOCK = 6_000 // we do not actually mind if it is in the past diff --git a/src/views/IdtyItem.vue b/src/views/IdtyItem.vue index e6cb554450b695d4dffd97015ccd19740b936189..36d1be256ee5bdfa45143ce5d31c1404ffd515db 100644 --- a/src/views/IdtyItem.vue +++ b/src/views/IdtyItem.vue @@ -10,7 +10,7 @@ import { import { useRoute } from 'vue-router' import { useLazyQuery } from '@vue/apollo-composable' import { computed, inject, ref, watch, type Ref } from 'vue' -import { formatStatus } from '@/utils' +import { formatStatus, estimateDate } from '@/utils' import type { ApiPromise } from '@polkadot/api' import { addToList, getItem, remFromList, sk } from '@/storage' import IconStar from '@/icons/IconStar.vue' @@ -288,7 +288,12 @@ async function requestDistEvalFor() { <td> <template v-if="nextCertIssuableOn"> <span class="green" v-if="nextCertIssuableOn < currentBlockHeight">yes</span> - <span class="error" v-else>no</span> + <template v-else> + <span class="error">no</span> + <span class="gray"> + ({{ estimateDate(nextCertIssuableOn).toDateString() }})</span + > + </template> </template> <template v-else>unknown</template> </td>