// Client-safe tutorial types and helpers (lib/tutorials.ts reads the filesystem) import type { TrackSlug } from "@/lib/tracks"; export type Level = "Beginner" | "Intermediate" | "Advanced"; export type TutorialMeta = { slug: string; track: TrackSlug; title: string; description: string; level: Level; minutes: number; publishedAt: string; // Set when a published tutorial is revised (front matter `updatedAt`); shown as "Updated" and sent as dateModified updatedAt?: string; video?: string; // The video's original publish time as ISO 8601 with a time zone (front matter `videoUploadedAt`); sent as uploadDate videoUploadedAt?: string; // True only when the matching WebVTT caption track is published alongside the video. videoCaptions?: boolean; // Shows a "Video coming soon" box where the video will go, until `video` is set videoComingSoon?: boolean; draft: boolean; // Cover image path: the tutorial's own cover if one was rendered, else its track's (see scripts/covers) cover: string; }; // The date a tutorial last changed: its update date if it has one, else its publish date export function lastModified(t: Pick): string { return t.updatedAt || t.publishedAt; } // Saved tutorials are stored in the database by this key export function tutorialKey(t: Pick): string { return `${t.track}/${t.slug}`; }