Skip to content

Commit f1506c2

Browse files
committed
add domain label map
1 parent e6780b3 commit f1506c2

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/lib/domains.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Display labels for the project `domains` enum (defined in src/content.config.ts).
2+
// Shared so the gallery filter (projects.astro) and the detail page ([slug].astro)
3+
// show the same human-readable labels instead of the raw kebab-case values.
4+
// Keep these keys in sync with the enum in the schema.
5+
export const DOMAIN_LABELS = {
6+
web: 'Web',
7+
mobile: 'Mobile',
8+
'ai-ml': 'AI / ML',
9+
cybersecurity: 'Cybersecurity',
10+
'game-dev': 'Game Dev',
11+
hardware: 'Hardware',
12+
systems: 'Systems',
13+
infrastructure: 'Infrastructure',
14+
} as const;

src/pages/projects/[slug].astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
import { getCollection, render } from 'astro:content';
1212
import Base from '../../layouts/Base.astro';
13+
import { DOMAIN_LABELS } from '../../lib/domains';
1314
1415
export async function getStaticPaths() {
1516
const projects = await getCollection('projects');
@@ -37,7 +38,9 @@ const { Content } = await render(entry);
3738
<div class="flex flex-wrap items-baseline justify-between gap-2">
3839
<h1 class="text-3xl font-bold tracking-tight">{data.title}</h1>
3940
<span class="text-muted text-sm"
40-
>{data.domains.join(', ')} · {data.year}</span
41+
>{data.domains.map((d) => DOMAIN_LABELS[d]).join(', ')} · {
42+
data.year
43+
}</span
4144
>
4245
</div>
4346
<p class="text-muted text-lg">{data.description}</p>

0 commit comments

Comments
 (0)