1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-19 08:15:28 -04:00

Enhance notes page with comment counts and display. Update data fetching to include comment counts alongside views, and integrate comment count badges in both the notes listing and individual post pages.

This commit is contained in:
2025-09-07 16:26:45 -04:00
parent 5917811229
commit 2fa9b73f8d
8 changed files with 414 additions and 311 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
import { NextResponse } from "next/server";
import { unstable_cache as cache } from "next/cache";
import { getViews as _getViews } from "@/lib/views";
import { getViewCounts as _getViewCounts } from "@/lib/views";
const getViews = cache(_getViews, undefined, {
const getViewCounts = cache(_getViewCounts, undefined, {
revalidate: 300, // 5 minutes
tags: ["hits"],
});
@@ -19,7 +19,7 @@ export const GET = async (): Promise<
}>
> => {
// note: while hits have been renamed to views in most places, this API shouldn't change due to it being snapshotted
const views = await getViews();
const views = await getViewCounts();
const total = {
hits: Object.values(views).reduce((acc, curr) => acc + curr, 0),