Align admin panel with unified LMS hierarchy

This commit is contained in:
Yared Yemane 2026-10-22 13:47:25 +03:00
parent a9ee56cfa7
commit 61c0b1c276
52 changed files with 534 additions and 891 deletions

View File

@ -31,6 +31,8 @@ import type {
UpdateModuleStatusRequest,
GetQuestionSetsResponse,
GetQuestionSetsParams,
ExamPrepAssessmentParent,
ExamPrepAssessmentLinkRequest,
GetQuestionSetDetailResponse,
GetQuestionSetQuestionsResponse,
GetPracticeQuestionsByPracticeResponse,
@ -1164,6 +1166,17 @@ export const getPracticesByModule = (moduleId: number) =>
export const getQuestionSets = (params?: GetQuestionSetsParams) =>
http.get<GetQuestionSetsResponse>("/question-sets", { params })
export const getExamPrepAssessments = (parent: ExamPrepAssessmentParent) =>
http.get<GetQuestionSetsResponse>("/exam-prep/assessments", {
params: { parent_kind: parent.kind, parent_id: parent.id },
})
export const linkExamPrepAssessment = (data: ExamPrepAssessmentLinkRequest) =>
http.post("/exam-prep/assessments", data)
export const unlinkExamPrepAssessment = (questionSetId: number, parent: ExamPrepAssessmentParent) =>
http.delete(`/exam-prep/assessments/${questionSetId}/parents/${parent.kind}/${parent.id}`)
export const getQuestionSetsByOwner = (ownerType: string, ownerId: number) =>
http.get<GetQuestionSetsResponse>("/question-sets/by-owner", {
params: {

View File

@ -14,11 +14,9 @@ import {
} from "../types/user.types";
import type {
LearningActivityAccess,
LearningActivityCompletedIds,
LearningActivityCourse,
LearningActivityLesson,
LearningActivityModule,
LearningActivityProgram,
LearningActivityUnit,
UserLearningActivityData,
UserLearningActivityResponse,
@ -152,14 +150,10 @@ function normalizeLearningActivityModule(raw: unknown): LearningActivityModule |
.filter((entry): entry is LearningActivityLesson => entry !== null)
: [];
const programId = Number(raw.program_id);
const courseId = Number(raw.course_id);
const unitId = Number(raw.unit_id);
return {
id,
program_id: Number.isFinite(programId) ? programId : undefined,
course_id: Number.isFinite(courseId) ? courseId : undefined,
unit_id: Number.isFinite(unitId) ? unitId : undefined,
name: String(raw.name ?? ""),
access: normalizeLearningActivityAccess(raw.access),
@ -208,12 +202,10 @@ function normalizeLearningActivityCourse(raw: unknown): LearningActivityCourse |
.filter((entry): entry is LearningActivityUnit => entry !== null)
: undefined;
const programId = Number(raw.program_id);
const catalogCourseId = Number(raw.catalog_course_id);
return {
id,
program_id: Number.isFinite(programId) ? programId : undefined,
catalog_course_id: Number.isFinite(catalogCourseId) ? catalogCourseId : undefined,
name: String(raw.name ?? ""),
access: normalizeLearningActivityAccess(raw.access),
@ -222,58 +214,11 @@ function normalizeLearningActivityCourse(raw: unknown): LearningActivityCourse |
};
}
function normalizeLearningActivityProgram(raw: unknown): LearningActivityProgram | null {
if (!isRecord(raw)) return null;
const id = Number(raw.id);
if (!Number.isFinite(id)) return null;
const coursesRaw = raw.courses;
const courses = Array.isArray(coursesRaw)
? coursesRaw
.map((entry) => normalizeLearningActivityCourse(entry))
.filter((entry): entry is LearningActivityCourse => entry !== null)
: [];
return {
id,
name: String(raw.name ?? ""),
access: normalizeLearningActivityAccess(raw.access),
courses,
};
}
function normalizeCompletedIds(raw: unknown): LearningActivityCompletedIds {
if (!isRecord(raw)) {
return { lesson_ids: [], module_ids: [], course_ids: [], program_ids: [] };
}
const toIds = (value: unknown) =>
Array.isArray(value)
? value.map((entry) => Number(entry)).filter((entry) => Number.isFinite(entry))
: [];
return {
lesson_ids: toIds(raw.lesson_ids),
module_ids: toIds(raw.module_ids),
course_ids: toIds(raw.course_ids),
program_ids: toIds(raw.program_ids),
};
}
export function normalizeUserLearningActivity(raw: unknown): UserLearningActivityData | null {
if (!isRecord(raw)) return null;
const userId = Number(raw.user_id);
if (!Number.isFinite(userId)) return null;
const lmsRaw = isRecord(raw.lms) ? raw.lms : {};
const lmsProgressRaw = isRecord(lmsRaw.progress) ? lmsRaw.progress : {};
const programsRaw = lmsProgressRaw.programs;
const programs = Array.isArray(programsRaw)
? programsRaw
.map((entry) => normalizeLearningActivityProgram(entry))
.filter((entry): entry is LearningActivityProgram => entry !== null)
: [];
const examPrepRaw = isRecord(raw.exam_prep) ? raw.exam_prep : {};
const examProgressRaw = isRecord(examPrepRaw.progress) ? examPrepRaw.progress : {};
const catalogCoursesRaw = examProgressRaw.catalog_courses;
@ -283,19 +228,10 @@ export function normalizeUserLearningActivity(raw: unknown): UserLearningActivit
.filter((entry): entry is LearningActivityCourse => entry !== null)
: [];
const lmsCompletionsRaw = isRecord(lmsRaw.completions) ? lmsRaw.completions : {};
const examCompletionsRaw = isRecord(examPrepRaw.completions) ? examPrepRaw.completions : {};
return {
user_id: userId,
lms: {
completed_ids: normalizeCompletedIds(lmsRaw.completed_ids),
progress: { programs },
completions: {
user_id: Number(lmsCompletionsRaw.user_id) || userId,
programs: Array.isArray(lmsCompletionsRaw.programs) ? lmsCompletionsRaw.programs : [],
},
},
exam_prep: {
progress: { catalog_courses: catalogCourses },
completions: {

View File

@ -19,12 +19,8 @@ import { AddVideoPage } from "../pages/content-management/AddVideoPage";
import { AddPracticePage } from "../pages/content-management/AddPracticePage";
import { NewContentPage } from "../pages/content-management/NewContentPage";
import { ReorderContentPage } from "../pages/content-management/ReorderContentPage";
import { LearnEnglishPage } from "../pages/content-management/LearnEnglishPage";
import { ProgramCoursesPage } from "../pages/content-management/ProgramCoursesPage";
import { CourseDetailPage } from "../pages/content-management/CourseDetailPage";
import { LessonPracticesPage } from "../pages/content-management/LessonPracticesPage";
import { ModuleDetailPage } from "../pages/content-management/ModuleDetailPage";
import { AddVideoFlow } from "../pages/content-management/AddVideoFlow";
import { LessonAssessmentsPage } from "../pages/content-management/LessonAssessmentsPage";
import { AddPracticeFlow } from "../pages/content-management/AddPracticeFlow";
import { LinkExistingPracticeFlow } from "../pages/content-management/LinkExistingPracticeFlow";
import { EditPracticeFlow } from "../pages/content-management/EditPracticeFlow";
@ -33,7 +29,6 @@ import { ProgramTypeSelectionPage } from "../pages/content-management/ProgramTyp
import { ProgramDetailPage } from "../pages/content-management/ProgramDetailPage";
import { CourseManagementPage } from "../pages/content-management/CourseManagementPage";
import { UnitManagementPage } from "../pages/content-management/UnitManagementPage";
import { InitialAssessmentPage } from "../pages/content-management/InitialAssessmentPage";
import { QuestionTypeLibraryPage } from "../pages/content-management/QuestionTypeLibraryPage";
import { CreateQuestionTypeFlow } from "../pages/content-management/CreateQuestionTypeFlow";
import { NotFoundPage } from "../pages/NotFoundPage";
@ -172,6 +167,7 @@ export function AppRoutes() {
<Route path="practices" element={<PracticeDetailsPage />} />
<Route path="practices/members" element={<PracticeMembersPage />} />
<Route path="questions" element={<QuestionsPage />} />
<Route path="question-sets/:practiceId/questions" element={<PracticeQuestionsPage />} />
<Route path="questions/add" element={<AddQuestionPage />} />
<Route path="questions/edit/:id" element={<AddQuestionPage />} />
</Route>
@ -182,13 +178,21 @@ export function AppRoutes() {
path="/new-content/courses"
element={<ProgramTypeSelectionPage />}
/>
<Route
path="/new-content/courses/proficiency"
element={<Navigate to="/new-content/courses/ielts" replace />}
/>
<Route
path="/new-content/courses/skill-based"
element={<Navigate to="/new-content/courses/education" replace />}
/>
<Route
path="/new-content/question-types"
element={<QuestionTypeLibraryPage />}
/>
<Route
path="/new-content/initial-assessment"
element={<InitialAssessmentPage />}
element={<Navigate to="/new-content/courses/education" replace />}
/>
<Route
path="/new-content/question-types/:definitionId/create-practice"
@ -266,53 +270,17 @@ export function AppRoutes() {
path="/new-content/courses/:programType/:courseId/:unitId/:moduleId/lessons/:lessonId/practices"
element={<LessonPracticesPage />}
/>
<Route
path="/new-content/courses/:programType/:courseId/:unitId/:moduleId/lessons/:lessonId/assessments"
element={<LessonAssessmentsPage />}
/>
<Route
path="/new-content/courses/:programType/:courseId/:unitId/:moduleId/lessons/:lessonId/edit-practice/:practiceId"
element={<EditPracticeFlow />}
/>
<Route
path="/new-content/learn-english"
element={<LearnEnglishPage />}
/>
<Route
path="/new-content/learn-english/:level/courses"
element={<ProgramCoursesPage />}
/>
<Route
path="/new-content/learn-english/:level/courses/:courseId"
element={<CourseDetailPage />}
/>
<Route
path="/new-content/learn-english/:level/courses/:courseId/modules/:moduleId"
element={<ModuleDetailPage />}
/>
<Route
path="/new-content/learn-english/:level/courses/:courseId/modules/:moduleId/add-video"
element={<AddVideoFlow />}
/>
<Route
path="/new-content/learn-english/:level/courses/:courseId/modules/:moduleId/lessons/:lessonId/practices"
element={<LessonPracticesPage />}
/>
<Route
path="/new-content/learn-english/:level/courses/:courseId/edit-practice/:practiceId"
element={<EditPracticeFlow />}
/>
<Route
path="/new-content/learn-english/:level/courses/:courseId/modules/:moduleId/edit-practice/:practiceId"
element={<EditPracticeFlow />}
/>
<Route
path="/new-content/learn-english/:level/courses/:courseId/modules/:moduleId/lessons/:lessonId/edit-practice/:practiceId"
element={<EditPracticeFlow />}
/>
<Route
path="/new-content/learn-english/:level/courses/add-practice"
element={<AddPracticeFlow />}
/>
<Route
path="/new-content/learn-english/:level/courses/attach-practice"
element={<LinkExistingPracticeFlow />}
path="/new-content/learn-english/*"
element={<Navigate to="/new-content/courses/education" replace />}
/>
<Route path="/personas" element={<PersonasPage />} />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 KiB

View File

@ -14,7 +14,7 @@ import {
CreditCard,
UsersRound,
} from "lucide-react"
import spinnerSrc from "../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import {
Area,
AreaChart,
@ -330,7 +330,6 @@ export function DashboardPage() {
label="Videos"
value={dashboard.courses.total_videos.toLocaleString()}
deltaLabel={getVideoLessonsSummary(
dashboard.courses.lms?.lessons_with_video,
dashboard.courses.exam_prep?.lessons_with_video,
)}
deltaPositive={dashboard.courses.total_videos > 0}

View File

@ -1,5 +1,6 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useEffect, useState, type ElementType, type ReactNode } from "react"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import {
Area,
AreaChart,
@ -407,7 +408,6 @@ export function AnalyticsPage() {
const { users, subscriptions, payments, courses, content, notifications, team, videos } = dashboard
const subscriptionMetrics = getSubscriptionMetrics(subscriptions)
const seriesPeriodLabel = getSeriesPeriodLabel(dashboard.date_filter)
const lms = courses.lms
const examPrep = courses.exam_prep
const registrationData = users.registrations_last_30_days.map((d) => ({
@ -485,7 +485,7 @@ export function AnalyticsPage() {
</span>
<AnalyticsTimeRangeFilter value={filters} onChange={setFilters} />
<Button variant="outline" size="sm" onClick={() => fetchData(filters)} disabled={loading}>
<RefreshCw className={cn("mr-2 h-3.5 w-3.5", loading && "animate-spin")} />
{loading ? <SpinnerIcon className="mr-2 h-3.5 w-3.5" /> : <RefreshCw className="mr-2 h-3.5 w-3.5" />}
Refresh
</Button>
</div>
@ -909,16 +909,16 @@ export function AnalyticsPage() {
/>
<KpiCard
icon={BookOpen}
label="LMS Programs"
value={(lms?.programs ?? 0).toLocaleString()}
sub={`${lms?.courses ?? 0} courses · ${lms?.practices ?? 0} practices`}
label="Catalog courses"
value={(examPrep?.catalog_courses ?? 0).toLocaleString()}
sub={`${examPrep?.units ?? 0} units · ${examPrep?.lesson_practices ?? 0} practices`}
trend="neutral"
/>
<KpiCard
icon={Video}
label="Videos"
value={courses.total_videos.toLocaleString()}
sub={getVideoLessonsSummary(lms?.lessons_with_video, examPrep?.lessons_with_video)}
sub={getVideoLessonsSummary(examPrep?.lessons_with_video)}
trend={courses.total_videos > 0 ? "up" : "neutral"}
/>
<KpiCard
@ -931,28 +931,12 @@ export function AnalyticsPage() {
</div>
{/* ─── Course Management ─── */}
{(lms || examPrep) && (
{examPrep && (
<Section title="Course Management" icon={BookOpen} count={courses.total_videos} defaultOpen>
<div className="grid items-start gap-4 lg:grid-cols-2">
{lms && (
<BreakdownList
title="LMS"
data={[
{ label: "Programs", count: lms.programs },
{ label: "Courses", count: lms.courses },
{ label: "Modules", count: lms.modules },
{ label: "Lessons", count: lms.lessons },
{ label: "Lessons with video", count: lms.lessons_with_video },
{ label: "Practices", count: lms.practices },
{ label: "Practices at course", count: lms.practices_at_course },
{ label: "Practices at module", count: lms.practices_at_module },
{ label: "Practices at lesson", count: lms.practices_at_lesson },
]}
/>
)}
{examPrep && (
<BreakdownList
title="Duolingo/IELTS"
title="Exam prep catalog"
data={[
{ label: "Catalog courses", count: examPrep.catalog_courses },
{ label: "Units", count: examPrep.units },

View File

@ -1,18 +1,8 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../lib/apiErrors"
import { useMemo, useRef, useState, type ChangeEvent } from "react";
import { Link, useLocation, useParams, useNavigate } from "react-router-dom";
import {
ArrowLeft,
ArrowRight,
ChevronDown,
Grid3X3,
Check,
Plus,
Trash2,
GripVertical,
Loader2,
Upload,
} from "lucide-react";
import { ArrowLeft, ArrowRight, ChevronDown, Grid3X3, Check, Plus, Trash2, GripVertical, Upload } from "lucide-react";
import { toast } from "sonner";
import { Card } from "../../components/ui/card";
import { Button } from "../../components/ui/button";
@ -608,7 +598,7 @@ export function AddNewPracticePage() {
className="gap-1.5"
>
{uploadingIntroVideo ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : (
<Upload className="h-4 w-4" />
)}
@ -629,7 +619,7 @@ export function AddNewPracticePage() {
>
{importingIntroVideoUrl ? (
<>
<Loader2 className="mr-1.5 h-4 w-4 animate-spin" />
<SpinnerIcon className="mr-1.5 h-4 w-4" />
Importing URL…
</>
) : (

View File

@ -32,7 +32,7 @@ import { toast } from "sonner"
import { countActiveFilters } from "../../lib/adminFilterUtils"
import { cn } from "../../lib/utils"
import { TABLE_PAGE_SIZE_OPTIONS } from "../../lib/tablePagination"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import { PageBackLink } from "../../components/navigation/PageBackLink"
import { SearchHighlight } from "../../components/SearchHighlight"

View File

@ -2,7 +2,7 @@ import { notifyApiError } from "../../lib/apiErrors"
import { useEffect, useState } from "react"
import { Link } from "react-router-dom"
import { FolderOpen, RefreshCw, BookOpen, Plus, Trash2 } from "lucide-react"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import alertSrc from "../../assets/Alert.svg"
import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card"
import { Button } from "../../components/ui/button"

View File

@ -25,7 +25,7 @@ import {
import { Input } from "../../components/ui/input";
import { Textarea } from "../../components/ui/textarea";
import { cn } from "../../lib/utils";
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg";
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png";
import alertSrc from "../../assets/Alert.svg";
import {
deleteTopLevelCourseModule,

View File

@ -18,6 +18,7 @@ import { Button } from "../../components/ui/button";
import { Card } from "../../components/ui/card";
import { PracticeActionButton } from "./components/PracticeActionButton";
import { CatalogCoursePracticesPanel } from "./components/CatalogCoursePracticesPanel";
import { ExamPrepAssessmentsPanel } from "./components/ExamPrepAssessmentsPanel";
import { cn } from "../../lib/utils";
import {
Dialog,
@ -118,7 +119,7 @@ export function CourseManagementPage() {
>(null);
const [catalogCoursePublishStatusUpdating, setCatalogCoursePublishStatusUpdating] =
useState(false);
const [activeTab, setActiveTab] = useState<"units" | "practices">("units");
const [activeTab, setActiveTab] = useState<"units" | "practices" | "assessments">("units");
const catalogCoursePracticePathOptions = useMemo(
() => ({
@ -740,6 +741,13 @@ export function CourseManagementPage() {
>
Practices
</button>
<button
type="button"
onClick={() => setActiveTab("assessments")}
className={cn("pb-4 text-[16px] font-medium transition-all relative", activeTab === "assessments" ? "text-brand-500 after:absolute after:bottom-0 after:left-0 after:right-0 after:h-[3px] after:bg-brand-500 after:rounded-t-full" : "text-grayScale-400 hover:text-grayScale-600")}
>
Assessment exams
</button>
</div>
</div>
@ -760,7 +768,9 @@ export function CourseManagementPage() {
{/* Grid of Units / Practices */}
<div className="space-y-4 pt-4">
{activeTab === "practices" ? (
{activeTab === "assessments" ? (
<ExamPrepAssessmentsPanel parent={{ kind: "CATALOG_COURSE", id: catalogCourseId }} />
) : activeTab === "practices" ? (
<CatalogCoursePracticesPanel
catalogCourseId={catalogCourseId}
programType={programType ?? "proficiency"}

View File

@ -24,6 +24,7 @@ import uploadIcon from "../../assets/icons/upload.png";
import { toast } from "sonner";
import { ResolvedImage } from "../../components/media/ResolvedImage";
import { VideoCard } from "./components/VideoCard";
import { ExamPrepAssessmentsPanel } from "./components/ExamPrepAssessmentsPanel";
import {
createExamPrepModuleLesson,
updateExamPrepModuleLesson,
@ -898,6 +899,7 @@ export function CourseModuleDetailPage() {
})
}
onViewPractices={() => navigate(lessonPracticesPath(lesson))}
onViewAssessments={() => navigate(`/new-content/courses/${programType}/${courseId}/${unitId}/${moduleId}/lessons/${lesson.id}/assessments?lessonTitle=${encodeURIComponent(lesson.title)}`)}
onTogglePublishStatus={(nextStatus) =>
void handleToggleLessonPublishStatus(lesson.id, nextStatus)
}
@ -1165,6 +1167,7 @@ export function CourseModuleDetailPage() {
}
/>
) : null}
<ExamPrepAssessmentsPanel parent={{ kind: "MODULE", id: parsedModuleId }} />
</div>
);
}

View File

@ -18,7 +18,7 @@ import {
Eye,
} from "lucide-react"
import practiceSrc from "../../assets/Practice.svg"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import alertSrc from "../../assets/Alert.svg"
import { Button } from "../../components/ui/button"
import { Badge } from "../../components/ui/badge"

View File

@ -1,7 +1,7 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../lib/apiErrors"
import { useEffect, useMemo, useState } from "react"
import { useNavigate, useParams, useSearchParams } from "react-router-dom"
import { Loader2 } from "lucide-react"
import { PageBackLink } from "../../components/navigation/PageBackLink"
import { toast } from "sonner"
import { Button } from "../../components/ui/button"
@ -380,7 +380,7 @@ export function CreateQuestionTypeFlow() {
>
{saving ? (
<>
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
<SpinnerIcon className="h-4 w-4 mr-2 " />
Saving…
</>
) : isEdit ? (

View File

@ -1,7 +1,8 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { getApiErrorMessage, notifyApiError } from "../../lib/apiErrors"
import { useEffect, useMemo, useRef, useState } from "react";
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
import { Loader2 } from "lucide-react";
import { PageBackLink } from "../../components/navigation/PageBackLink";
import { navigateBack } from "../../lib/navigateBack";
import { toast } from "sonner";
@ -580,7 +581,7 @@ export function EditPracticeFlow() {
if (loadingPractice || definitionsLoading) {
return (
<div className="flex min-h-screen flex-col items-center justify-center gap-4 px-6 text-center">
<Loader2 className="h-10 w-10 animate-spin text-brand-500" />
<SpinnerIcon className="h-10 w-10 text-brand-500" />
<p className="text-sm font-medium text-grayScale-600">Loading practice details…</p>
</div>
);
@ -787,7 +788,7 @@ export function EditPracticeFlow() {
>
{submitting ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
<SpinnerIcon className="mr-2 h-4 w-4" />
Saving…
</>
) : (

View File

@ -18,7 +18,7 @@ import {
import { Input } from "../../components/ui/input";
import { Textarea } from "../../components/ui/textarea";
import uploadIcon from "../../assets/icons/upload.png";
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg";
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png";
import alertSrc from "../../assets/Alert.svg";
import {
getLearningPrograms,

View File

@ -0,0 +1,19 @@
import { Link, useParams, useSearchParams } from "react-router-dom";
import { ArrowLeft } from "lucide-react";
import { ExamPrepAssessmentsPanel } from "./components/ExamPrepAssessmentsPanel";
export function LessonAssessmentsPage() {
const { programType, courseId, unitId, moduleId, lessonId } = useParams();
const [searchParams] = useSearchParams();
const parentId = Number(lessonId);
return (
<div className="mx-auto max-w-4xl space-y-6 px-4 py-6">
<Link to={`/new-content/courses/${programType}/${courseId}/${unitId}/${moduleId}`} className="inline-flex items-center gap-2 text-sm font-medium text-grayScale-600 hover:text-brand-500">
<ArrowLeft className="h-4 w-4" /> Back to lessons
</Link>
<h1 className="text-2xl font-semibold text-grayScale-900">{searchParams.get("lessonTitle") || `Lesson #${lessonId}`} assessments</h1>
{Number.isFinite(parentId) && parentId > 0 ? <ExamPrepAssessmentsPanel parent={{ kind: "LESSON", id: parentId }} /> : null}
</div>
);
}

View File

@ -1,3 +1,4 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../lib/apiErrors"
import { useCallback, useEffect, useMemo, useState } from "react";
import { ArrowLeft, BookOpen, Calendar, RefreshCw } from "lucide-react";
@ -368,9 +369,7 @@ export function LessonPracticesPage() {
disabled={loading}
onClick={() => void load()}
>
<RefreshCw
className={cn("h-4 w-4", loading && "animate-spin")}
/>
{loading ? <SpinnerIcon className="h-4 w-4" /> : <RefreshCw className="h-4 w-4" />}
Refresh
</Button>
<PracticeActionButton

View File

@ -1,99 +1,60 @@
import { Link } from "react-router-dom";
import { Mic } from "lucide-react";
import { BookOpen, GraduationCap, ListChecks, Shuffle } from "lucide-react";
import { Card, CardContent } from "../../components/ui/card";
import { Button } from "../../components/ui/button";
export function NewContentPage() {
return (
<div className="space-y-8">
{/* Header section */}
<div className="flex items-start justify-between gap-4">
<div>
<h1 className="text-2xl font-bold tracking-tight text-grayScale-700">
Content Management
Learning Content
</h1>
<p className="mt-1 text-sm text-grayScale-500">
Upload, organize, and manage learning content across programs and
courses
<p className="mt-1 max-w-2xl text-sm text-grayScale-500">
Build one curriculum for education courses and exam preparation.
Add practice activities and assessment exams to each hierarchy level.
</p>
</div>
<div className="flex shrink-0 flex-wrap items-center justify-end gap-3">
<div className="flex shrink-0 flex-wrap justify-end gap-3">
<Link to="/new-content/question-types">
<Button className="h-10 px-6 rounded-[6px] bg-brand-500 font-bold text-white shadow-sm hover:bg-brand-600 transition-all">
Manage Question Types
<Button variant="outline" className="h-10 gap-2 px-4">
<ListChecks className="h-4 w-4" /> Question Types
</Button>
</Link>
<Link to="/new-content/reorder">
<Button
variant="outline"
className="h-10 px-6 rounded-[6px] border-brand-500 font-bold text-brand-500 hover:bg-brand-50 transition-all"
>
Reorder Content
<Button variant="outline" className="h-10 gap-2 px-4">
<Shuffle className="h-4 w-4" /> Reorder
</Button>
</Link>
</div>
</div>
{/* Gradient Divider */}
<div className="relative">
<div className="absolute inset-0 flex items-center" aria-hidden="true">
<div className="w-full border-t border-grayScale-100" />
</div>
<div className="relative flex justify-center">
<div
className="h-[0.5px] w-full opacity-20 rounded-full"
style={{
background: "gray",
}}
/>
</div>
</div>
{/* Cards Grid — equal-height cards with bottom-aligned actions */}
<div className="grid max-w-5xl gap-8 grid-cols-1 items-stretch md:grid-cols-2">
{/* Learn English Card */}
<Card className="flex h-full flex-col overflow-hidden border-none shadow-soft">
<div className="flex h-56 shrink-0 items-center justify-center bg-white/50">
<div className="flex h-20 w-20 items-center justify-center rounded-full bg-brand-100/30">
<Mic className="h-10 w-10 text-brand-500" />
<Card className="max-w-5xl overflow-hidden border-grayScale-100 shadow-soft">
<div className="grid md:grid-cols-[280px_1fr]">
<div className="flex min-h-52 items-center justify-center bg-brand-50/40">
<div className="flex h-20 w-20 items-center justify-center rounded-full bg-white shadow-sm">
<GraduationCap className="h-10 w-10 text-brand-500" />
</div>
</div>
<CardContent className="flex flex-1 flex-col border-t border-grayScale-200 bg-white p-8 text-center">
<h3 className="text-xl font-bold text-grayScale-700">
Learn English
</h3>
<p className="mt-3 flex-1 text-sm leading-relaxed text-grayScale-500">
Manage structured English learning content based on levels and
modules.
<CardContent className="flex flex-col justify-center p-8">
<h2 className="text-xl font-bold text-grayScale-800">
Exam prep catalog
</h2>
<p className="mt-2 max-w-2xl text-sm leading-relaxed text-grayScale-500">
Organize catalog courses into units, modules, and lessons. Use the
same structure for Education, IELTS, and Duolingo English Test
content. Attach practice activities and assessment question sets
where they belong.
</p>
<Link to="/new-content/learn-english" className="mt-8 block w-full">
<Button className="h-12 w-full rounded-[6px] bg-brand-500 text-base font-semibold">
Manage Learn English
<Link to="/new-content/courses" className="mt-6 w-fit">
<Button className="h-11 gap-2 bg-brand-500 px-6 font-semibold text-white hover:bg-brand-600">
<BookOpen className="h-4 w-4" /> Manage Catalog
</Button>
</Link>
</CardContent>
</Card>
{/* Courses Card */}
<Card className="flex h-full flex-col overflow-hidden border-none shadow-soft">
<div className="flex h-56 shrink-0 items-center justify-center bg-white/50">
<div className="flex h-20 w-20 items-center justify-center rounded-full bg-brand-100/30">
<Mic className="h-10 w-10 text-brand-500" />
</div>
</div>
<CardContent className="flex flex-1 flex-col border-t border-grayScale-200 bg-white p-8 text-center">
<h3 className="text-xl font-bold text-grayScale-700">Courses</h3>
<p className="mt-3 flex-1 text-sm leading-relaxed text-grayScale-500">
Manage skill-based and Duolingo/IELTS courses.
</p>
<Link to="/new-content/courses" className="mt-8 block w-full">
<Button className="h-12 w-full rounded-[6px] bg-brand-500 text-base font-semibold">
Manage Courses
</Button>
</Link>
</CardContent>
</Card>
</div>
</div>
</Card>
</div>
);
}

View File

@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from "react"
import { Link, useLocation, useParams } from "react-router-dom"
import { ArrowLeft, Plus, Edit, Trash2, X, Check, ChevronDown, ChevronUp, SlidersHorizontal, ArrowUpDown } from "lucide-react"
import practiceSrc from "../../assets/Practice.svg"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card"
import alertSrc from "../../assets/Alert.svg"
import { Badge } from "../../components/ui/badge"
@ -110,6 +110,9 @@ export function PracticeQuestionsPage() {
const [saveError, setSaveError] = useState<string | null>(null)
const backLink = useMemo(() => {
const returnPath = (location.state as { from?: unknown } | null)?.from
if (typeof returnPath === "string" && returnPath.startsWith("/new-content/")) return returnPath
if (location.pathname.includes("/content/question-sets/")) return "/new-content"
if (location.pathname.includes("/content/human-language/") && location.pathname.includes("/level/") && levelId) {
return "/content/human-language"
}

View File

@ -18,7 +18,7 @@ import {
import { Input } from "../../components/ui/input";
import { Textarea } from "../../components/ui/textarea";
import uploadIcon from "../../assets/icons/upload.png";
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg";
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png";
import alertSrc from "../../assets/Alert.svg";
import {
createProgramCourse,

View File

@ -27,18 +27,11 @@ import { toast } from "sonner";
import { ResolvedImage } from "../../components/media/ResolvedImage";
import {
createExamPrepCatalogCourse,
createProgramCourse,
deleteExamPrepCatalogCourse,
deleteTopLevelCourse,
getExamPrepCatalogCourses,
getLearningPrograms,
getProgramCourses,
setExamPrepCatalogCourseAccessTier,
setExamPrepCatalogCoursePublishStatus,
setProgramCourseAccessTier,
setProgramCoursePublishStatus,
updateExamPrepCatalogCourse,
updateTopLevelCourse,
} from "../../api/courses.api";
import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip";
import { ContentAccessTierChip } from "./components/ContentAccessTierChip";
@ -48,9 +41,7 @@ import type {
ContentAccessTier,
ExamPrepCatalogCategory,
ExamPrepCatalogCourseItem,
LearningProgramListItem,
PracticePublishStatus,
ProgramCourseListItem,
} from "../../types/course.types";
import {
filterBySearchAndPublishStatus,
@ -68,8 +59,6 @@ import {
type CourseListRow = {
id: number;
programId?: number;
programName?: string;
category?: ExamPrepCatalogCategory | string | null;
name: string;
description: string;
@ -85,21 +74,21 @@ type CourseListRow = {
export function ProgramDetailPage() {
const navigate = useNavigate();
const { programType } = useParams<{ programType: string }>();
const categoryByRoute: Record<string, ExamPrepCatalogCategory> = {
education: "EDUCATION",
ielts: "IELTS",
duolingo: "DUOLINGO",
};
const category = programType ? categoryByRoute[programType.toLowerCase()] : undefined;
const [createOpen, setCreateOpen] = useState(false);
const [createName, setCreateName] = useState("");
const [createDescription, setCreateDescription] = useState("");
const [createSortOrder, setCreateSortOrder] = useState("");
const [createProgramId, setCreateProgramId] = useState("");
const [createCategory, setCreateCategory] = useState<ExamPrepCatalogCategory | "">("");
const [createThumbnail, setCreateThumbnail] = useState("");
const [createThumbnailFromUpload, setCreateThumbnailFromUpload] = useState(false);
const [creating, setCreating] = useState(false);
const [uploadingThumbnail, setUploadingThumbnail] = useState(false);
const createThumbnailFileInputRef = useRef<HTMLInputElement>(null);
const [createdCourses, setCreatedCourses] = useState<CourseListRow[]>([]);
const [learningPrograms, setLearningPrograms] = useState<
LearningProgramListItem[]
>([]);
const [publishStatusUpdatingId, setPublishStatusUpdatingId] = useState<
number | null
>(null);
@ -119,26 +108,18 @@ export function ProgramDetailPage() {
const [deletingCourseId, setDeletingCourseId] = useState<number | null>(null);
const [deletingCourse, setDeletingCourse] = useState(false);
// Mock data for "proficiency" program type
const programs: Record<string, any> = {
proficiency: {
title: "Duolingo/IELTS",
description:
"Manage Duolingo/IELTS learning programs.",
courses: [],
},
"skill-based": {
title: "Skill-Based Courses",
description:
"Practice-focused communication and skills training for real-world scenarios.",
courses: [], // To be implemented or shown if needed
},
const categoryLabels: Record<ExamPrepCatalogCategory, string> = {
EDUCATION: "Education",
IELTS: "IELTS",
DUOLINGO: "Duolingo English Test",
};
const currentProgram =
programs[programType || "proficiency"] || programs.proficiency;
const isProficiency = programType === "proficiency";
const isSkillBased = programType === "skill-based";
const currentProgram = category
? {
title: categoryLabels[category],
description: `Manage ${categoryLabels[category]} catalog courses and their learning hierarchy.`,
}
: { title: "Catalog courses", description: "Choose a valid catalog category." };
const isExamPrepCatalog = Boolean(category);
const mapExamPrepCourse = (row: ExamPrepCatalogCourseItem): CourseListRow => ({
id: Number(row.id),
@ -154,84 +135,25 @@ export function ProgramDetailPage() {
lessonsCount: Number(row.lessons_count ?? 0),
});
const mapProgramCourse = (
row: ProgramCourseListItem,
programName?: string,
): CourseListRow => ({
id: Number(row.id),
programId: Number(row.program_id),
programName: programName?.trim() || undefined,
name: row.name?.trim() || `Course ${row.id}`,
description: row.description?.trim() || "",
thumbnail: row.thumbnail?.trim() || row.thumbnail_url?.trim() || null,
sortOrder: Number(row.sort_order ?? 0),
publishStatus: row.publish_status ?? null,
accessTier: row.access_tier ?? null,
unitsCount: 0,
modulesCount: Number(row.module_count ?? row.modules_count ?? 0),
lessonsCount: Number(row.lesson_count ?? 0),
});
const loadCourses = useCallback(async () => {
if (!isProficiency && !isSkillBased) return;
if (!category) return;
setCatalogLoading(true);
try {
if (isProficiency) {
const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepCatalogCourseItem>(
await getExamPrepCatalogCourses({ limit, offset }),
"catalog_courses",
),
);
setCreatedCourses(list.map(mapExamPrepCourse));
setLearningPrograms([]);
return;
}
const programsList = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<LearningProgramListItem>(
await getLearningPrograms({ limit, offset }),
"programs",
const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepCatalogCourseItem>(
await getExamPrepCatalogCourses({ limit, offset }),
"catalog_courses",
),
);
setLearningPrograms(programsList);
const programNameById = new Map(
programsList.map((program) => [program.id, program.name?.trim() || ""]),
);
const coursePages = await Promise.all(
programsList.map((program) =>
fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ProgramCourseListItem>(
await getProgramCourses(program.id, { limit, offset }),
"courses",
),
),
),
);
setCreatedCourses(
coursePages
.flat()
.map((row) =>
mapProgramCourse(row, programNameById.get(row.program_id)),
)
.sort((a, b) => a.sortOrder - b.sortOrder || a.id - b.id),
);
setCreatedCourses(list.filter((row) => row.category === category).map(mapExamPrepCourse));
} catch (error) {
console.error(error);
notifyApiError(
error,
isProficiency ? "Failed to fetch catalog courses" : "Failed to fetch courses",
);
notifyApiError(error, "Failed to fetch catalog courses");
setCreatedCourses([]);
if (isSkillBased) {
setLearningPrograms([]);
}
} finally {
setCatalogLoading(false);
}
}, [isProficiency, isSkillBased]);
}, [category]);
useEffect(() => {
void loadCourses();
@ -240,8 +162,6 @@ export function ProgramDetailPage() {
() =>
createdCourses.map((course) => ({
id: course.id,
programId: course.programId,
programName: course.programName,
category: course.category,
name: course.name,
description: course.description,
@ -269,7 +189,6 @@ export function ProgramDetailPage() {
getSearchFields: (c) => [
c.name,
c.description,
c.programName ?? "",
],
getPublishStatus: (c) => c.publish_status,
}),
@ -282,15 +201,9 @@ export function ProgramDetailPage() {
) => {
setPublishStatusUpdatingId(courseId);
try {
if (isProficiency) {
await setExamPrepCatalogCoursePublishStatus(courseId, {
publish_status: nextStatus,
});
} else {
await setProgramCoursePublishStatus(courseId, {
publish_status: nextStatus,
});
}
await setExamPrepCatalogCoursePublishStatus(courseId, {
publish_status: nextStatus,
});
setCreatedCourses((prev) =>
prev.map((c) =>
c.id === courseId ? { ...c, publishStatus: nextStatus } : c,
@ -312,15 +225,9 @@ export function ProgramDetailPage() {
) => {
setAccessTierUpdatingId(courseId);
try {
if (isProficiency) {
await setExamPrepCatalogCourseAccessTier(courseId, {
access_tier: nextTier,
});
} else {
await setProgramCourseAccessTier(courseId, {
access_tier: nextTier,
});
}
await setExamPrepCatalogCourseAccessTier(courseId, {
access_tier: nextTier,
});
setCreatedCourses((prev) =>
prev.map((c) =>
c.id === courseId ? { ...c, accessTier: nextTier } : c,
@ -388,9 +295,6 @@ export function ProgramDetailPage() {
const clearCreateCourseForm = () => {
setCreateName("");
setCreateDescription("");
setCreateSortOrder("");
setCreateProgramId("");
setCreateCategory("");
setCreateThumbnail("");
setCreateThumbnailFromUpload(false);
};
@ -418,47 +322,17 @@ export function ProgramDetailPage() {
thumbnailToSend = uploadedUrl;
}
if (isProficiency) {
if (createCategory !== "IELTS" && createCategory !== "DUOLINGO") {
toast.error("Please select an exam category");
return;
}
const response = await createExamPrepCatalogCourse({
name,
description: null,
category: createCategory,
thumbnail: thumbnailToSend,
});
const row = response.data?.data;
if (!row?.id) {
throw new Error("Missing created course payload");
}
} else if (isSkillBased) {
const programId = Number(createProgramId);
if (!Number.isFinite(programId) || programId < 1) {
toast.error("Please select a program");
return;
}
const sortOrderRaw = createSortOrder.trim();
if (!sortOrderRaw) {
toast.error("Sort order is required");
return;
}
const sort_order = Number(sortOrderRaw);
if (!Number.isInteger(sort_order) || sort_order < 0) {
toast.error("Sort order must be a whole number of 0 or greater");
return;
}
await createProgramCourse(programId, {
name,
description: createDescription.trim(),
thumbnail: thumbnailToSend ?? "",
sort_order,
});
} else {
toast.error("Unsupported program type");
if (!category) {
toast.error("Choose a valid catalog category");
return;
}
const response = await createExamPrepCatalogCourse({
name,
description: createDescription.trim() || null,
category,
thumbnail: thumbnailToSend,
});
if (!response.data?.data?.id) throw new Error("Missing created course payload");
await loadCourses();
toast.success("Course created");
@ -479,9 +353,9 @@ export function ProgramDetailPage() {
setEditName(String(course.name ?? ""));
setEditDescription(String(course.description ?? ""));
setEditCategory(
course.category === "IELTS" || course.category === "DUOLINGO"
course.category === "EDUCATION" || course.category === "IELTS" || course.category === "DUOLINGO"
? course.category
: "",
: category ?? "",
);
setEditThumbnail(String(course.thumbnail ?? ""));
setEditSortOrder(String(course.sort_order ?? 1));
@ -538,26 +412,19 @@ export function ProgramDetailPage() {
setSavingEdit(true);
try {
const minioThumbnail = await resolveThumbnailToMinioUrl(editThumbnail);
const existing = createdCourses.find((c) => c.id === editingCourseId);
const preservedDescription =
typeof existing?.description === "string"
? existing.description.trim() || null
: null;
if (isProficiency) {
if (editCategory !== "IELTS" && editCategory !== "DUOLINGO") {
if (editCategory !== "EDUCATION" && editCategory !== "IELTS" && editCategory !== "DUOLINGO") {
toast.error("Please select an exam category");
return;
}
const response = await updateExamPrepCatalogCourse(editingCourseId, {
}
const response = await updateExamPrepCatalogCourse(editingCourseId, {
name,
description: preservedDescription,
description: editDescription.trim() || null,
category: editCategory,
thumbnail: minioThumbnail || null,
sort_order: sortOrderNum,
});
const row = response.data?.data;
setCreatedCourses((prev) =>
const row = response.data?.data;
setCreatedCourses((prev) =>
prev.map((course) =>
course.id === editingCourseId
? {
@ -565,7 +432,7 @@ export function ProgramDetailPage() {
category: row?.category ?? editCategory,
name: row?.name ?? name,
description:
row?.description?.trim() || preservedDescription || "",
row?.description?.trim() || editDescription.trim() || "",
thumbnail: row?.thumbnail?.trim() || null,
sortOrder: Number(row?.sort_order ?? sortOrderNum),
unitsCount: Number(row?.units_count ?? course.unitsCount ?? 0),
@ -578,15 +445,7 @@ export function ProgramDetailPage() {
}
: course,
),
);
} else {
await updateTopLevelCourse(editingCourseId, {
name,
description: editDescription.trim(),
thumbnail: minioThumbnail,
sort_order: sortOrderNum,
});
}
);
await loadCourses();
toast.success("Course updated");
@ -603,11 +462,7 @@ export function ProgramDetailPage() {
if (!deletingCourseId) return;
setDeletingCourse(true);
try {
if (isProficiency) {
await deleteExamPrepCatalogCourse(deletingCourseId);
} else {
await deleteTopLevelCourse(deletingCourseId);
}
await deleteExamPrepCatalogCourse(deletingCourseId);
await loadCourses();
toast.success("Course deleted");
setDeletingCourseId(null);
@ -698,91 +553,9 @@ export function ProgramDetailPage() {
</DialogHeader>
<div className="min-h-0 flex-1 space-y-8 overflow-y-auto p-8">
{isProficiency ? (
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Exam Category
</label>
<select
value={createCategory}
onChange={(e) =>
setCreateCategory(e.target.value as ExamPrepCatalogCategory | "")
}
className="h-12 w-full rounded-[8px] border border-grayScale-400 bg-white px-4 text-[15px] text-grayScale-900 focus:outline-none focus:ring-2 focus:ring-brand-500/20"
disabled={creating || uploadingThumbnail}
>
<option value="">Select IELTS or Duolingo…</option>
<option value="IELTS">IELTS</option>
<option value="DUOLINGO">Duolingo</option>
</select>
</div>
) : null}
{isSkillBased ? (
<>
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Program
</label>
{learningPrograms.length === 0 ? (
<p className="text-sm text-grayScale-500">
No learning programs found. Create a program first
from{" "}
<Link
to="/new-content/learn-english"
className="font-semibold text-brand-500 hover:underline"
>
Learn English
</Link>
.
</p>
) : (
<select
value={createProgramId}
onChange={(e) => setCreateProgramId(e.target.value)}
className="h-12 w-full rounded-[8px] border border-grayScale-400 bg-white px-4 text-[15px] text-grayScale-900 focus:outline-none focus:ring-2 focus:ring-brand-500/20"
disabled={creating}
>
<option value="">Select a program…</option>
{learningPrograms.map((program) => (
<option key={program.id} value={String(program.id)}>
{program.name?.trim() || `Program ${program.id}`}
</option>
))}
</select>
)}
</div>
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Description
</label>
<Textarea
value={createDescription}
onChange={(e) => setCreateDescription(e.target.value)}
placeholder="Short summary of the course"
rows={3}
className="min-h-[88px] resize-y rounded-[8px] border-grayScale-400 px-4 text-[15px]"
disabled={creating || uploadingThumbnail}
/>
</div>
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Sort Order
</label>
<Input
type="number"
min={0}
value={createSortOrder}
onChange={(e) => setCreateSortOrder(e.target.value)}
placeholder="e.g. 1"
className="h-12 border-grayScale-400 rounded-[8px] px-4 placeholder:text-grayScale-400 text-[15px] focus:ring-brand-500/20"
disabled={creating}
/>
</div>
</>
) : null}
<div className="rounded-lg bg-grayScale-50 px-4 py-3 text-sm text-grayScale-600">
Category: <span className="font-semibold text-grayScale-900">{category ? categoryLabels[category] : "Unknown"}</span>
</div>
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Name
@ -790,16 +563,24 @@ export function ProgramDetailPage() {
<Input
value={createName}
onChange={(e) => setCreateName(e.target.value)}
placeholder={
isSkillBased
? "e.g. English For Professionals"
: "e.g. TOEFL, IELTS"
}
placeholder="e.g. English for Professionals or IELTS Academic"
className="h-12 border-grayScale-400 rounded-[8px] px-4 placeholder:text-grayScale-400 text-[15px] focus:ring-brand-500/20"
disabled={creating}
/>
</div>
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">Description</label>
<Textarea
value={createDescription}
onChange={(e) => setCreateDescription(e.target.value)}
placeholder="Short summary of the catalog course"
rows={3}
className="min-h-[88px] resize-y rounded-[8px] border-grayScale-400 px-4 text-[15px]"
disabled={creating || uploadingThumbnail}
/>
</div>
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Thumbnail
@ -878,9 +659,7 @@ export function ProgramDetailPage() {
<Button
className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
disabled={
creating ||
uploadingThumbnail ||
(isSkillBased && learningPrograms.length === 0)
creating || uploadingThumbnail || !category
}
onClick={() => void handleCreateCourse()}
>
@ -916,14 +695,8 @@ export function ProgramDetailPage() {
onSearchChange={setListSearch}
publishStatusFilter={publishStatusFilter}
onPublishStatusFilterChange={setPublishStatusFilter}
searchPlaceholder={
isSkillBased
? "Search courses by name, description, or program…"
: "Search courses by name or description…"
}
searchAriaLabel={
isSkillBased ? "Search skill-based courses" : "Search catalog courses"
}
searchPlaceholder="Search courses by name or description…"
searchAriaLabel="Search catalog courses"
/>
) : null}
<div className="flex flex-wrap gap-8">
@ -933,12 +706,10 @@ export function ProgramDetailPage() {
{displayCourses.length === 0 && !catalogLoading ? (
<div className="w-full rounded-xl border border-dashed border-grayScale-200 bg-grayScale-50/50 px-6 py-14 text-center">
<p className="text-sm font-medium text-grayScale-600">
{isSkillBased ? "No skill-based courses yet" : "No catalog courses yet"}
No catalog courses yet
</p>
<p className="mt-1 text-sm text-grayScale-400">
{isSkillBased
? "Create your first course under a learning program to start organizing modules and lessons."
: "Create your first Duolingo/IELTS catalog course to start organizing units, modules, and lessons."}
{`Create your first ${category ? categoryLabels[category] : "catalog"} course to organize units, modules, and lessons.`}
</p>
</div>
) : filteredCourses.length === 0 ? (
@ -1017,12 +788,7 @@ export function ProgramDetailPage() {
}
/>
</div>
{isSkillBased && course.programName ? (
<p className="text-[12px] font-semibold uppercase tracking-wide text-brand-500">
<SearchHighlight text={course.programName} query={listSearch} />
</p>
) : null}
{isProficiency && course.category ? (
{isExamPrepCatalog && course.category ? (
<p className="text-[12px] font-semibold uppercase tracking-wide text-brand-500">
{course.category === "DUOLINGO" ? "Duolingo" : course.category}
</p>
@ -1037,7 +803,7 @@ export function ProgramDetailPage() {
{/* Badges/Stats */}
<div className="flex items-center pt-4 gap-4">
{isProficiency ? (
{isExamPrepCatalog ? (
<div className="h-10 px-4 rounded-[6px] bg-grayScale-100 border border-grayScale-100 flex items-center gap-2 text-grayScale-700">
<ClipboardList className="h-3 w-3 text-grayScale-400" />
<span className="text-[12px] ">
@ -1063,12 +829,6 @@ export function ProgramDetailPage() {
<Button
className="w-full mt-4 h-10 bg-brand-500 text-white rounded-[6px] font-bold flex items-center justify-center gap-2 group/btn"
onClick={() => {
if (isSkillBased && course.programId) {
navigate(
`/new-content/learn-english/${course.programId}/courses/${course.id}`,
);
return;
}
navigate(`/new-content/courses/${programType}/${course.id}`);
}}
>
@ -1106,8 +866,7 @@ export function ProgramDetailPage() {
/>
</div>
{isSkillBased ? (
<div className="space-y-3">
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Description
</label>
@ -1119,13 +878,10 @@ export function ProgramDetailPage() {
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
) : null}
{isProficiency ? (
{isExamPrepCatalog ? (
<div className="space-y-3">
<label className="text-[15px] text-grayScale-800">
Exam Category
</label>
<label className="text-[15px] text-grayScale-800">Category</label>
<select
value={editCategory}
onChange={(e) =>
@ -1134,7 +890,8 @@ export function ProgramDetailPage() {
className="h-12 w-full rounded-[8px] border border-grayScale-400 bg-white px-4 text-[15px] text-grayScale-900 focus:outline-none focus:ring-2 focus:ring-brand-500/20"
disabled={savingEdit || uploadingEditThumbnail}
>
<option value="">Select IELTS or Duolingo…</option>
<option value="">Select a category…</option>
<option value="EDUCATION">Education</option>
<option value="IELTS">IELTS</option>
<option value="DUOLINGO">Duolingo</option>
</select>

View File

@ -1,77 +1,55 @@
import { Link } from "react-router-dom";
import { GraduationCap, Brain } from "lucide-react";
import { BookOpen, Languages, Target } from "lucide-react";
import { PageBackLink } from "../../components/navigation/PageBackLink";
const categories = [
{
slug: "education",
title: "Education",
description: "Structured learning courses with lessons, practice, and assessments.",
icon: BookOpen,
},
{
slug: "ielts",
title: "IELTS",
description: "Prepare learners for IELTS sections, skills, and exam practice.",
icon: Target,
},
{
slug: "duolingo",
title: "Duolingo English Test",
description: "Build courses and exam preparation for the Duolingo English Test.",
icon: Languages,
},
];
export function ProgramTypeSelectionPage() {
return (
<div className="space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500">
<PageBackLink fallbackTo="/new-content" label="Back to Content Management" />
{/* Header section */}
<div className="space-y-1.5 pt-2">
<div className="animate-in fade-in space-y-8 duration-500">
<PageBackLink fallbackTo="/new-content" label="Back to Learning Content" />
<div className="space-y-2 pt-2">
<h1 className="text-[28px] font-bold tracking-tight text-grayScale-900">
Courses
Catalog Courses
</h1>
<p className="max-w-2xl text-[15px] font-medium text-grayScale-500">
Organize courses under skill-based learning or English Proficiency
Exams. Select a program type to manage curriculum and modules.
<p className="max-w-2xl text-[15px] text-grayScale-500">
Choose a catalog category. Each category uses the same course → unit → module → lesson structure.
</p>
</div>
{/* Gradient Divider */}
<div className="relative">
<div className="absolute inset-0 flex items-center" aria-hidden="true">
<div className="w-full border-t border-grayScale-200" />
</div>
<div className="relative flex justify-center">
<div
className="h-[0.5px] w-full opacity-20 rounded-full"
style={{
background: "gray",
}}
/>
</div>
</div>
{/* Selection Cards Grid — equal width/height, consistent content alignment */}
<div className="grid max-w-5xl grid-cols-1 items-stretch gap-8 pt-4 md:grid-cols-2">
{/* Skill-Based Courses Card */}
<Link to="/new-content/courses/skill-based" className="group h-full">
<div className="flex h-full flex-col items-start gap-10 rounded-[6px] border border-grayScale-100 bg-white px-10 py-12 transition-all">
<div className="flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-brand-50/10">
<Brain className="h-8 w-8 text-brand-500" />
<div className="grid max-w-6xl grid-cols-1 gap-6 md:grid-cols-3">
{categories.map(({ slug, title, description, icon: Icon }) => (
<Link key={slug} to={`/new-content/courses/${slug}`} className="group h-full">
<div className="flex h-full min-h-64 flex-col rounded-xl border border-grayScale-100 bg-white p-7 shadow-sm transition hover:border-brand-200 hover:shadow-md">
<div className="mb-6 flex h-14 w-14 items-center justify-center rounded-full bg-brand-50">
<Icon className="h-7 w-7 text-brand-500" />
</div>
<h2 className="text-lg font-bold text-grayScale-900">{title}</h2>
<p className="mt-2 flex-1 text-sm leading-relaxed text-grayScale-500">{description}</p>
<span className="mt-5 text-sm font-semibold text-brand-600 group-hover:underline">
Manage courses →
</span>
</div>
<div className="flex min-h-0 flex-1 flex-col space-y-3">
<h3 className="text-[20px] font-bold text-grayScale-900">
Skill-Based Courses
</h3>
<p className="flex-1 text-[15px] font-medium leading-relaxed text-grayScale-500">
Practice-focused communication and skills training. Create
modules for vocabulary, grammar, and real-world conversation
scenarios.
</p>
</div>
</div>
</Link>
{/* English Proficiency Exams Card */}
<Link to="/new-content/courses/proficiency" className="group h-full">
<div className="flex h-full flex-col items-start gap-10 rounded-[6px] border border-grayScale-100 bg-white px-10 py-12 transition-all">
<div className="flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-brand-50/10">
<GraduationCap className="h-8 w-8 text-brand-500" />
</div>
<div className="flex min-h-0 flex-1 flex-col space-y-3">
<h3 className="text-[20px] font-bold text-grayScale-900 transition-colors">
English Proficiency Exams
</h3>
<p className="flex-1 text-[15px] font-medium leading-relaxed text-grayScale-500">
English Proficiency Exams courses. Structure content by band
scores, sections, and mock tests.
</p>
</div>
</div>
</Link>
</Link>
))}
</div>
</div>
);

View File

@ -229,7 +229,7 @@ export function QuestionTypeLibraryPage() {
void load()
}}
>
<RefreshCw className={cn("mr-2 h-4 w-4", loading && "animate-spin")} />
{loading ? <SpinnerIcon className="mr-2 h-4 w-4" /> : <RefreshCw className="mr-2 h-4 w-4" />}
Refresh
</Button>
</div>

View File

@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from "react"
import { Link } from "react-router-dom"
import { Plus, Search, Edit, Trash2, HelpCircle, X, ChevronDown, ChevronLeft, ChevronRight } from "lucide-react"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import { Button } from "../../components/ui/button"
import { AdminFiltersPanel } from "../../components/filters/AdminFiltersPanel"
import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card"

View File

@ -1,14 +1,7 @@
import { useState } from "react";
import { ContentHierarchyList } from "./components/ContentHierarchyList";
import { ExamPrepContentHierarchyList } from "./components/ExamPrepContentHierarchyList";
import { PageBackLink } from "../../components/navigation/PageBackLink";
import { cn } from "../../lib/utils";
type ReorderTab = "learn_english" | "exam_prep";
import { ExamPrepContentHierarchyList } from "./components/ExamPrepContentHierarchyList";
export function ReorderContentPage() {
const [tab, setTab] = useState<ReorderTab>("learn_english");
return (
<div className="animate-in fade-in space-y-4 pb-10 duration-500">
<div className="space-y-3">
@ -17,51 +10,17 @@ export function ReorderContentPage() {
label="Back to Content Management"
iconClassName="h-4 w-4 group-hover:-translate-x-1"
/>
<div className="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
<div className="min-w-0 space-y-0.5">
<h1 className="text-xl font-bold tracking-tight text-grayScale-700">
Reorder Content
</h1>
<p className="max-w-2xl text-xs text-grayScale-500">
Drag and drop to change order. Changes save automatically on drop.
</p>
</div>
<div className="flex w-fit shrink-0 gap-0.5 rounded-md border border-grayScale-200 bg-grayScale-50 p-0.5">
<button
type="button"
onClick={() => setTab("learn_english")}
className={cn(
"rounded px-3 py-1.5 text-xs font-semibold transition-colors",
tab === "learn_english"
? "bg-white text-grayScale-900 shadow-sm"
: "text-grayScale-500 hover:text-grayScale-700",
)}
>
Learn English
</button>
<button
type="button"
onClick={() => setTab("exam_prep")}
className={cn(
"rounded px-3 py-1.5 text-xs font-semibold transition-colors",
tab === "exam_prep"
? "bg-white text-grayScale-900 shadow-sm"
: "text-grayScale-500 hover:text-grayScale-700",
)}
>
Duolingo/IELTS
</button>
</div>
<div className="space-y-0.5">
<h1 className="text-xl font-bold tracking-tight text-grayScale-700">
Reorder Content
</h1>
<p className="max-w-2xl text-xs text-grayScale-500">
Drag items to reorder catalog courses, units, modules, and lessons.
Changes save when you release an item.
</p>
</div>
</div>
{tab === "learn_english" ? (
<ContentHierarchyList />
) : (
<ExamPrepContentHierarchyList />
)}
<ExamPrepContentHierarchyList />
</div>
);
}

View File

@ -1,7 +1,7 @@
import { useEffect, useState } from "react"
import { Link, useNavigate, useParams } from "react-router-dom"
import { ArrowLeft, BookOpen, ChevronRight } from "lucide-react"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import alertSrc from "../../assets/Alert.svg"
import { Badge } from "../../components/ui/badge"
import { getCoursesBySubCategoryId, getSubCategoriesByCategoryId } from "../../api/courses.api"

View File

@ -1,7 +1,7 @@
import { useEffect, useState } from "react"
import { Link, useParams, useNavigate } from "react-router-dom"
import { ArrowLeft, Plus, FileText, Layers, Edit, Trash2, X, Video, MoreVertical, Star, ChevronLeft, ChevronRight, MessageSquare, Play } from "lucide-react"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import { Card } from "../../components/ui/card"
import alertSrc from "../../assets/Alert.svg"
import { Badge } from "../../components/ui/badge"

View File

@ -9,7 +9,7 @@ import {
LayoutList,
Layers,
} from "lucide-react"
import spinnerSrc from "../../assets/Circular-indeterminate progress indicator.svg"
import spinnerSrc from "../../assets/05d37a91-04f9-41d8-99a2-b11bf20a6af2.png"
import alertSrc from "../../assets/Alert.svg"
import { Badge } from "../../components/ui/badge"
import { Button } from "../../components/ui/button"

View File

@ -54,6 +54,7 @@ import {
} from "../../lib/contentListFilters";
import { PracticeActionButton } from "./components/PracticeActionButton";
import { UnitPracticesPanel } from "./components/UnitPracticesPanel";
import { ExamPrepAssessmentsPanel } from "./components/ExamPrepAssessmentsPanel";
import { cn } from "../../lib/utils";
import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight"
@ -125,7 +126,7 @@ export function UnitManagementPage() {
const [listSearch, setListSearch] = useState("");
const [publishStatusFilter, setPublishStatusFilter] =
useState<PublishStatusFilter>("all");
const [activeTab, setActiveTab] = useState<"modules" | "practices">("modules");
const [activeTab, setActiveTab] = useState<"modules" | "practices" | "assessments">("modules");
const unitPracticePathOptions = useMemo(
() => ({
@ -831,6 +832,13 @@ export function UnitManagementPage() {
>
Practices
</button>
<button
type="button"
onClick={() => setActiveTab("assessments")}
className={cn("pb-4 text-[16px] font-medium transition-all relative", activeTab === "assessments" ? "text-brand-500 after:absolute after:bottom-0 after:left-0 after:right-0 after:h-[3px] after:bg-brand-500 after:rounded-t-full" : "text-grayScale-400 hover:text-grayScale-600")}
>
Assessment exams
</button>
</div>
</div>
@ -850,7 +858,9 @@ export function UnitManagementPage() {
</div>
{/* Grid of Modules */}
{activeTab === "practices" ? (
{activeTab === "assessments" ? (
<ExamPrepAssessmentsPanel parent={{ kind: "UNIT", id: parsedUnitId }} />
) : activeTab === "practices" ? (
<UnitPracticesPanel
unitId={parsedUnitId}
programType={programType ?? ""}

View File

@ -1,7 +1,8 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../../lib/apiErrors"
import { useCallback, useEffect, useMemo, useState } from "react"
import { useNavigate } from "react-router-dom"
import { BookOpen, Loader2, RefreshCw } from "lucide-react"
import { BookOpen, RefreshCw } from "lucide-react"
import { toast } from "sonner"
import {
deleteExamPrepPractice,
@ -212,7 +213,7 @@ export function CatalogCoursePracticesPanel({
if (loading) {
return (
<div className="flex flex-col items-center justify-center py-24 text-grayScale-500">
<Loader2 className="mb-3 h-8 w-8 animate-spin text-brand-500" />
<SpinnerIcon className="mb-3 h-8 w-8 text-brand-500" />
<p className="text-sm font-medium">Loading practices…</p>
</div>
)

View File

@ -1,5 +1,6 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useState } from "react"
import { Crown, Loader2, Sparkles } from "lucide-react"
import { Crown, Sparkles } from "lucide-react"
import type { ContentAccessTier } from "../../../types/course.types"
import {
accessTierLabel,
@ -34,7 +35,7 @@ export function ContentAccessTierChip({
const body = (
<>
{updating ? (
<Loader2 className="h-3 w-3 shrink-0 animate-spin" />
<SpinnerIcon className="h-3 w-3 shrink-0" />
) : isPremium ? (
<Crown className="h-3 w-3 shrink-0" aria-hidden />
) : (

View File

@ -1,3 +1,4 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../../lib/apiErrors"
import React, { useState, useEffect, useCallback } from "react";
import {
@ -22,19 +23,7 @@ import {
useSortable,
} from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import {
GripVertical,
ChevronDown,
ChevronRight,
LayoutGrid,
BookOpen,
Layers,
PlayCircle,
RotateCcw,
Edit2,
Trash2,
Loader2,
} from "lucide-react";
import { GripVertical, ChevronDown, ChevronRight, LayoutGrid, BookOpen, Layers, PlayCircle, RotateCcw, Edit2, Trash2 } from "lucide-react";
import { cn } from "../../../lib/utils";
import { toast } from "sonner";
import {
@ -578,7 +567,7 @@ export function ContentHierarchyList() {
>
{loading.program ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
<DraggableList
@ -601,7 +590,7 @@ export function ContentHierarchyList() {
>
{loading.course ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
programs.map((program) => {
@ -637,7 +626,7 @@ export function ContentHierarchyList() {
>
{loading.module ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
courses.map((course) => {
@ -673,7 +662,7 @@ export function ContentHierarchyList() {
>
{loading.lesson ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
modules.map((module) => {

View File

@ -1,5 +1,5 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useState } from "react"
import { Loader2 } from "lucide-react"
import type { PracticePublishStatus } from "../../../types/course.types"
import {
isPublishedPublishStatus,
@ -36,7 +36,7 @@ export function ContentPublishStatusChip({
const body = (
<>
{updating ? (
<Loader2 className="h-3 w-3 shrink-0 animate-spin" />
<SpinnerIcon className="h-3 w-3 shrink-0" />
) : (
<span
className={cn(

View File

@ -0,0 +1,167 @@
import { useCallback, useEffect, useState } from "react";
import { Link2, Loader2, Unlink } from "lucide-react";
import { Link, useLocation } from "react-router-dom";
import { Button } from "../../../components/ui/button";
import { Select } from "../../../components/ui/select";
import { notifyApiError } from "../../../lib/apiErrors";
import {
getExamPrepAssessments,
getQuestionSets,
createQuestionSet,
linkExamPrepAssessment,
unlinkExamPrepAssessment,
} from "../../../api/courses.api";
import type { ExamPrepAssessmentParent, QuestionSet } from "../../../types/course.types";
function readSets(value: unknown): QuestionSet[] {
if (!value || typeof value !== "object") return [];
const data = (value as { data?: unknown }).data;
if (Array.isArray(data)) return data as QuestionSet[];
if (data && typeof data === "object") {
const container = data as { question_sets?: unknown; assessments?: unknown };
const sets = Array.isArray(container.assessments) ? container.assessments : container.question_sets;
if (Array.isArray(sets)) return sets as QuestionSet[];
}
return [];
}
const parentLabel: Record<ExamPrepAssessmentParent["kind"], string> = {
CATALOG_COURSE: "catalog course",
UNIT: "unit",
MODULE: "module",
LESSON: "lesson",
};
export function ExamPrepAssessmentsPanel({ parent }: { parent: ExamPrepAssessmentParent }) {
const location = useLocation();
const [linked, setLinked] = useState<QuestionSet[]>([]);
const [available, setAvailable] = useState<QuestionSet[]>([]);
const [selectedId, setSelectedId] = useState("");
const [newTitle, setNewTitle] = useState("");
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
const reload = useCallback(async () => {
setLoading(true);
try {
const [linkedResponse, availableResponse] = await Promise.all([
getExamPrepAssessments(parent),
getQuestionSets({ set_type: "EXAM", limit: 200, offset: 0 }),
]);
setLinked(readSets(linkedResponse.data));
setAvailable(readSets(availableResponse.data).filter((set) => set.set_type === "EXAM"));
} catch (error) {
notifyApiError(error, "Could not load assessments");
} finally {
setLoading(false);
}
}, [parent.kind, parent.id]);
useEffect(() => { void reload(); }, [reload]);
const linkedIds = new Set(linked.map((set) => set.id));
const attachable = available.filter((set) => !linkedIds.has(set.id));
const attach = async () => {
if (!selectedId) return;
setSaving(true);
try {
await linkExamPrepAssessment({
question_set_id: Number(selectedId),
parent_kind: parent.kind,
parent_id: parent.id,
});
setSelectedId("");
await reload();
} catch (error) {
notifyApiError(error, "Could not attach assessment");
} finally {
setSaving(false);
}
};
const detach = async (questionSetId: number) => {
setSaving(true);
try {
await unlinkExamPrepAssessment(questionSetId, parent);
await reload();
} catch (error) {
notifyApiError(error, "Could not remove assessment");
} finally {
setSaving(false);
}
};
const createExam = async () => {
if (!newTitle.trim()) return;
setSaving(true);
try {
const response = await createQuestionSet({ title: newTitle.trim(), set_type: "EXAM", status: "DRAFT" });
const id = response.data?.data?.id;
if (id == null) throw new Error("The exam question set was not created");
await linkExamPrepAssessment({ question_set_id: id, parent_kind: parent.kind, parent_id: parent.id });
setNewTitle("");
await reload();
} catch (error) {
notifyApiError(error, "Could not create exam");
} finally {
setSaving(false);
}
};
return (
<section className="space-y-4 rounded-xl border border-grayScale-200 bg-white p-4">
<div>
<h3 className="text-sm font-semibold text-grayScale-800">Assessment exams</h3>
<p className="mt-1 text-xs text-grayScale-500">
Attach EXAM question sets to this {parentLabel[parent.kind]}.
</p>
</div>
{loading ? (
<p className="flex items-center gap-2 text-xs text-grayScale-500"><Loader2 className="h-3.5 w-3.5 animate-spin" /> Loading assessments…</p>
) : (
<>
<div className="flex flex-col gap-2 sm:flex-row">
<Select value={selectedId} onChange={(event) => setSelectedId(event.target.value)} disabled={!attachable.length || saving}>
<option value="">{attachable.length ? "Select an exam question set…" : "No unlinked exam sets available"}</option>
{attachable.map((set) => <option key={set.id} value={set.id}>{set.title}</option>)}
</Select>
<Button type="button" onClick={() => void attach()} disabled={!selectedId || saving}>
<Link2 className="mr-2 h-4 w-4" /> Attach exam
</Button>
</div>
<div className="flex flex-col gap-2 sm:flex-row">
<input
className="h-10 min-w-0 flex-1 rounded-md border border-grayScale-200 bg-white px-3 text-sm text-grayScale-700 outline-none focus:border-brand-500"
value={newTitle}
onChange={(event) => setNewTitle(event.target.value)}
placeholder="New assessment exam title"
aria-label="New assessment exam title"
disabled={saving}
/>
<Button type="button" variant="outline" onClick={() => void createExam()} disabled={!newTitle.trim() || saving}>
Create exam
</Button>
</div>
{linked.length ? (
<ul className="divide-y divide-grayScale-100 rounded-lg border border-grayScale-100">
{linked.map((set) => (
<li key={set.id} className="flex items-center justify-between gap-3 px-3 py-2.5">
<span className="text-sm text-grayScale-700">{set.title}</span>
<div className="flex gap-2">
<Button asChild type="button" size="sm" variant="outline">
<Link to={`/content/question-sets/${set.id}/questions`} state={{ from: `${location.pathname}${location.search}` }}>Edit questions</Link>
</Button>
<Button type="button" size="sm" variant="outline" disabled={saving} onClick={() => void detach(set.id)}>
<Unlink className="mr-1.5 h-3.5 w-3.5" /> Remove
</Button>
</div>
</li>
))}
</ul>
) : <p className="text-xs text-grayScale-400">No assessment exams are attached here.</p>}
</>
)}
</section>
);
}

View File

@ -1,13 +1,7 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../../lib/apiErrors"
import { useCallback, useEffect, useState } from "react"
import {
BookOpen,
GraduationCap,
Layers,
Loader2,
PlayCircle,
RotateCcw,
} from "lucide-react"
import { BookOpen, GraduationCap, Layers, PlayCircle, RotateCcw } from "lucide-react"
import { toast } from "sonner"
import {
getExamPrepCatalogCourses,
@ -302,7 +296,7 @@ export function ExamPrepContentHierarchyList() {
>
{loading.catalogCourse ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
<DraggableList
@ -321,7 +315,7 @@ export function ExamPrepContentHierarchyList() {
>
{loading.unit ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
catalogCourses.map((course) => {
@ -353,7 +347,7 @@ export function ExamPrepContentHierarchyList() {
>
{loading.module ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
units.map((unit) => {
@ -385,7 +379,7 @@ export function ExamPrepContentHierarchyList() {
>
{loading.lesson ? (
<div className="flex items-center justify-center py-4">
<Loader2 className="h-5 w-5 animate-spin text-brand-500" />
<SpinnerIcon className="h-5 w-5 text-brand-500" />
</div>
) : (
modules.map((module) => {

View File

@ -1,5 +1,6 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useEffect, useMemo, useState } from "react";
import { Edit2, Loader2, MoreVertical, Unlink } from "lucide-react";
import { Edit2, MoreVertical, Unlink } from "lucide-react";
import { Button } from "../../../components/ui/button";
import { Card } from "../../../components/ui/card";
import {
@ -146,7 +147,7 @@ export function ModulePracticeCard({
onClick={(e) => e.stopPropagation()}
>
{statusUpdating ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : (
<MoreVertical className="h-4 w-4" />
)}

View File

@ -1,5 +1,5 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useCallback, useEffect, useState } from "react"
import { Loader2 } from "lucide-react"
import { toast } from "sonner"
import { notifyApiError } from "../../../lib/apiErrors"
import {
@ -173,7 +173,7 @@ export function PublishPracticeButton({
}
>
{(loading || acting) && (
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
<SpinnerIcon className="mr-2 h-4 w-4 " />
)}
{label}
</Button>

View File

@ -1,7 +1,8 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../../lib/apiErrors"
import { useCallback, useEffect, useMemo, useState } from "react"
import { useNavigate } from "react-router-dom"
import { BookOpen, Loader2, RefreshCw } from "lucide-react"
import { BookOpen, RefreshCw } from "lucide-react"
import { toast } from "sonner"
import {
deleteExamPrepPractice,
@ -208,7 +209,7 @@ export function UnitPracticesPanel({
if (loading) {
return (
<div className="flex flex-col items-center justify-center py-24 text-grayScale-500">
<Loader2 className="mb-3 h-8 w-8 animate-spin text-brand-500" />
<SpinnerIcon className="mb-3 h-8 w-8 text-brand-500" />
<p className="text-sm font-medium">Loading practices…</p>
</div>
)

View File

@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from "react";
import {
BookOpen,
ClipboardCheck,
Calendar,
Edit2,
MoreVertical,
@ -90,6 +91,7 @@ interface VideoCardProps {
addPracticeDisabled?: boolean;
/** When set with hoverModuleActions, shows a book icon next to edit/delete on thumbnail hover. */
onViewPractices?: () => void;
onViewAssessments?: () => void;
onPublish?: () => void;
/** Toggle draft ↔ published via PUT /lessons/:id (module lesson cards). */
onTogglePublishStatus?: (nextStatus: PracticePublishStatus) => void;
@ -118,6 +120,7 @@ export function VideoCard({
onAddPractice,
addPracticeDisabled = false,
onViewPractices,
onViewAssessments,
onTogglePublishStatus,
publishStatusUpdating = false,
accessTier,
@ -309,7 +312,7 @@ export function VideoCard({
!useGradient && "bg-grayScale-100",
)}
>
{hoverModuleActions && (onEdit || onDelete || onViewPractices) ? (
{hoverModuleActions && (onEdit || onDelete || onViewPractices || onViewAssessments) ? (
<div
className="absolute right-2 top-2 z-20 flex translate-y-1 gap-1 opacity-0 pointer-events-none transition-all duration-300 ease-out group-hover:translate-y-0 group-hover:opacity-100 group-hover:pointer-events-auto"
>
@ -328,6 +331,18 @@ export function VideoCard({
<BookOpen className="h-3.5 w-3.5" />
</Button>
) : null}
{onViewAssessments ? (
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-[6px] bg-white/95 text-brand-600 shadow-sm transition-colors hover:bg-brand-50"
aria-label={`Manage assessments for ${title}`}
onClick={(e) => { e.stopPropagation(); onViewAssessments(); }}
>
<ClipboardCheck className="h-3.5 w-3.5" />
</Button>
) : null}
{onEdit ? (
<Button
type="button"

View File

@ -1,6 +1,7 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../../../lib/apiErrors"
import { useRef, useState, type ChangeEvent } from "react";
import { ArrowRight, ChevronDown, ChevronUp, Loader2, Upload } from "lucide-react";
import { ArrowRight, ChevronDown, ChevronUp, Upload } from "lucide-react";
import { Button } from "../../../../components/ui/button";
import { Card } from "../../../../components/ui/card";
import { Input } from "../../../../components/ui/input";
@ -260,7 +261,7 @@ export function ContextStep({
className="gap-2"
>
{uploadingStory ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : (
<Upload className="h-4 w-4" />
)}

View File

@ -1,5 +1,6 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useMemo } from "react"
import { Loader2, Rocket } from "lucide-react"
import { Rocket } from "lucide-react"
import { Button } from "../../../../components/ui/button"
import { Card } from "../../../../components/ui/card"
import {
@ -37,7 +38,7 @@ function ParentsSummaryValue({
if (loading) {
return (
<span className="inline-flex items-center gap-2 text-grayScale-500">
<Loader2 className="h-3.5 w-3.5 animate-spin" />
<SpinnerIcon className="h-3.5 w-3.5" />
Loading locations…
</span>
)
@ -165,7 +166,7 @@ export function LinkExistingPracticeReviewStep({
>
{saving ? (
<>
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
Linking…
</>
) : (

View File

@ -1,4 +1,5 @@
import { Check, ArrowRight, Loader2 } from "lucide-react";
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { Check, ArrowRight } from "lucide-react";
import { Link } from "react-router-dom";
import { Button } from "../../../../components/ui/button";
import { PersonaAvatar } from "../../../../components/personas/PersonaAvatar";
@ -39,7 +40,7 @@ export function PersonaStep({
{loading ? (
<div className="flex flex-col items-center justify-center py-16">
<Loader2 className="h-10 w-10 animate-spin text-brand-500" />
<SpinnerIcon className="h-10 w-10 text-brand-500" />
<p className="mt-4 text-sm font-medium text-grayScale-500">
Loading personas…
</p>

View File

@ -1,6 +1,7 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../../../lib/apiErrors"
import { useMemo, useState } from "react"
import { Loader2, Plus, Trash2 } from "lucide-react"
import { Plus, Trash2 } from "lucide-react"
import { usePracticeParentTitles } from "../../../../hooks/usePracticeParentTitles"
import { toast } from "sonner"
import { Button } from "../../../../components/ui/button"
@ -228,7 +229,7 @@ export function PracticeParentsField({
aria-label="Remove location"
>
{isUnlinking ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : (
<Trash2 className="h-4 w-4" />
)}

View File

@ -1,5 +1,6 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useState } from "react";
import { Edit, Info, Loader2, Play, Rocket } from "lucide-react";
import { Edit, Info, Play, Rocket } from "lucide-react";
import { PersonaAvatar } from "../../../../components/personas/PersonaAvatar";
import { Button } from "../../../../components/ui/button";
import { Card } from "../../../../components/ui/card";
@ -399,7 +400,7 @@ export function PracticeSequentialReview({
>
{saving ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
<SpinnerIcon className="mr-2 h-4 w-4" />
Saving…
</>
) : (
@ -413,7 +414,7 @@ export function PracticeSequentialReview({
className="h-10 gap-2 rounded-[6px] bg-brand-500 px-8 text-sm font-bold text-white shadow-md shadow-brand-500/20 hover:bg-brand-600 disabled:opacity-50"
>
{saving ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : (
<Rocket className="h-4 w-4" />
)}

View File

@ -1,7 +1,8 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { notifyApiError } from "../../../../lib/apiErrors"
import { useRef, useState, type ChangeEvent } from "react";
import { Link } from "react-router-dom";
import { Upload, ArrowRight, Loader2 } from "lucide-react";
import { Upload, ArrowRight } from "lucide-react";
import { Button } from "../../../../components/ui/button";
import { Card } from "../../../../components/ui/card";
import { Input } from "../../../../components/ui/input";
@ -86,7 +87,7 @@ export function ScenarioStep({
className="gap-2"
>
{uploadingBanner ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : (
<Upload className="h-4 w-4" />
)}

View File

@ -1,5 +1,6 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useState } from "react"
import { ArrowLeft, Loader2 } from "lucide-react"
import { ArrowLeft } from "lucide-react"
import { useNavigate } from "react-router-dom"
import { toast } from "sonner"
import { notifyApiError } from "../../../../lib/apiErrors"
@ -149,7 +150,7 @@ export function QuestionTypeReviewPublishStep({
onClick={() => void submit("INACTIVE")}
>
{submitting ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : isEdit ? (
"Save as inactive"
) : (
@ -163,7 +164,7 @@ export function QuestionTypeReviewPublishStep({
onClick={() => void submit("ACTIVE")}
>
{submitting ? (
<Loader2 className="h-4 w-4 animate-spin" />
<SpinnerIcon className="h-4 w-4" />
) : isEdit ? (
"Save as active"
) : (

View File

@ -1,5 +1,6 @@
import { SpinnerIcon } from "@/components/ui/spinner-icon";
import { useCallback, useEffect, useState } from "react"
import { CheckCircle2, Loader2 } from "lucide-react"
import { CheckCircle2 } from "lucide-react"
import { toast } from "sonner"
import { Button } from "../../../../components/ui/button"
import { Card } from "../../../../components/ui/card"
@ -95,7 +96,7 @@ export function QuestionTypeValidatePreviewStep({
>
{validating ? (
<>
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
<SpinnerIcon className="h-4 w-4 mr-2" />
Validating…
</>
) : (

View File

@ -10,13 +10,10 @@ import type {
LearningActivityCourse,
LearningActivityLesson,
LearningActivityModule,
LearningActivityProgram,
LearningActivityUnit,
UserLearningActivityData,
} from "../../../types/userAdmin.types";
type Track = "lms" | "exam_prep";
function ProgressBar({ access }: { access: LearningActivityAccess }) {
const percent = Math.min(100, Math.max(0, access.progress_percent));
return (
@ -154,9 +151,9 @@ function UnitBlock({ unit }: { unit: LearningActivityUnit }) {
);
}
function CourseBlock({ course, examPrep }: { course: LearningActivityCourse; examPrep?: boolean }) {
function CourseBlock({ course }: { course: LearningActivityCourse }) {
const [open, setOpen] = useState(false);
const children = examPrep ? (course.units ?? []) : (course.modules ?? []);
const children = course.units ?? [];
return (
<div className="rounded-xl border border-grayScale-200 bg-white">
@ -184,10 +181,8 @@ function CourseBlock({ course, examPrep }: { course: LearningActivityCourse; exa
<div className="space-y-3 border-t border-grayScale-100 px-4 py-3">
{children.length === 0 ? (
<p className="text-xs text-grayScale-400">No content available.</p>
) : examPrep ? (
(course.units ?? []).map((unit) => <UnitBlock key={unit.id} unit={unit} />)
) : (
(course.modules ?? []).map((module) => <ModuleBlock key={module.id} module={module} />)
(course.units ?? []).map((unit) => <UnitBlock key={unit.id} unit={unit} />)
)}
</div>
) : null}
@ -214,23 +209,10 @@ export function UserLearningActivitySection({
error: string | null;
}) {
const [open, setOpen] = useState(false);
const [track, setTrack] = useState<Track>("lms");
const programs = activity?.lms.progress.programs ?? [];
const catalogCourses = activity?.exam_prep.progress.catalog_courses ?? [];
const [selectedProgramId, setSelectedProgramId] = useState<number | null>(null);
const [selectedCatalogCourseId, setSelectedCatalogCourseId] = useState<number | null>(null);
useEffect(() => {
if (programs.length === 0) {
setSelectedProgramId(null);
return;
}
if (!selectedProgramId || !programs.some((program) => program.id === selectedProgramId)) {
setSelectedProgramId(programs[0].id);
}
}, [programs, selectedProgramId]);
useEffect(() => {
if (catalogCourses.length === 0) {
setSelectedCatalogCourseId(null);
@ -244,18 +226,11 @@ export function UserLearningActivitySection({
}
}, [catalogCourses, selectedCatalogCourseId]);
const selectedProgram = useMemo(
() => programs.find((program) => program.id === selectedProgramId) ?? null,
[programs, selectedProgramId],
);
const selectedCatalogCourse = useMemo(
() => catalogCourses.find((course) => course.id === selectedCatalogCourseId) ?? null,
[catalogCourses, selectedCatalogCourseId],
);
const completedIds = activity?.lms.completed_ids;
return (
<Card className="shadow-soft">
<CardHeader className="pb-3">
@ -272,7 +247,7 @@ export function UserLearningActivitySection({
<div>
<CardTitle className="text-base">Learning activity</CardTitle>
<p className="mt-0.5 text-xs text-grayScale-500">
LMS and Duolingo/IELTS progress trees for this learner.
Progress through catalog course → unit → module → lesson.
</p>
</div>
</div>
@ -285,32 +260,6 @@ export function UserLearningActivitySection({
</CardHeader>
{open ? (
<CardContent className="space-y-4">
<div className="flex justify-end">
<div className="flex rounded-lg border border-grayScale-200 p-1">
<button
type="button"
className={cn(
"rounded-[6px] px-3 py-1.5 text-xs font-medium transition-colors",
track === "lms" ? "bg-brand-500 text-white" : "text-grayScale-500 hover:text-grayScale-700",
)}
onClick={() => setTrack("lms")}
>
Learn English
</button>
<button
type="button"
className={cn(
"rounded-[6px] px-3 py-1.5 text-xs font-medium transition-colors",
track === "exam_prep"
? "bg-brand-500 text-white"
: "text-grayScale-500 hover:text-grayScale-700",
)}
onClick={() => setTrack("exam_prep")}
>
Duolingo/IELTS
</button>
</div>
</div>
{loading ? (
<div className="flex items-center gap-2 rounded-lg border border-grayScale-200 bg-grayScale-100 px-3 py-2 text-xs text-grayScale-500">
<SpinnerIcon className="h-3.5 w-3.5" />
@ -324,56 +273,10 @@ export function UserLearningActivitySection({
</div>
) : null}
{!loading && !error && activity && track === "lms" ? (
<>
<div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-4">
<Metric label="Programs" value={programs.length} />
<Metric label="Completed programs" value={completedIds?.program_ids.length ?? 0} />
<Metric label="Completed courses" value={completedIds?.course_ids.length ?? 0} />
<Metric label="Completed lessons" value={completedIds?.lesson_ids.length ?? 0} />
</div>
<div className="w-full sm:max-w-sm">
<Select
value={selectedProgramId ? String(selectedProgramId) : ""}
onChange={(e) => setSelectedProgramId(e.target.value ? Number(e.target.value) : null)}
disabled={programs.length === 0}
>
<option value="">{programs.length === 0 ? "No programs available" : "Select program..."}</option>
{programs.map((program: LearningActivityProgram) => (
<option key={program.id} value={program.id}>
{program.name}
</option>
))}
</Select>
</div>
{selectedProgram ? (
<div className="space-y-3">
<div className="rounded-xl border border-brand-100 bg-brand-50/40 px-4 py-3">
<p className="text-sm font-semibold text-grayScale-800">{selectedProgram.name}</p>
<div className="mt-2">
<AccessMeta access={selectedProgram.access} />
</div>
</div>
{selectedProgram.courses.length === 0 ? (
<p className="py-6 text-center text-sm text-grayScale-400">No courses in this program.</p>
) : (
selectedProgram.courses.map((course) => (
<CourseBlock key={course.id} course={course} />
))
)}
</div>
) : (
<p className="py-6 text-center text-sm text-grayScale-400">No LMS learning activity yet.</p>
)}
</>
) : null}
{!loading && !error && activity && track === "exam_prep" ? (
{!loading && !error && activity ? (
<>
<div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
<Metric label="Duolingo/IELTS courses" value={catalogCourses.length} />
<Metric label="Catalog courses" value={catalogCourses.length} />
<Metric
label="Accessible courses"
value={catalogCourses.filter((course) => course.access.is_accessible).length}
@ -393,7 +296,7 @@ export function UserLearningActivitySection({
disabled={catalogCourses.length === 0}
>
<option value="">
{catalogCourses.length === 0 ? "No Duolingo/IELTS courses" : "Select Duolingo/IELTS course..."}
{catalogCourses.length === 0 ? "No catalog courses" : "Select catalog course..."}
</option>
{catalogCourses.map((course) => (
<option key={course.id} value={course.id}>
@ -404,9 +307,9 @@ export function UserLearningActivitySection({
</div>
{selectedCatalogCourse ? (
<CourseBlock course={selectedCatalogCourse} examPrep />
<CourseBlock course={selectedCatalogCourse} />
) : (
<p className="py-6 text-center text-sm text-grayScale-400">No Duolingo/IELTS activity yet.</p>
<p className="py-6 text-center text-sm text-grayScale-400">No catalog course activity yet.</p>
)}
</>
) : null}

View File

@ -100,18 +100,6 @@ export interface DashboardPayments {
revenue_last_30_days: DateRevenue[]
}
export interface DashboardCoursesLms {
programs: number
courses: number
modules: number
lessons: number
lessons_with_video: number
practices: number
practices_at_course: number
practices_at_module: number
practices_at_lesson: number
}
export interface DashboardCoursesExamPrep {
catalog_courses: number
units: number
@ -126,7 +114,6 @@ export interface DashboardCourses {
total_courses: number
total_sub_courses: number
total_videos: number
lms?: DashboardCoursesLms
exam_prep?: DashboardCoursesExamPrep
}

View File

@ -159,7 +159,7 @@ export interface CreateProgramCourseResponse {
}
/** Exam prep catalog course row (e.g. IELTS / DET cards) */
export type ExamPrepCatalogCategory = "IELTS" | "DUOLINGO"
export type ExamPrepCatalogCategory = "EDUCATION" | "IELTS" | "DUOLINGO"
export interface ExamPrepCatalogCourseItem {
id: number
@ -1286,6 +1286,19 @@ export type QuestionSetType = "PRACTICE" | "EXAM"
export type QuestionSetStatus = "PUBLISHED" | "DRAFT" | "ARCHIVED"
export type QuestionSetOwnerType = "SUB_COURSE" | "SUB_MODULE" | "COURSE"
export type ExamPrepAssessmentParentKind = "CATALOG_COURSE" | "UNIT" | "MODULE" | "LESSON"
export interface ExamPrepAssessmentParent {
kind: ExamPrepAssessmentParentKind
id: number
}
export interface ExamPrepAssessmentLinkRequest {
question_set_id: number
parent_kind: ExamPrepAssessmentParentKind
parent_id: number
}
export interface QuestionSet {
id: number
title: string

View File

@ -20,8 +20,6 @@ export interface LearningActivityLesson {
export interface LearningActivityModule {
id: number
program_id?: number
course_id?: number
unit_id?: number
name: string
access: LearningActivityAccess
@ -38,7 +36,6 @@ export interface LearningActivityUnit {
export interface LearningActivityCourse {
id: number
program_id?: number
catalog_course_id?: number
name: string
access: LearningActivityAccess
@ -46,32 +43,8 @@ export interface LearningActivityCourse {
units?: LearningActivityUnit[]
}
export interface LearningActivityProgram {
id: number
name: string
access: LearningActivityAccess
courses: LearningActivityCourse[]
}
export interface LearningActivityCompletedIds {
lesson_ids: number[]
module_ids: number[]
course_ids: number[]
program_ids: number[]
}
export interface UserLearningActivityData {
user_id: number
lms: {
completed_ids: LearningActivityCompletedIds
progress: {
programs: LearningActivityProgram[]
}
completions: {
user_id: number
programs: unknown[]
}
}
exam_prep: {
progress: {
catalog_courses: LearningActivityCourse[]