feat: Add i18n support, new content block types, course export, and lesson interaction tracking.

This commit is contained in:
2026-01-17 02:19:39 -03:00
parent b166387a48
commit 05faa20993
50 changed files with 3368 additions and 388 deletions
+36 -2
View File
@@ -32,8 +32,8 @@ export interface QuizQuestion {
export interface Block {
id: string;
type: 'description' | 'media' | 'quiz' | 'fill-in-the-blanks' | 'matching' | 'ordering' | 'short-answer';
title?: string;
type: 'description' | 'media' | 'quiz' | 'fill-in-the-blanks' | 'matching' | 'ordering' | 'short-answer' | 'code' | 'hotspot' | 'memory-match' | 'document';
title: string;
content?: string;
url?: string;
media_type?: 'video' | 'audio';
@@ -45,6 +45,9 @@ export interface Block {
items?: string[];
prompt?: string;
correctAnswers?: string[];
instructions?: string;
initialCode?: string;
metadata?: any;
}
export interface Lesson {
@@ -104,6 +107,16 @@ export interface User {
language?: string;
}
export interface Notification {
id: string;
title: string;
message: string;
notification_type: string;
is_read: boolean;
link_url?: string;
created_at: string;
}
export interface AuthResponse {
user: User;
token: string;
@@ -242,5 +255,26 @@ export const lmsApi = {
},
body: formData
}).then(res => res.json());
},
async recordInteraction(lessonId: string, payload: { video_timestamp?: number, event_type: string, metadata?: any }): Promise<void> {
return apiFetch(`/lessons/${lessonId}/interactions`, {
method: 'POST',
body: JSON.stringify(payload)
});
},
async getHeatmap(lessonId: string): Promise<{ second: number, count: number }[]> {
return apiFetch(`/lessons/${lessonId}/heatmap`);
},
async getNotifications(): Promise<Notification[]> {
return apiFetch('/notifications');
},
async markNotificationAsRead(id: string): Promise<void> {
return apiFetch(`/notifications/${id}/read`, {
method: 'POST'
});
}
};