import { IconEye, IconMessages } from "@tabler/icons-react"; import Link from "next/link"; import { Badge } from "@/components/ui/badge"; import { Skeleton } from "@/components/ui/skeleton"; import { getPostStats } from "@/lib/data/stats"; const numberFormatter = new Intl.NumberFormat(process.env.NEXT_PUBLIC_SITE_LOCALE); /** * Placeholder shown while the stats for a post are loading. */ const PostStatsSkeleton = () => ( <> ); /** * Displays view/comment badges for a single post. * Every instance shares one cached getPostStats() result. */ const PostStats = async ({ slug }: { slug: string }) => { const { views, comments } = await getPostStats(); const viewCount = views[slug] ?? 0; const commentCount = comments[slug] ?? 0; return ( <> {viewCount > 0 && ( )} {commentCount > 0 && ( } > )} ); }; export { PostStats, PostStatsSkeleton };