feat: show comments count in post card
This commit is contained in:
parent
4128d8fcb9
commit
6748111ed6
|
|
@ -181,16 +181,23 @@ const Card = ({
|
|||
<span>{post.stat?.viewDetailCount}</span>
|
||||
</span>
|
||||
)}
|
||||
<span className="xlog-post-word-count sm:inline-flex items-center hidden">
|
||||
<i className="icon-[mingcute--sandglass-line] mr-[2px] text-sm" />
|
||||
<span
|
||||
style={{
|
||||
wordSpacing: "-.2ch",
|
||||
}}
|
||||
>
|
||||
{post.metadata?.content?.readingTime} {t("min")}
|
||||
{post.stat?.commentsCount ? (
|
||||
<span className="xlog-post-views inline-flex items-center">
|
||||
<i className="icon-[mingcute--comment-line] mr-[2px] text-base" />
|
||||
<span>{post.stat.commentsCount}</span>
|
||||
</span>
|
||||
</span>
|
||||
) : (
|
||||
<span className="xlog-post-word-count sm:inline-flex items-center hidden">
|
||||
<i className="icon-[mingcute--sandglass-line] mr-[2px] text-sm" />
|
||||
<span
|
||||
style={{
|
||||
wordSpacing: "-.2ch",
|
||||
}}
|
||||
>
|
||||
{post.metadata?.content?.readingTime} {t("min")}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ export type ExpandedNote = NoteEntity & {
|
|||
viewDetailCount?: number
|
||||
hotScore?: number
|
||||
portfolio?: PortfolioStats
|
||||
commentsCount?: number
|
||||
}
|
||||
local?: boolean
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
},
|
||||
|
|
|
|||
|
|
@ -285,6 +285,9 @@ export async function getPagesBySite(input: {
|
|||
stat {
|
||||
viewDetailCount
|
||||
}
|
||||
_count {
|
||||
fromNotes
|
||||
}
|
||||
`
|
||||
: ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue