Skip to content

Commit 611a3a4

Browse files
committed
clean up the homepage
1 parent 0537775 commit 611a3a4

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

AGENTS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Ghostty Website
22

3-
- Lint all code with `npm run lint` and fix all issues including warnings
3+
## Basics
4+
45
- Verify all changes with `npm run build`
6+
- Lint all code with `npm run lint` and fix all issues including warnings
57
- The site should be fully static, no server-side rendering, functions, etc.
8+
9+
## Code Style
10+
11+
- All functions and top-level constants should be documented with comments
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import GridContainer from "@/components/grid-container";
55
import { ButtonLink } from "@/components/link";
66
import { P } from "@/components/text";
77
import type { TerminalFontSize } from "@/components/terminal";
8-
import type { TerminalsMap } from "@/lib/fetch-terminal-content";
8+
import type { TerminalsMap } from "./terminal-data";
99
import { useEffect, useState } from "react";
10-
import s from "./Home.module.css";
10+
import s from "./home-content.module.css";
1111

1212
interface HomeClientProps {
1313
terminalData: TerminalsMap;
1414
}
1515

16+
/** Tracks the current viewport size for responsive terminal sizing. */
1617
function useWindowSize() {
1718
const [width, setWidth] = useState(0);
1819
const [height, setHeight] = useState(0);
@@ -23,11 +24,13 @@ function useWindowSize() {
2324
}
2425
window.addEventListener("resize", updateSize);
2526
updateSize();
27+
2628
return () => window.removeEventListener("resize", updateSize);
2729
}, []);
2830
return [width, height];
2931
}
3032

33+
/** Renders the animated terminal hero and action links for the homepage. */
3134
export default function HomeClient({ terminalData }: HomeClientProps) {
3235
const animationFrames = Object.keys(terminalData)
3336
.filter((k) => {

src/app/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { loadAllTerminalFiles } from "@/lib/fetch-terminal-content";
1+
import HomeContent from "./HomeContent";
2+
import { loadAllTerminalFiles } from "./terminal-data";
23
import type { Metadata } from "next";
3-
import HomeClient from "./home-client";
4-
5-
export const dynamic = "force-static";
64

5+
/** Defines document metadata for the Ghostty homepage. */
76
export const metadata: Metadata = {
87
title: "Ghostty",
98
description:
109
"Ghostty is a fast, feature-rich, and cross-platform terminal emulator that uses platform-native UI and GPU acceleration.",
1110
};
1211

12+
/** Loads homepage terminal data and renders the client-side home content. */
1313
export default async function HomePage() {
1414
const terminalData = await loadAllTerminalFiles("/home");
15-
return <HomeClient terminalData={terminalData} />;
15+
return <HomeContent terminalData={terminalData} />;
1616
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import { promises as fs } from "node:fs";
2+
3+
/** Provides POSIX and path utilities for terminal file traversal. */
24
const nodePath = require("node:path");
35

6+
/** Filesystem location for checked-in terminal snapshot data. */
47
const TERMINALS_DIRECTORY = "./terminals";
8+
9+
/** Extension used by terminal snapshot files. */
510
const TERMINAL_CONTENT_FILE_EXTENSION = ".txt";
611

712
export type TerminalsMap = { [k: string]: string[] };
813

14+
/** Loads terminal text files and returns them keyed by slug path. */
915
export async function loadAllTerminalFiles(
1016
subdirectory?: string,
1117
): Promise<TerminalsMap> {
@@ -29,6 +35,7 @@ export async function loadAllTerminalFiles(
2935
return Object.fromEntries(map);
3036
}
3137

38+
/** Walks a directory recursively and returns full file paths. */
3239
async function collectAllFilesRecursively(root: string): Promise<string[]> {
3340
const files: string[] = [];
3441
const entries = await fs.readdir(root, { withFileTypes: true });

0 commit comments

Comments
 (0)