Moved categories to its own configuration file

This commit is contained in:
2025-10-15 09:03:32 +02:00
parent 4b6e65bfbd
commit f10d8d0777
7 changed files with 231 additions and 400 deletions

15
types/Category.ts Normal file
View File

@@ -0,0 +1,15 @@
export type Category = "home" | "royal-road" | "podcasts" | "mixtapes" | "utility";
const baseCategories = [
{ key: "home", label: "Home", title: "Welcome to Home!" },
{ key: "royal-road", label: "Royal Road", title: "Royal Road Chapters" },
{ key: "podcasts", label: "Podcasts", title: "Latest Podcasts" },
{ key: "mixtapes", label: "Mixtapes", title: "New Mixtapes" },
{ key: "utility", label: "Utility", title: "Utility" },
] as const;
export const categoryKeys: Category[] = baseCategories.map(c => c.key);
export const categories: { label: string; key: Category }[] = baseCategories.map(c => ({ label: c.label, key: c.key }));
export const categoryTitles: Record<Category, string> = Object.fromEntries(baseCategories.map(c => [c.key, c.title])) as Record<Category, string>;

View File

@@ -1,6 +1,8 @@
import { Category } from "./Category";
export type Item = {
timestamp: number;
category: 'home' | 'royal-road' | 'podcasts' | 'mixtapes';
category: Category;
title: string;
info: string;
link: string;