Files
lensflix/lib/cards.ts
T
2026-06-10 18:30:46 +02:00

59 lines
1.4 KiB
TypeScript

export const CARD_TYPES = [
"rating_explained",
"skip_guide",
"sensitivity_guide",
"international_ratings",
"production_facts",
"historical_accuracy",
] as const;
export type CardType = (typeof CARD_TYPES)[number];
export interface CardMeta {
title: string;
subtitle: string;
badge?: string;
}
export const CARD_META: Record<CardType, CardMeta> = {
rating_explained: {
title: "Rating Explained",
subtitle: "Why this film has its age rating",
},
skip_guide: {
title: "Skip Guide",
subtitle: "Scenes you can skip for a younger audience",
badge: "Families",
},
sensitivity_guide: {
title: "Sensitivity Guide",
subtitle: "Content warnings by theme",
},
international_ratings: {
title: "International Ratings",
subtitle: "How ratings differ by country",
},
production_facts: {
title: "Production Facts",
subtitle: "Behind-the-scenes facts",
},
historical_accuracy: {
title: "Historical Accuracy",
subtitle: "Fact vs fiction breakdown",
},
};
const HISTORICAL_GENRES = new Set([
"history",
"war",
"biography",
"documentary",
]);
export function shouldShowHistoricalAccuracy(genres: string[]): boolean {
return genres.some((genre) => HISTORICAL_GENRES.has(genre.toLowerCase()));
}
export function isCardType(value: string): value is CardType {
return CARD_TYPES.includes(value as CardType);
}