File size: 1,413 Bytes
65d68f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | import { apiGet } from "@/lib/api/client";
export type DashboardMaterials = {
total: number;
ready: number;
processing: number;
needs_review: number;
};
export type DashboardSource = {
id: string;
title: string;
subject: string;
status: "ready";
material_type?: string | null;
source_type?: string | null;
};
export type DashboardResult = {
id: string;
label: string;
source_title: string;
created_at: string | null;
};
export type DashboardStudyFocus = {
exam: string | null;
subject: string | null;
time_left: string | null;
goal: string | null;
weak_areas: string[];
};
export type DashboardVideoLessons = {
total: number;
ready: number;
in_progress: number;
};
export type DashboardRecommendedAction = {
kind: "upload" | "wait" | "revise" | "generate" | "practice";
label: string;
};
export type StudentDashboard = {
materials: DashboardMaterials;
recent_source: DashboardSource | null;
recent_results: DashboardResult[];
study_focus: DashboardStudyFocus;
video_lessons: DashboardVideoLessons;
recommended_action: DashboardRecommendedAction;
};
/** Fetch the aggregated student dashboard snapshot. User-scoped. */
export async function getStudentDashboard(options?: {
signal?: AbortSignal;
}): Promise<StudentDashboard> {
return apiGet<StudentDashboard>("/dashboard/student", {
signal: options?.signal,
timeoutMs: 15000,
});
}
|