Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: humanize with detail tooltip (#3690)

Liu Ji8bdc4ff80442
diff --git a/frontend/src/components/Issue/IssueActivityPanel.vue b/frontend/src/components/Issue/IssueActivityPanel.vue
index 9cf16e6c7b..b822ceed1b 100644
--- a/frontend/src/components/Issue/IssueActivityPanel.vue
+++ b/frontend/src/components/Issue/IssueActivityPanel.vue
@@ -141,8 +141,11 @@
:activity="item.activity"
/>
- {{ humanizeTs(item.activity.createdTs) }}
- <template
+ <HumanizeTs
+ :ts="item.activity.createdTs"
+ class="ml-1"
+ />
+ <span
v-if="
item.activity.createdTs !=
item.activity.updatedTs &&
@@ -150,8 +153,11 @@
"
>
({{ $t("common.edited") }}
- {{ humanizeTs(item.activity.updatedTs) }})
- </template>
+ <HumanizeTs
+ :ts="item.activity.updatedTs"
+ class="ml-1"
+ />)
+ </span>
</a>
<span
v-if="item.similar.length > 0"
@@ -330,6 +336,7 @@ import {
} from "vue";
import { useRoute } from "vue-router";
import PrincipalAvatar from "../PrincipalAvatar.vue";
+import HumanizeTs from "../misc/HumanizeTs.vue";
import type {
Issue,
Activity,
diff --git a/frontend/src/components/misc/HumanizeTs.vue b/frontend/src/components/misc/HumanizeTs.vue
new file mode 100644
index 0000000000..86a0b1a45b
--- /dev/null
+++ b/frontend/src/components/misc/HumanizeTs.vue
@@ -0,0 +1,32 @@
+<template>
+ <NTooltip trigger="hover">
+ <template #trigger>
+ <span v-bind="$attrs">{{ humanized }}</span>
+ </template>
+
+ <span class="whitespace-nowrap">{{ detail }}</span>
+ </NTooltip>
+</template>
+
+<script lang="ts" setup>
+import { computed } from "vue";
+import dayjs from "dayjs";
+import { NTooltip } from "naive-ui";
+
+import { humanizeTs } from "@/utils";
+
+const props = defineProps({
+ ts: {
+ type: Number,
+ required: true,
+ },
+ format: {
+ type: String,
+ default: "YYYY-MM-DD HH:mm:ss UTCZZ",
+ },
+});
+
+const humanized = computed(() => humanizeTs(props.ts));
+
+const detail = computed(() => dayjs(props.ts * 1000).format(props.format));
+</script>