|
| 1 | +# c4Lab Website — AI Agent Guide |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +Static SPA built with Vite + React 19 + TypeScript + Tailwind CSS. |
| 6 | +All content lives in TypeScript data files under `src/data/mock/`. No database, no CMS, no API calls. |
| 7 | +Routing uses react-router-dom v7 with BrowserRouter (SPA — all paths serve index.html). |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +- `npm run dev` — dev server at http://localhost:5173 (hot reload) |
| 12 | +- `npm run build` — production build to `dist/` |
| 13 | +- `npm test` — run Vitest tests |
| 14 | +- `npm run preview` — preview production build locally |
| 15 | + |
| 16 | +## Project Structure |
| 17 | + |
| 18 | +``` |
| 19 | +src/data/mock/ ← ALL website content (edit these to update content) |
| 20 | + site.ts ← nav links, footer contact info, tagline |
| 21 | + home.ts ← hero, project highlights, timeline entries |
| 22 | + research.ts ← research tracks and details |
| 23 | + publications.ts ← year-grouped publication list |
| 24 | + members.ts ← professor profile, current members, alumni |
| 25 | + blog.ts ← blog post cards (link to external articles) |
| 26 | + galaxy.ts ← Galaxy cluster instructions and support contacts |
| 27 | +src/app/ ← page components and routing (App.tsx) |
| 28 | +src/components/ ← shared UI components |
| 29 | +src/types/ ← TypeScript type definitions |
| 30 | +public/images/ ← static images (copied as-is to build output) |
| 31 | + blog/ ← blog cover images (blog-NN-description.ext) |
| 32 | + timeline/ ← timeline thumbnails (YYYY-description.ext) |
| 33 | +``` |
| 34 | + |
| 35 | +## Content Editing Recipes |
| 36 | + |
| 37 | +### Add a new member |
| 38 | + |
| 39 | +Edit `src/data/mock/members.ts`. Find the last `id` in `memberRecords` to determine the next number. |
| 40 | + |
| 41 | +- Insert in the **current members** section (before the `// ── Alumni` comment) |
| 42 | +- Keep current members sorted by enrollment year descending (newest first) |
| 43 | + |
| 44 | +```ts |
| 45 | +// in memberRecords array, among current members: |
| 46 | +{ |
| 47 | + id: "member-51", // increment from last id |
| 48 | + name: "Full Name", |
| 49 | + role: "生機所 碩士", // degree/program, e.g. "生機系 學士", "GSB 博士" |
| 50 | + yearLabel: "2026 ~", // enrollment year + " ~" |
| 51 | + focus: "", // research focus (currently unused, leave blank) |
| 52 | + status: "current" |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +### Graduate a member (current → alumni) |
| 57 | + |
| 58 | +Edit `src/data/mock/members.ts`. Find the member and change: |
| 59 | + |
| 60 | +```ts |
| 61 | +status: "alumni", // was "current" |
| 62 | +yearLabel: "2022 - 2026" // was "2022 ~", add graduation year |
| 63 | +``` |
| 64 | + |
| 65 | +Then move the entry to the **alumni section** (after the `// ── Alumni` comment), sorted by graduation year descending. |
| 66 | + |
| 67 | +### Add a publication |
| 68 | + |
| 69 | +Edit `src/data/mock/publications.ts`. Find the correct year group in `publicationGroups`, or add a new one at the top if it's a new year. |
| 70 | + |
| 71 | +Find the last `id` across all groups to determine the next number. |
| 72 | + |
| 73 | +```ts |
| 74 | +{ |
| 75 | + id: "pub_076", // increment from last id |
| 76 | + year: "2026", // must match parent group's year |
| 77 | + dateLabel: "15 Mar 2026", // human-readable date |
| 78 | + title: "Full Paper Title", |
| 79 | + venue: "Journal or Conference Name", |
| 80 | + authors: "Author A, Author B, Chien-Yu Chen*", |
| 81 | + href: "https://doi.org/10.xxxx/xxxxx" // link to paper |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +If adding a new year group: |
| 86 | + |
| 87 | +```ts |
| 88 | +// Add at the TOP of publicationGroups array |
| 89 | +{ |
| 90 | + year: "2026", |
| 91 | + items: [ |
| 92 | + // ... publication items |
| 93 | + ] |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +### Add a blog post card |
| 98 | + |
| 99 | +1. Place cover image in `public/images/blog/` (naming: `blog-NN-description.ext`) |
| 100 | +2. Edit `src/data/mock/blog.ts`, append to `blogPosts`: |
| 101 | + |
| 102 | +```ts |
| 103 | +{ |
| 104 | + id: "blog-18", |
| 105 | + title: "文章標題", |
| 106 | + author: "Author Name", |
| 107 | + summary: "一兩句摘要...", |
| 108 | + imageUrl: "/images/blog/blog-18-topic.png", |
| 109 | + sourceHost: "Medium", |
| 110 | + href: "https://medium.com/...", |
| 111 | + ctaLabel: "Read on Medium" |
| 112 | +} |
| 113 | +``` |
| 114 | + |
| 115 | +### Add a timeline entry |
| 116 | + |
| 117 | +1. Place thumbnail in `public/images/timeline/` (naming: `YYYY-description.ext`) |
| 118 | +2. Edit `src/data/mock/home.ts`, add to `timelineEntries`: |
| 119 | + |
| 120 | +```ts |
| 121 | +{ |
| 122 | + id: "story-2026-01", |
| 123 | + year: "2026", |
| 124 | + dateLabel: "Mar 01", |
| 125 | + title: "Event Title", |
| 126 | + href: "https://...", // optional |
| 127 | + image: "/images/timeline/2026-event-name.jpg" // optional |
| 128 | +} |
| 129 | +``` |
| 130 | + |
| 131 | +### Add a project highlight card |
| 132 | + |
| 133 | +Edit `src/data/mock/home.ts`, append to `projectHighlights`: |
| 134 | + |
| 135 | +```ts |
| 136 | +{ |
| 137 | + id: "project-slug", |
| 138 | + title: "Project Name", |
| 139 | + blurb: "One-sentence description", |
| 140 | + href: "https://...", |
| 141 | + tag: "Open Source" // badge label |
| 142 | +} |
| 143 | +``` |
| 144 | + |
| 145 | +### Update contact info |
| 146 | + |
| 147 | +Edit `src/data/mock/site.ts`, modify `siteContact`: |
| 148 | + |
| 149 | +```ts |
| 150 | +{ |
| 151 | + phone: "+886-2-3366-7118", |
| 152 | + email: "chienyuchen@ntu.edu.tw", |
| 153 | + contactPerson: "陳倩瑜 Prof. Chen, Chien-Yu", |
| 154 | + addressLines: ["R304 ...", "..., National Taiwan University"] |
| 155 | +} |
| 156 | +``` |
| 157 | + |
| 158 | +### Update navigation links |
| 159 | + |
| 160 | +Edit `src/data/mock/site.ts`, modify `primaryNav` or `utilityNav` arrays. |
| 161 | + |
| 162 | +### Update research tracks |
| 163 | + |
| 164 | +Edit `src/data/mock/research.ts`, modify or append to `researchTracks`. |
| 165 | + |
| 166 | +### Update Galaxy page |
| 167 | + |
| 168 | +Edit `src/data/mock/galaxy.ts`, modify `galaxySections` or `galaxySupport`. |
| 169 | + |
| 170 | +## Important Conventions |
| 171 | + |
| 172 | +- All data file imports use types from `src/types/content.ts` — check the type definitions if unsure about field names |
| 173 | +- Image paths in data files use `/images/...` (relative to `public/`) |
| 174 | +- Member IDs follow `member-N`, publication IDs follow `pub_NNN`, blog IDs follow `blog-N` |
| 175 | +- Current members are sorted by enrollment year descending; alumni by graduation year descending |
| 176 | +- Publications are grouped by year, newest year group first, newest paper first within each group |
| 177 | +- Always run `npm test` after content changes to verify nothing breaks |
| 178 | +- Always run `npm run build` to verify the production build succeeds before pushing |
0 commit comments