import type { DebugPublishMeta } from '../../utils/debugPublish'; import { inferGradeFromAge } from '../../utils/debugPublish'; import { CLOCK_CONNECT_WORKSHEET_DEFINITIONS } from '../../config/worksheets/clock'; import { CLOCK_CONNECT_TIME_MODE_OPTIONS, type ClockConnectTimeMode, } from './generators/clock-connect-generator'; export { CLOCK_CONNECT_WORKSHEET_DEFINITIONS }; export type { ClockConnectTimeMode }; type ClockConnectWorksheetRow = (typeof CLOCK_CONNECT_WORKSHEET_DEFINITIONS)[number]; const CLOCK_CONNECT_WORKSHEET_BY_ID = Object.fromEntries( CLOCK_CONNECT_WORKSHEET_DEFINITIONS.map((m) => [m.id, m]), ) as Record; export const CLOCK_CONNECT_MODE_OPTIONS = CLOCK_CONNECT_WORKSHEET_DEFINITIONS; export { CLOCK_CONNECT_TIME_MODE_OPTIONS }; export function getModeInfo(id: string) { const m = CLOCK_CONNECT_WORKSHEET_BY_ID[id]; return m ? { title: m.title, desc: m.subtitle } : undefined; } export function isValidMode(id: string): boolean { return id in CLOCK_CONNECT_WORKSHEET_BY_ID; } export function getPublishMetaByMode(id: string): DebugPublishMeta | null { const m = CLOCK_CONNECT_WORKSHEET_BY_ID[id]; if (!m) return null; return { id: m.id, title: m.title, subtitle: m.subtitle, category: 'math', subcategory: 'clock-connect', path: `/mathPages/clockConnect/clockConnect?id=${m.id}`, ageMin: m.ageMin, ageMax: m.ageMax, grade: inferGradeFromAge(m.ageMin, m.ageMax), difficulty: m.difficulty, previewImg: '', tags: [...m.tags], isNew: false, isHot: false, sortOrder: m.sortOrder, status: 'draft', }; }