让我重新思考复习功能的整体结构:
// 1. 核心数据类型
interface ReviewTopic {
id: string
name: string
path: string
resources: {
concepts: ReviewResource[] // 概念回顾
exercises: ReviewResource[] // 练习题
faqs: ReviewResource[] // 常见问题
mistakes: ReviewResource[] // 错题重做
}
progress?: {
lastReview: Date
mastery: 'full' | 'basic' | 'need-practice'
nextReview: Date
}
}
interface ReviewResource {
id: string
title: string
path: string
type: 'leftright' | 'qa' | 'article'
}
# 2. 文件结构
quartz/
├── components/
│ └── review/
│ ├── Review.tsx # 主复习界面
│ ├── TopicNav.tsx # 主题导航
│ ├── ResourceGrid.tsx # 资源按钮网格
│ ├── ResourceViewer.tsx # 资源内容查看器
│ └── ReviewDialog.tsx # 完成复习对话框
│
├── plugins/
│ ├── transformers/
│ │ └── ReviewPlugin.ts # 转换器插件
│ └── emitters/
│ └── ReviewResources.ts # 资源生成器
│
└── util/
└── review/
├── loader.ts # 资源加载器
├── progress.ts # 进度管理
└── scheduler.ts # 复习计划调度
# 3. 内容组织
content/
└── review/
└── math/
├── _index.md # 数学复习入口
└── topics/
├── sets/ # 集合论主题
│ ├── index.md # 主题元数据
│ ├── concepts/ # 概念回顾
│ │ ├── basic.md
│ │ └── advanced.md
│ ├── exercises/ # 练习题
│ │ ├── basic.md
│ │ └── advanced.md
│ ├── faqs.md # 常见问题
│ └── mistakes.md # 错题重做
└── functions/ # 函数主题
└── ...
// 4. 主题配置示例 (index.md)
---
type: review-topic
title: 集合论
resources:
concepts:
- title: 基础概念
path: ./concepts/basic
type: leftright
- title: 高级概念
path: ./concepts/advanced
type: leftright
exercises:
- title: 基础练习
path: ./exercises/basic
type: qa
faqs:
- title: 常见问题
path: ./faqs
type: qa
mistakes:
- title: 错题集
path: ./mistakes
type: leftright
---
// 5. 插件实现示例
export const ReviewPlugin = (): QuartzTransformerPlugin => {
return {
name: "ReviewPlugin",
// 发现并加载主题
async loadTopics() {
// 扫描主题目录
// 解析主题配置
// 构建主题数据结构
},
// 加载资源内容
async loadResource(path: string) {
// 获取资源内容
// 根据类型解析内容
// 返回处理后的内容
},
// 管理复习进度
async updateProgress(topicId: string, progress: ReviewProgress) {
// 保存复习记录
// 更新下次复习时间
// 调整复习计划
}
}
}
主要特点:
- 模块化组件设计
- 清晰的文件组织结构
- 灵活的资源类型支持
- 可扩展的进度管理
- 统一的数据流