TypeScript
feat: add site metadata and an Open Graph image
Vipul Kumar40500a8da3f4
diff --git a/assets/og/Geist-Medium.ttf b/assets/og/Geist-Medium.ttfnew file mode 100644index 0000000..8b295edBinary files /dev/null and b/assets/og/Geist-Medium.ttf differdiff --git a/assets/og/Geist-SemiBold.ttf b/assets/og/Geist-SemiBold.ttfnew file mode 100644index 0000000..3051970Binary files /dev/null and b/assets/og/Geist-SemiBold.ttf differdiff --git a/assets/og/README.md b/assets/og/README.mdnew file mode 100644index 0000000..5130a2d--- /dev/null+++ b/assets/og/README.md@@ -0,0 +1,5 @@+Assets used to render the Open Graph image at build time (`src/app/opengraph-image.tsx`).++- `Geist-Medium.ttf`, `Geist-SemiBold.ttf` — Geist by Vercel, licensed under the SIL Open Font License 1.1.+- `app.png` — screenshot of the Time off page.+- `icon.png` — the app icon.diff --git a/assets/og/app.png b/assets/og/app.pngnew file mode 100644index 0000000..589e96fBinary files /dev/null and b/assets/og/app.png differdiff --git a/assets/og/icon.png b/assets/og/icon.pngnew file mode 100644index 0000000..3d6e98dBinary files /dev/null and b/assets/og/icon.png differdiff --git a/src/app/layout.tsx b/src/app/layout.tsxindex c569488..897c930 100644--- a/src/app/layout.tsx+++ b/src/app/layout.tsx@@ -1,4 +1,4 @@-import type { Metadata } from "next";+import type { Metadata, Viewport } from "next";import { Geist, Geist_Mono, Inter } from "next/font/google";import { AppShell } from "@/components/shell/app-shell";import { Providers } from "@/components/providers";@@ -8,9 +8,42 @@ const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"] });const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"] });const inter = Inter({ variable: "--font-inter", subsets: ["latin"], weight: ["600"] });+const SITE_URL = "https://calender-app-design.vercel.app";+const DESCRIPTION =+ "A calm people-ops workspace: plan time off, track leave requests and balances, and manage your work calendar. A Kargul Studio design prototype.";+export const metadata: Metadata = {+ metadataBase: new URL(SITE_URL),title: { default: "Time off · Kargul Workspace", template: "%s · Kargul Workspace" },- description: "Plan time off, track leave requests and manage your work calendar.",+ description: DESCRIPTION,+ applicationName: "Kargul Workspace",+ authors: [{ name: "Kargul Studio", url: "https://kargul.studio" }],+ creator: "Kargul Studio",+ publisher: "Kargul Studio",+ keywords: ["time off", "leave management", "calendar", "HR", "people ops", "design prototype", "Kargul Studio"],+ alternates: { canonical: "/" },+ openGraph: {+ type: "website",+ url: "/",+ siteName: "Kargul Calender design prototype",+ title: "Kargul Workspace — Time off & calendar",+ description: DESCRIPTION,+ locale: "en_US",+ },+ twitter: {+ card: "summary_large_image",+ title: "Kargul Workspace — Time off & calendar",+ description: DESCRIPTION,+ },+ appleWebApp: { capable: true, title: "Kargul", statusBarStyle: "default" },+ formatDetection: { telephone: false },+};++export const viewport: Viewport = {+ themeColor: [+ { media: "(prefers-color-scheme: light)", color: "#f8f8f8" },+ { media: "(prefers-color-scheme: dark)", color: "#121212" },+ ],};export default function RootLayout({ children }: LayoutProps<"/">) {diff --git a/src/app/opengraph-image.tsx b/src/app/opengraph-image.tsxnew file mode 100644index 0000000..5aaadca--- /dev/null+++ b/src/app/opengraph-image.tsx@@ -0,0 +1,88 @@+import { readFile } from "node:fs/promises";+import { join } from "node:path";+import { ImageResponse } from "next/og";++export const alt = "Kargul Workspace — time off and calendar for your team";+export const size = { width: 1200, height: 630 };+export const contentType = "image/png";++// Rendered once at build time from vendored assets (no network at build).+// Paths are literal so only assets/og is traced into the output.+const [geistMedium, geistSemiBold, screenshot, icon] = await Promise.all([+ readFile(join(process.cwd(), "assets/og/Geist-Medium.ttf")),+ readFile(join(process.cwd(), "assets/og/Geist-SemiBold.ttf")),+ readFile(join(process.cwd(), "assets/og/app.png")),+ readFile(join(process.cwd(), "assets/og/icon.png")),+]);++const dataUri = (buf: Buffer) => `data:image/png;base64,${buf.toString("base64")}`;++export default function OpengraphImage() {+ return new ImageResponse(+ (+ <div+ style={{+ width: "100%",+ height: "100%",+ display: "flex",+ flexDirection: "column",+ position: "relative",+ background: "#f8f8f8",+ fontFamily: "Geist",+ color: "#1d1d1d",+ padding: "60px 72px 0",+ overflow: "hidden",+ }}+ >+ <div style={{ display: "flex", alignItems: "center", gap: 14 }}>+ <img src={dataUri(icon)} width={44} height={44} alt="" style={{ borderRadius: 11 }} />+ <div style={{ fontSize: 26, fontWeight: 600, letterSpacing: -0.8 }}>Kargul Workspace</div>+ <div+ style={{+ marginLeft: 8,+ fontSize: 17,+ color: "#8965de",+ background: "rgba(137,101,222,0.12)",+ borderRadius: 999,+ padding: "6px 14px",+ }}+ >+ Design prototype+ </div>+ </div>++ <div style={{ marginTop: 34, fontSize: 56, fontWeight: 600, letterSpacing: -2, lineHeight: 1.05 }}>+ Time off & calendar for your team+ </div>+ <div style={{ marginTop: 16, fontSize: 26, color: "#757575", letterSpacing: -0.5 }}>+ Plan leave, track requests and balances — in one calm workspace.+ </div>++ <div+ style={{+ position: "absolute",+ left: 72,+ top: 284,+ width: 1128,+ height: 509,+ display: "flex",+ borderRadius: 18,+ overflow: "hidden",+ border: "1px solid #e5e7e1",+ boxShadow: "0 24px 64px -16px rgba(20,20,18,0.22), 0 4px 14px rgba(20,20,18,0.06)",+ background: "#ffffff",+ }}+ >+ <img src={dataUri(screenshot)} width={1128} height={509} alt="" />+ </div>+ </div>+ ),+ {+ ...size,+ fonts: [+ { name: "Geist", data: geistMedium, weight: 500, style: "normal" },+ { name: "Geist", data: geistSemiBold, weight: 600, style: "normal" },+ ],+ },+ );+}