feat: exam actions and data safety fixes

This commit is contained in:
SpecialX
2025-12-30 17:48:22 +08:00
parent e7c902e8e1
commit f7ff018490
27 changed files with 896 additions and 194 deletions

View File

@@ -40,8 +40,7 @@ export function TextbookContentLayout({ chapters, knowledgePoints, textbookId }:
if (result.success) {
toast.success(result.message)
setIsEditing(false)
// Update local state to reflect change immediately (optimistic-like)
selectedChapter.content = editContent
setSelectedChapter((prev) => (prev ? { ...prev, content: editContent } : prev))
} else {
toast.error(result.message)
}

View File

@@ -61,7 +61,7 @@ export function TextbookFormDialog() {
<DialogHeader>
<DialogTitle>Add New Textbook</DialogTitle>
<DialogDescription>
Create a new digital textbook. Click save when you're done.
Create a new digital textbook. Click save when you&apos;re done.
</DialogDescription>
</DialogHeader>
<form action={handleSubmit}>

View File

@@ -65,7 +65,7 @@ let MOCK_KNOWLEDGE_POINTS: KnowledgePoint[] = [
export async function getTextbooks(query?: string, subject?: string, grade?: string): Promise<Textbook[]> {
await new Promise((resolve) => setTimeout(resolve, 500));
let results = [...MOCK_TEXTBOOKS];
const results = [...MOCK_TEXTBOOKS];
// ... (filtering logic)
return results;
}