From b8215b32806c7882d189795668b7bb52ea9ebc15 Mon Sep 17 00:00:00 2001 From: rohitJung Date: Tue, 5 May 2026 20:59:53 +0545 Subject: [PATCH 1/2] feat: add metadata to module pages --- .../web/src/app/(main)/sheet/[moduleId]/page.tsx | 16 ++++++++++++++++ apps/web/src/lib/utils.ts | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/apps/web/src/app/(main)/sheet/[moduleId]/page.tsx b/apps/web/src/app/(main)/sheet/[moduleId]/page.tsx index 8d1704b0..c59cbd14 100644 --- a/apps/web/src/app/(main)/sheet/[moduleId]/page.tsx +++ b/apps/web/src/app/(main)/sheet/[moduleId]/page.tsx @@ -3,11 +3,27 @@ import { getSheetModules } from "@/data/sheet"; import { SheetModuleHeader } from "@/components/sheet/SheetModuleHeader"; import { SheetContentRenderer } from "@/components/sheet/SheetContentRenderer"; import styles from "./sheet-content.module.css"; +import { Metadata } from "next"; +import { capitalizeFirstLetter } from "@/lib/utils"; interface PageProps { params: Promise<{ moduleId: string }>; } +export async function generateMetadata({ + params, +}: PageProps): Promise { + const { moduleId } = await params; + + const sheetModules = getSheetModules(); + const sheetModule = sheetModules.find((m) => m.id === moduleId); + + return { + title: `${capitalizeFirstLetter(sheetModule?.id || "Modules")}: ${sheetModule?.name || ""} `, + description: `This module describes how to ${sheetModule?.name.toLowerCase()}`, + }; +} + export default async function SheetModulePage({ params }: PageProps) { const { moduleId } = await params; const sheetModules = getSheetModules(); diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index bd0c391d..08e73978 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -4,3 +4,7 @@ import { twMerge } from "tailwind-merge" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } + +export function capitalizeFirstLetter(word: string) { + return word.charAt(0).toUpperCase() + word.slice(1); +} From 51c2f7202558099b777e3caf0d7078497db7f3f5 Mon Sep 17 00:00:00 2001 From: rohitJung Date: Tue, 5 May 2026 21:10:52 +0545 Subject: [PATCH 2/2] fix: change function to arrow function --- apps/web/src/lib/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index 08e73978..2fda5498 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -5,6 +5,6 @@ export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } -export function capitalizeFirstLetter(word: string) { +export const capitalizeFirstLetter = (word: string): string => { return word.charAt(0).toUpperCase() + word.slice(1); }