feat: 开发时钟连线

This commit is contained in:
R524809
2026-07-29 16:41:29 +08:00
parent 37586b7bf2
commit 2ffd0b302d
15 changed files with 780 additions and 14 deletions
@@ -0,0 +1,54 @@
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<string, ClockConnectWorksheetRow>;
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',
};
}