feat: show likesCount and hide viewCount for shorts
This commit is contained in:
parent
493dff4ddb
commit
070c339749
|
|
@ -216,12 +216,13 @@ const Card = ({
|
|||
<FormattedNumber value={post.stat?.viewDetailCount} />
|
||||
</span>
|
||||
)}
|
||||
{post.stat?.commentsCount ? (
|
||||
{!!post.stat?.commentsCount && (
|
||||
<span className="xlog-post-views inline-flex items-center">
|
||||
<i className="icon-[mingcute--comment-line] mr-[2px] text-base" />
|
||||
<FormattedNumber value={post.stat.commentsCount} />
|
||||
</span>
|
||||
) : (
|
||||
)}
|
||||
{!post.stat?.commentsCount && (
|
||||
<span className="xlog-post-word-count sm:inline-flex items-center hidden">
|
||||
<i className="icon-[mingcute--sandglass-line] mr-[2px] text-sm" />
|
||||
<span
|
||||
|
|
@ -274,12 +275,20 @@ const Card = ({
|
|||
<span className="text-zinc-400 hidden sm:inline-block">·</span>
|
||||
</>
|
||||
)}
|
||||
{isShort && !!post.stat?.viewCount && (
|
||||
{isShort && (
|
||||
<span className="xlog-post-meta text-zinc-400 flex items-center text-[13px] truncate space-x-2">
|
||||
<span className="xlog-post-views inline-flex items-center">
|
||||
<i className="icon-[mingcute--eye-line] mr-[2px] text-base" />
|
||||
<FormattedNumber value={post.stat?.viewCount} />
|
||||
</span>
|
||||
{!!post.stat?.likesCount && (
|
||||
<span className="xlog-post-views inline-flex items-center">
|
||||
<i className="icon-[mingcute--thumb-up-2-line] mr-[2px] text-base" />
|
||||
<FormattedNumber value={post.stat?.likesCount} />
|
||||
</span>
|
||||
)}
|
||||
{!!post.stat?.commentsCount && (
|
||||
<span className="xlog-post-views inline-flex items-center">
|
||||
<i className="icon-[mingcute--comment-line] mr-[2px] text-base" />
|
||||
<FormattedNumber value={post.stat?.commentsCount} />
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
{!isShort && (
|
||||
|
|
|
|||
|
|
@ -138,8 +138,9 @@ export const expandCrossbellNote = async ({
|
|||
)
|
||||
).json()
|
||||
expandedNote.stat = stat
|
||||
} else if ((expandedNote as any)._count?.fromNotes) {
|
||||
} else if ((expandedNote as any)._count) {
|
||||
expandedNote.stat.commentsCount = (expandedNote as any)._count.fromNotes
|
||||
expandedNote.stat.likesCount = (expandedNote as any)._count.links
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,10 +101,10 @@ export type ExpandedNote = NoteEntity & {
|
|||
}
|
||||
stat?: {
|
||||
viewDetailCount?: number
|
||||
viewCount?: number
|
||||
hotScore?: number
|
||||
portfolio?: PortfolioStats
|
||||
commentsCount?: number
|
||||
likesCount?: number
|
||||
}
|
||||
local?: boolean
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,9 +300,6 @@ export async function getFeed({
|
|||
${cursorQuery}
|
||||
) {
|
||||
${resultFields}
|
||||
stat {
|
||||
viewCount
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
|
|
|||
|
|
@ -237,10 +237,10 @@ export async function getPagesBySite(input: {
|
|||
? `
|
||||
stat {
|
||||
viewDetailCount
|
||||
viewCount
|
||||
}
|
||||
_count {
|
||||
fromNotes
|
||||
links
|
||||
}
|
||||
`
|
||||
: ""
|
||||
|
|
|
|||
Loading…
Reference in New Issue