diff --git a/src/components/common/PostCard.tsx b/src/components/common/PostCard.tsx index a03ff0ed..b2dc40f4 100644 --- a/src/components/common/PostCard.tsx +++ b/src/components/common/PostCard.tsx @@ -30,6 +30,7 @@ const Card = ({ linkPrefix, isBlank, showPublishTime, + isShort, }: { character?: CharacterEntity post: ExpandedNote @@ -40,6 +41,7 @@ const Card = ({ linkPrefix?: string isBlank?: boolean showPublishTime?: boolean + isShort?: boolean }) => { const router = useRouter() const { t } = useTranslation("common") @@ -54,6 +56,7 @@ const Card = ({ const platform = Object.values(PlatformsSyncMap).find( (p) => p.portfolioDomain && externalLink?.startsWith(p.portfolioDomain), ) + console.log(post.stat) return ( -
-
+
+
{comment && (
{comment}
)} - {!!post.metadata?.content.images?.length && ( -

- {post.metadata?.content?.title} -

- )} + {!!post.metadata?.content.images?.length && + post.metadata?.content?.title && ( +

+ {post.metadata?.content?.title} +

+ )} {!comment && (
)} - {!!post.stat?.viewDetailCount && ( + {isShort && !!post.stat?.viewCount && ( + + + + + )} + {!isShort && !!post.stat?.viewDetailCount && ( @@ -283,6 +308,7 @@ const Post = ({ linkPrefix, isBlank, showPublishTime, + isShort, }: { post: ExpandedNote keyword?: string @@ -290,6 +316,7 @@ const Post = ({ linkPrefix?: string isBlank?: boolean showPublishTime?: boolean + isShort?: boolean }) => { let isComment if (post.metadata?.content?.tags?.includes("comment") && post.toNote) { @@ -307,6 +334,7 @@ const Post = ({ linkPrefix={linkPrefix} isBlank={isBlank} showPublishTime={showPublishTime} + isShort={isShort} /> ) } diff --git a/src/components/site/PostList.tsx b/src/components/site/PostList.tsx index 0952f603..caec8c21 100644 --- a/src/components/site/PostList.tsx +++ b/src/components/site/PostList.tsx @@ -7,11 +7,13 @@ import { Button } from "~/components/ui/Button" import { EmptyState } from "~/components/ui/EmptyState" import { useTranslation } from "~/lib/i18n/client" import { ExpandedNote } from "~/lib/types" +import { cn } from "~/lib/utils" export default function PostList({ posts, pinnedNoteId, keyword, + isShorts, }: { posts: UseInfiniteQueryResult< { @@ -23,6 +25,7 @@ export default function PostList({ > pinnedNoteId?: number | null keyword?: string + isShorts?: boolean }) { const { t } = useTranslation("site") @@ -34,7 +37,12 @@ export default function PostList({ <> {!posts.data.pages[0].count && } {!!posts.data.pages[0].count && ( -
+
{posts.data.pages.map((posts, listIndex) => posts.list.map((post, postIndex) => { currentLength++ @@ -45,6 +53,7 @@ export default function PostList({ isPinned={post.noteId === pinnedNoteId} keyword={keyword} showPublishTime={true} + isShort={isShorts} /> ) }), diff --git a/src/components/site/SiteHome.tsx b/src/components/site/SiteHome.tsx index 39927163..14b5b95c 100644 --- a/src/components/site/SiteHome.tsx +++ b/src/components/site/SiteHome.tsx @@ -26,7 +26,11 @@ export default function SiteHome({ return ( <> - + ) } diff --git a/src/lib/types.ts b/src/lib/types.ts index 28561a84..9f909019 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -101,6 +101,7 @@ export type ExpandedNote = NoteEntity & { } stat?: { viewDetailCount?: number + viewCount?: number hotScore?: number portfolio?: PortfolioStats commentsCount?: number diff --git a/src/models/page.model.ts b/src/models/page.model.ts index 5d12b23b..2c5bb265 100644 --- a/src/models/page.model.ts +++ b/src/models/page.model.ts @@ -237,6 +237,7 @@ export async function getPagesBySite(input: { ? ` stat { viewDetailCount + viewCount } _count { fromNotes