diff --git a/src/components/common/PostCard.tsx b/src/components/common/PostCard.tsx
index defbc833..ad7f681b 100644
--- a/src/components/common/PostCard.tsx
+++ b/src/components/common/PostCard.tsx
@@ -181,16 +181,23 @@ const Card = ({
{post.stat?.viewDetailCount}
)}
-
-
-
- {post.metadata?.content?.readingTime} {t("min")}
+ {post.stat?.commentsCount ? (
+
+
+ {post.stat.commentsCount}
-
+ ) : (
+
+
+
+ {post.metadata?.content?.readingTime} {t("min")}
+
+
+ )}
>
)}
diff --git a/src/lib/expand-unit.ts b/src/lib/expand-unit.ts
index 16516104..14c667f5 100644
--- a/src/lib/expand-unit.ts
+++ b/src/lib/expand-unit.ts
@@ -112,6 +112,8 @@ export const expandCrossbellNote = async ({
)
).json()
expandedNote.stat = stat
+ } else if ((expandedNote as any)._count?.fromNotes) {
+ expandedNote.stat.commentsCount = (expandedNote as any)._count.fromNotes
}
}
diff --git a/src/lib/types.ts b/src/lib/types.ts
index ab8599b9..20daf5fc 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -103,6 +103,7 @@ export type ExpandedNote = NoteEntity & {
viewDetailCount?: number
hotScore?: number
portfolio?: PortfolioStats
+ commentsCount?: number
}
local?: boolean
}
diff --git a/src/models/home.model.ts b/src/models/home.model.ts
index cf5dc979..fc7e4aec 100644
--- a/src/models/home.model.ts
+++ b/src/models/home.model.ts
@@ -538,6 +538,9 @@ export async function getFeed({
stat {
viewDetailCount
}
+ _count {
+ fromNotes
+ }
${resultFields}
}
}
@@ -567,6 +570,7 @@ export async function getFeed({
const expand = await expandCrossbellNote({
note: page,
useHTML,
+ useStat: true,
})
return expand
},
@@ -655,6 +659,9 @@ export async function getFeed({
stat {
viewDetailCount
}
+ _count {
+ fromNotes
+ }
${resultFields}
}
}
@@ -683,6 +690,7 @@ export async function getFeed({
const expand = await expandCrossbellNote({
note: page,
useHTML,
+ useStat: true,
})
return expand
},
diff --git a/src/models/page.model.ts b/src/models/page.model.ts
index bbf0a811..e1af5a45 100644
--- a/src/models/page.model.ts
+++ b/src/models/page.model.ts
@@ -285,6 +285,9 @@ export async function getPagesBySite(input: {
stat {
viewDetailCount
}
+ _count {
+ fromNotes
+ }
`
: ""
}