From bfa57cce4445a345a53bd7e9137919342a6a9e75 Mon Sep 17 00:00:00 2001
From: Tim <135014430+nagisa77@users.noreply.github.com>
Date: Fri, 19 Sep 2025 13:44:37 +0800
Subject: [PATCH] feat: extract timeline tag item component
---
frontend_nuxt/components/TimelineTagItem.vue | 126 +++++++++++++++++++
frontend_nuxt/pages/users/[id].vue | 46 +++----
2 files changed, 142 insertions(+), 30 deletions(-)
create mode 100644 frontend_nuxt/components/TimelineTagItem.vue
diff --git a/frontend_nuxt/components/TimelineTagItem.vue b/frontend_nuxt/components/TimelineTagItem.vue
new file mode 100644
index 000000000..09406540e
--- /dev/null
+++ b/frontend_nuxt/components/TimelineTagItem.vue
@@ -0,0 +1,126 @@
+
+
+
+
+
+ {{ tag?.description }}
+
+
+
+
+ {{ tag?.name }} x{{ tag.count }}
+
+
+ {{ tag?.description }}
+
+ {{ summaryDate }}
+
+
+
+
+
+
+
diff --git a/frontend_nuxt/pages/users/[id].vue b/frontend_nuxt/pages/users/[id].vue
index 95fc1c959..aef398201 100644
--- a/frontend_nuxt/pages/users/[id].vue
+++ b/frontend_nuxt/pages/users/[id].vue
@@ -143,15 +143,7 @@
-
- {{ item.post.title }}
-
-
- {{ stripMarkdown(item.post.snippet) }}
-
-
- {{ formatDate(item.post.createdAt) }}
-
+
@@ -164,15 +156,7 @@
-
- {{ item.tag.name }} x{{ item.tag.count }}
-
-
- {{ item.tag.description }}
-
-
- {{ formatDate(item.tag.createdAt) }}
-
+
@@ -222,16 +206,7 @@
-
-
- {{ item.tag.description }}
-
+
@@ -297,6 +272,7 @@ import BaseTabs from '~/components/BaseTabs.vue'
import LevelProgress from '~/components/LevelProgress.vue'
import TimelineCommentGroup from '~/components/TimelineCommentGroup.vue'
import TimelinePostItem from '~/components/TimelinePostItem.vue'
+import TimelineTagItem from '~/components/TimelineTagItem.vue'
import UserList from '~/components/UserList.vue'
import { toast } from '~/main'
import { authState, getToken } from '~/utils/auth'
@@ -386,7 +362,12 @@ const fetchSummary = async () => {
const postsRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-posts`)
if (postsRes.ok) {
const data = await postsRes.json()
- hotPosts.value = data.map((p) => ({ icon: 'file-text', post: p }))
+ hotPosts.value = data.map((p) => ({
+ icon: 'file-text',
+ type: 'post',
+ post: p,
+ createdAt: p.createdAt,
+ }))
}
const repliesRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-replies`)
@@ -398,7 +379,12 @@ const fetchSummary = async () => {
const tagsRes = await fetch(`${API_BASE_URL}/api/users/${username}/hot-tags`)
if (tagsRes.ok) {
const data = await tagsRes.json()
- hotTags.value = data.map((t) => ({ icon: 'tag-one', tag: t }))
+ hotTags.value = data.map((t) => ({
+ icon: 'tag-one',
+ type: 'tag',
+ tag: t,
+ createdAt: t.createdAt,
+ }))
}
}