Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

feat(learner): add personal learning progress view

XZHd824559774d5
diff --git a/web/app/(utility)/settings/progress/page.tsx b/web/app/(utility)/settings/progress/page.tsx
new file mode 100644
index 000000000..4d436aaa9
--- /dev/null
+++ b/web/app/(utility)/settings/progress/page.tsx
@@ -0,0 +1,20 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+
+import { listLearningRecords, type LearningRecord } from "@/lib/learning-records-api";
+
+function label(record: LearningRecord): string {
+ return String(record.title ?? record.material_title ?? record.material_id ?? "Learning activity");
+}
+
+export default function LearningProgressPage() {
+ const { t } = useTranslation();
+ const [records, setRecords] = useState<LearningRecord[] | null>(null);
+ const [error, setError] = useState(false);
+
+ useEffect(() => { void listLearningRecords().then(setRecords).catch(() => setError(true)); }, []);
+
+ return <main className="mx-auto max-w-3xl px-6 py-8"><h1 className="text-xl font-semibold">{t("Learning progress")}</h1><p className="mt-1 text-sm text-[var(--muted-foreground)]">{t("Review your own reading and learning activity.")}</p>{error ? <p className="mt-8 text-sm text-red-600">{t("Unable to load learning progress")}</p> : records === null ? <p className="mt-8 text-sm text-[var(--muted-foreground)]">{t("Loading progress")}</p> : records.length === 0 ? <p className="mt-8 text-sm text-[var(--muted-foreground)]">{t("No learning activity yet")}</p> : <ul className="mt-6 grid gap-3">{records.map((record, index) => <li key={String(record.event_id ?? record.id ?? index)} className="rounded-md border border-[var(--border)] p-4"><span className="font-medium">{label(record)}</span><span className="mt-1 block text-xs text-[var(--muted-foreground)]">{String(record.action ?? record.kind ?? "")}</span></li>)}</ul>}</main>;
+}
diff --git a/web/features/settings/navigation/settings-nav.ts b/web/features/settings/navigation/settings-nav.ts
index 96aa66b96..a88515138 100644
--- a/web/features/settings/navigation/settings-nav.ts
+++ b/web/features/settings/navigation/settings-nav.ts
@@ -24,6 +24,7 @@ import {
ShieldCheck,
SlidersHorizontal,
Sparkles,
+ ChartNoAxesCombined,
UserRound,
Wrench,
type LucideIcon,
@@ -471,6 +472,13 @@ export const SETTINGS_CATEGORIES: SettingsCategory[] = [
href: "/settings#agents",
children: AGENT_CHILDREN,
},
+ {
+ key: "progress",
+ label: { zh: "学习进度", en: "Learning progress" },
+ blurb: { zh: "查看自己的阅读与学习记录。", en: "Review your reading and learning activity." },
+ icon: ChartNoAxesCombined,
+ href: "/settings/progress",
+ },
{
key: "learner-profile",
learnerOnly: true,
diff --git a/web/lib/learning-records-api.ts b/web/lib/learning-records-api.ts
new file mode 100644
index 000000000..e86ce981b
--- /dev/null
+++ b/web/lib/learning-records-api.ts
@@ -0,0 +1,11 @@
+import { apiFetch, apiUrl } from "@/lib/api";
+
+export interface LearningRecord {
+ [key: string]: unknown;
+}
+
+export async function listLearningRecords(): Promise<LearningRecord[]> {
+ const response = await apiFetch(apiUrl("/api/v1/learning/records"));
+ if (!response.ok) throw new Error("Failed to load learning progress");
+ return response.json() as Promise<LearningRecord[]>;
+}