"use server"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { readTemplates, writeTemplates, syncTemplatesToExport, } from "yt-dlp-transcript-common/lib/chartsStore"; import type { Dashboard } from "yt-dlp-transcript-common/lib/chartConfig"; // Persist the authored default dashboard. Keeps the gallery as-is and mirrors // the result into the served export dir so the static viewer picks it up. export async function saveDefaultDashboardAction( siteId: string, dashboard: Dashboard, ): Promise<{ ok: true }> { const paths = getPaths(); const templates = readTemplates(paths, siteId); writeTemplates(paths, siteId, { ...templates, defaultDashboard: dashboard }); syncTemplatesToExport(paths, siteId); return { ok: true }; }