Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"@radix-ui/react-dialog": "^1.1.15",
"@supabase/supabase-js": "^2.80.0",
"@vercel/analytics": "^1.6.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"framer-motion": "^12.23.24",
Expand Down
34 changes: 34 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ export default function CategoryWidget({ category }: Props) {

return (
<section className="flex flex-col gap-3 md:flex-row">
{/* 왼쪽: 숫자 위젯 4개 */}
<div className="grid flex-1 grid-cols-2 gap-3 md:grid-cols-4">
<StatWidget
label="Total Posts"
value={String(stats.totalPosts)}
caption="전체 누적"
/>
<StatWidget
label="New This Month"
label="This Month"
value={`+${stats.newThisMonth}`}
caption="이번 달 업데이트"
/>
Expand All @@ -52,7 +51,6 @@ export default function CategoryWidget({ category }: Props) {
/>
</div>

{/* 오른쪽: Monthly Mission */}
<div className="md:w-[260px] ">
<MissionWidget
current={stats.newThisMonth}
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Metadata } from "next";
import { ThemeProvider } from "next-themes";
import localFont from "next/font/local";
import "./globals.css";
import { Analytics } from "@vercel/analytics/react";

export const metadata: Metadata = {
title: "B-log",
Expand Down Expand Up @@ -44,6 +45,7 @@ export default function RootLayout({
>
{children}
</ThemeProvider>
<Analytics />
</body>
</html>
);
Expand Down
9 changes: 3 additions & 6 deletions src/lib/posts/stats.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { VelitePost } from "./source";
import { getAllPosts } from "./queries";
import { CategoryKey } from "@/config/categories";
import { SERIES_META_BY_CATEGORY } from "@/lib/posts/registry/series.registry";

export interface CategoryStatsParams {
category: CategoryKey;
Expand Down Expand Up @@ -67,12 +68,8 @@ export function getCategoryStats(params: CategoryStatsParams): CategoryStats {
const thisYYYYMM = toYYYYMM(now);
const newThisMonth = catPosts.filter((p) => p.date.startsWith(thisYYYYMM)).length;

const seriesSet = new Set(
catPosts
.map((p) => p.series?.trim())
.filter((s): s is string => Boolean(s))
);
const seriesCount = seriesSet.size;
const seriesMeta = SERIES_META_BY_CATEGORY[category] ?? [];
const seriesCount = seriesMeta.length;

const recentCount = catPosts.filter((p) =>
isWithinLastNDays(p.date, now, activityWindowDays)
Expand Down
Loading