forked from codechefPesuecc/CodeChef-PESUECC-Chapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.ts
More file actions
62 lines (53 loc) · 2.04 KB
/
Copy pathlib.ts
File metadata and controls
62 lines (53 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import teamManifest from "./team.manifest.json";
/* ------------------------------------------------------------------ */
/* Types */
/* ------------------------------------------------------------------ */
export interface MemberInfo {
/** Display name from info.json */
name: string;
/** Role / title, e.g. "Core Team — Tech Lead" */
role: string;
/** Short 1-2 line bio */
bio: string;
/** Social links — empty string means "not provided" */
linkedin: string;
github: string;
instagram: string;
/** URL-safe path to the photo relative to `/` (served from public/) */
photo: string;
}
export interface YearData {
year: string;
coordinators: MemberInfo[];
core: MemberInfo[];
members: MemberInfo[];
}
export interface TeamData {
/** Available years sorted newest-first */
years: string[];
/** Pre-loaded data for every year, keyed by year string */
byYear: Record<string, YearData>;
}
/* ------------------------------------------------------------------ */
/* Public API */
/* ------------------------------------------------------------------ */
// The roster is baked into team.manifest.json at build time by
// scripts/build-team.mjs — Cloudflare Workers can't read public/team with `fs`
// at request time (that made the page render empty in prod). Photos still load
// as static assets from the paths stored in the manifest.
const data = teamManifest as TeamData;
/** Available years, newest first. */
export function getAvailableYears(): string[] {
return data.years;
}
/** All three groups for a single year (empty groups if the year is unknown). */
export function getYearData(year: string): YearData {
return data.byYear[year] ?? { year, coordinators: [], core: [], members: [] };
}
/**
* Every year's data in one shot. Used by the server component so the client
* receives all data upfront and can switch years without fetching.
*/
export function getAllTeamData(): TeamData {
return data;
}