From 240c9f9615f8d3695b3e0e69ea8dafbec3e31ac1 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 20 Sep 2024 15:52:23 +0200 Subject: [PATCH] chore: fix type check --- packages/devtools-ui-kit/src/components/NDarkToggle.vue | 2 +- .../devtools/client/components/BuildAnalyzeDetails.vue | 7 +++++-- packages/devtools/client/components/DataSchemaDrawer.vue | 4 ++-- packages/devtools/client/components/StateEditor.vue | 7 ++++--- packages/devtools/client/composables/utils.ts | 3 ++- packages/devtools/client/pages/modules/analyze-build.vue | 9 +++++++-- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/packages/devtools-ui-kit/src/components/NDarkToggle.vue b/packages/devtools-ui-kit/src/components/NDarkToggle.vue index 63f569a67..2b9086b34 100644 --- a/packages/devtools-ui-kit/src/components/NDarkToggle.vue +++ b/packages/devtools-ui-kit/src/components/NDarkToggle.vue @@ -16,6 +16,7 @@ const isDark = computed({ }) const isAppearanceTransition = typeof document !== 'undefined' +// @ts-expect-error document.startViewTransition can be undefined && document.startViewTransition && !window.matchMedia('(prefers-reduced-motion: reduce)').matches @@ -35,7 +36,6 @@ function toggle(event?: MouseEvent) { Math.max(x, innerWidth - x), Math.max(y, innerHeight - y), ) - // @ts-expect-error: Transition API const transition = document.startViewTransition(async () => { isDark.value = !isDark.value await nextTick() diff --git a/packages/devtools/client/components/BuildAnalyzeDetails.vue b/packages/devtools/client/components/BuildAnalyzeDetails.vue index 15feb3829..7e56f183e 100644 --- a/packages/devtools/client/components/BuildAnalyzeDetails.vue +++ b/packages/devtools/client/components/BuildAnalyzeDetails.vue @@ -5,7 +5,6 @@ import { formatTimeAgo } from '@vueuse/core' import { computed, ref } from 'vue' import { ensureDevAuthToken } from '~/composables/dev-auth' import { rpc } from '~/composables/rpc' -import { formatDuration } from '~/composables/utils' const props = defineProps<{ current: AnalyzeBuildMeta @@ -31,6 +30,10 @@ const tabs = computed(() => { const selectedTab = ref(tabs.value[0]) +function getDuration(build: AnalyzeBuildMeta) { + return `${((build.endTime - build.startTime) / 1000).toFixed(1)}s` +} + function formatFileSize(bytes: number) { if (bytes < 1024) return `${bytes}B` @@ -81,7 +84,7 @@ async function clear(name: string) {
Build duration
-
{{ formatDuration(current) }}
+
{{ getDuration(current) }}