From f851bcd6462f7b2ce196b3c1f43c199524f2bdd1 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 5 Nov 2025 23:42:10 +0800 Subject: [PATCH] :lipstick: Optimize attachment list --- app/components/AttachmentList.vue | 197 ++++++++++++++++++++++++++++ app/components/PostItem.vue | 22 ++-- app/components/PostReactionList.vue | 45 +++---- app/pages/accounts/[name].vue | 71 ++++------ app/pages/posts/[id].vue | 24 +--- 5 files changed, 256 insertions(+), 103 deletions(-) create mode 100644 app/components/AttachmentList.vue diff --git a/app/components/AttachmentList.vue b/app/components/AttachmentList.vue new file mode 100644 index 0000000..edae593 --- /dev/null +++ b/app/components/AttachmentList.vue @@ -0,0 +1,197 @@ + + + diff --git a/app/components/PostItem.vue b/app/components/PostItem.vue index c64b7a5..7fc1b54 100644 --- a/app/components/PostItem.vue +++ b/app/components/PostItem.vue @@ -20,16 +20,11 @@
-
- + + +
+ +

Post truncated, tap to see details...

@@ -53,7 +48,7 @@ import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor" import type { SnPost } from "~/types/api" import PostHeader from "./PostHeader.vue" -import AttachmentItem from "./AttachmentItem.vue" +import AttachmentList from "./AttachmentList.vue" import PostReactionList from "./PostReactionList.vue" const props = defineProps<{ item: SnPost }>() @@ -66,14 +61,13 @@ const { render } = useMarkdownProcessor() const htmlContent = ref("") function handleReaction(symbol: string, attitude: number, delta: number) { - emit('react', symbol, attitude, delta) + emit("react", symbol, attitude, delta) } watch( props.item, (value) => { - if (value.content) - htmlContent.value = render(value.content) + if (value.content) htmlContent.value = render(value.content) }, { immediate: true, deep: true } ) diff --git a/app/components/PostReactionList.vue b/app/components/PostReactionList.vue index de9590d..8331952 100644 --- a/app/components/PostReactionList.vue +++ b/app/components/PostReactionList.vue @@ -9,14 +9,14 @@ @click="showReactionDialog" > mdi-plus - React + React
mdi-emoticon-happy - Positive + Positive
{{ reaction.emoji }} - {{ + {{ reaction.symbol }} x{{ getReactionCount(reaction.symbol) }} @@ -70,7 +70,7 @@
mdi-emoticon-neutral - Neutral + Neutral
{{ reaction.emoji }} - {{ + {{ reaction.symbol }} x{{ getReactionCount(reaction.symbol) }} @@ -102,7 +102,7 @@
mdi-emoticon-sad - Negative + Negative
{{ reaction.emoji }} - {{ + {{ reaction.symbol }} x{{ getReactionCount(reaction.symbol) }} @@ -135,7 +135,7 @@