|
1 | | -# Gemini Code Context: `const-correctness.github.io` |
| 1 | +# Gemini Code Context: `constcorrectness.github.io` |
2 | 2 |
|
3 | 3 | This document provides context for the AI assistant to understand the structure, conventions, and purpose of this codebase. |
4 | 4 |
|
5 | 5 | ## Project Overview |
6 | 6 |
|
7 | | -This is a personal website and blog built with React, TypeScript, and Vite. It features interactive 3D elements using `three.js` and `react-three-fiber`, and hosts technical articles written in a Jupyter Book. |
| 7 | +This is a personal website and blog built with **React**, **TypeScript**, and **Vite**. It features interactive 3D elements using `three.js` and `react-three-fiber`, and technical articles written in **MDX**. |
8 | 8 |
|
9 | | -- **Frontend**: A single-page application built with React and TypeScript, styled with Material-UI. The main application logic is in `src/App.tsx`. |
10 | | -- **3D Graphics**: The site includes a 3D model viewer (`src/components/ModelViewer.tsx`) that displays a `.glb` model. |
11 | | -- **Blog Content**: The technical articles are managed in the `jupyter-books` directory. These are converted to HTML using Jupyter Book and served as part of the React application. |
| 9 | +- **Frontend**: A single-page application built with React and TypeScript, styled with Material-UI. |
| 10 | +- **Routing**: Client-side routing is handled by `react-router-dom`. |
| 11 | +- **Blog**: |
| 12 | + - Content is written in `.mdx` files in `src/content/notes/`. |
| 13 | + - Supports LaTeX math (via `rehype-katex`). |
| 14 | + - Supports executable Python code blocks in the browser (via `react-py` / WebAssembly). |
| 15 | +- **3D Graphics**: `src/components/ModelViewer.tsx` displays `.glb` models. |
12 | 16 | - **Deployment**: The site is deployed to GitHub Pages via a GitHub Actions workflow defined in `.github/workflows/deploy.yml`. |
13 | 17 |
|
14 | | -## Building and Running the Project |
| 18 | +## Architecture |
| 19 | + |
| 20 | +- **`src/main.tsx`**: Entry point, wraps the app in `BrowserRouter`. |
| 21 | +- **`src/App.tsx`**: Defines the routes (`/`, `/notes`, `/notes/:slug`). |
| 22 | +- **`src/pages/`**: Top-level page components (Home, NotesList, NoteView). |
| 23 | +- **`src/components/PythonREPL.tsx`**: A component that runs Python code in the browser using WASM. |
15 | 24 |
|
16 | | -The project uses `npm` for package management. |
| 25 | +## Building and Running the Project |
17 | 26 |
|
18 | 27 | - **Install dependencies**: |
19 | 28 | ```bash |
20 | 29 | npm install |
21 | 30 | ``` |
22 | 31 |
|
23 | 32 | - **Run the development server**: |
24 | | - Starts the Vite dev server at `http://localhost:5173`. |
25 | 33 | ```bash |
26 | 34 | npm run dev |
27 | 35 | ``` |
28 | 36 |
|
29 | 37 | - **Build for production**: |
30 | | - This command transpiles the TypeScript and builds the Vite project. |
31 | 38 | ```bash |
32 | 39 | npm run build |
33 | 40 | ``` |
34 | 41 |
|
35 | | -- **Build and serve the Jupyter Book**: |
36 | | - The Jupyter Book content needs to be built and copied to the `public` directory to be accessible by the Vite application. |
37 | | - ```bash |
38 | | - npm run build:book |
39 | | - npm run copy:book |
40 | | - ``` |
41 | | - |
42 | 42 | - **Linting**: |
43 | | - This project uses ESLint for code linting. |
44 | 43 | ```bash |
45 | 44 | npm run lint |
46 | 45 | ``` |
47 | 46 |
|
48 | 47 | ## Development Conventions |
49 | 48 |
|
50 | | -- **Styling**: The project uses Material-UI for UI components. Styling is done via the `sx` prop. |
51 | | -- **State Management**: Component-level state is managed with React hooks (`useState`). |
52 | | -- **3D Models**: 3D models are stored in the `public/models` directory. |
53 | | -- **Blog Posts**: Blog posts are written in Markdown (`.md`) or Jupyter Notebooks (`.ipynb`) in the `jupyter-books` directory. To create a new post, add a file to this directory and update the `_toc.yml` file. |
54 | | -- **Proxy**: The Vite development server is configured with proxies in `vite.config.ts` to correctly serve the Jupyter Book content. |
| 49 | +- **Styling**: Material-UI for components. Custom CSS for code highlighting and math. |
| 50 | +- **Content**: To add a new blog post, create a `.mdx` file in `src/content/notes/` and add an entry to the list in `src/pages/NotesList.tsx`. |
0 commit comments