Skip to content

Commit 02481d4

Browse files
committed
wip
1 parent 4a1a7da commit 02481d4

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import meta from "../../pages/learn/_meta"
2+
3+
type LearnPagePath = Exclude<keyof typeof meta, `-- ${string}` | "index">
4+
5+
function getTitle(path: LearnPagePath): string {
6+
const entry = meta[path as keyof typeof meta]
7+
if (typeof entry === "string") {
8+
return (
9+
entry || path.replace(/-/g, " ").replace(/\b\w/g, c => c.toUpperCase())
10+
)
11+
} else if (typeof entry === "object" && "title" in entry) {
12+
return entry.title
13+
}
14+
return path.replace(/-/g, " ").replace(/\b\w/g, c => c.toUpperCase())
15+
}
16+
17+
export const learnPages: Record<
18+
LearnPagePath,
19+
{
20+
title: string
21+
description: string
22+
icon: string
23+
section: "getting-started" | "best-practices"
24+
} | null
25+
> = {
26+
introduction: {
27+
title: getTitle("introduction"),
28+
description: "",
29+
icon: "",
30+
section: "getting-started",
31+
},
32+
schema: {
33+
title: getTitle("schema"),
34+
description: "",
35+
icon: "",
36+
section: "getting-started",
37+
},
38+
queries: {
39+
title: getTitle("queries"),
40+
description: "",
41+
icon: "",
42+
section: "getting-started",
43+
},
44+
mutations: {
45+
title: getTitle("mutations"),
46+
description: "",
47+
icon: "",
48+
section: "getting-started",
49+
},
50+
subscriptions: {
51+
title: getTitle("subscriptions"),
52+
description: "",
53+
icon: "",
54+
section: "getting-started",
55+
},
56+
validation: {
57+
title: getTitle("validation"),
58+
description: "",
59+
icon: "",
60+
section: "getting-started",
61+
},
62+
execution: {
63+
title: getTitle("execution"),
64+
description: "",
65+
icon: "",
66+
section: "getting-started",
67+
},
68+
response: {
69+
title: getTitle("response"),
70+
description: "",
71+
icon: "",
72+
section: "getting-started",
73+
},
74+
introspection: {
75+
title: getTitle("introspection"),
76+
description: "",
77+
icon: "",
78+
section: "getting-started",
79+
},
80+
// ---
81+
"best-practices": {
82+
title: getTitle("best-practices"),
83+
description: "",
84+
icon: "",
85+
section: "best-practices",
86+
},
87+
"thinking-in-graphs": {
88+
title: getTitle("thinking-in-graphs"),
89+
description: "",
90+
icon: "",
91+
section: "best-practices",
92+
},
93+
"serving-over-http": {
94+
title: getTitle("serving-over-http"),
95+
description: "",
96+
icon: "",
97+
section: "best-practices",
98+
},
99+
"file-uploads": {
100+
title: getTitle("file-uploads"),
101+
description: "",
102+
icon: "",
103+
section: "best-practices",
104+
},
105+
authorization: {
106+
title: getTitle("authorization"),
107+
description: "",
108+
icon: "",
109+
section: "best-practices",
110+
},
111+
pagination: {
112+
title: getTitle("pagination"),
113+
description: "",
114+
icon: "",
115+
section: "best-practices",
116+
},
117+
"schema-design": {
118+
title: getTitle("schema-design"),
119+
description: "",
120+
icon: "",
121+
section: "best-practices",
122+
},
123+
"global-object-identification": {
124+
title: getTitle("global-object-identification"),
125+
description: "",
126+
icon: "",
127+
section: "best-practices",
128+
},
129+
caching: {
130+
title: getTitle("caching"),
131+
description: "",
132+
icon: "",
133+
section: "best-practices",
134+
},
135+
performance: {
136+
title: getTitle("performance"),
137+
description: "",
138+
icon: "",
139+
section: "best-practices",
140+
},
141+
security: {
142+
title: getTitle("security"),
143+
description: "",
144+
icon: "",
145+
section: "best-practices",
146+
},
147+
federation: {
148+
title: getTitle("federation"),
149+
description: "",
150+
icon: "",
151+
section: "best-practices",
152+
},
153+
// ---
154+
// omitted on Learn index page
155+
"debug-errors": null,
156+
}

0 commit comments

Comments
 (0)