Moved categories to its own configuration file
This commit is contained in:
15
types/Category.ts
Normal file
15
types/Category.ts
Normal 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>;
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user