Modules

Students

Students with derived status, progress per enrolment, streaks, weekly study time and a timeline.

composables/useLearning.ts
View in the demo

A student stores enrollments (courseId, enrolledAt, completedLessons) and an activity log (enrolled, lesson, quiz with score, certificate, each with minutes and a local YYYY-MM-DDTHH:mm date). The mock builds that log from each course’s real curriculum. Status (active, atRisk, completed), progress, certificates, quiz average, streak, weekly minutes and spend are derived.

Files

File
Role
pages/learning/students/index.vueThe list.
pages/learning/students/[id].vueThe profile.
composables/useLearning.tsfindStudent, studentSummary, enroll, saveStudent, removeStudents.
composables/useStudentForm.tsThe student and enrol forms.
composables/useStudentTimeline.tsThe timeline items of the profile.
components/pages/learning/LearningStudentQuickView, LearningStudentCourses, LearningStudentStatusChip, LearningEnrollmentCard, LearningStudentFormPanel.

Configuration

STUDENT_VIEWS

The views of the list.

config/learning.config.ts
const STUDENT_VIEWS: StudentView[]

STUDENT_AT_RISK_DAYS

Days without activity before a student is at risk.

config/learning.config.ts
const STUDENT_AT_RISK_DAYS: 14

STUDENT_STATUS_TONES

The tone of each status.

config/learning.config.ts
const STUDENT_STATUS_TONES: Record<StudentStatus, StatusTone>

STUDENT_ACTIVITY_STYLES

The icon of each activity type.

config/learning.config.ts
const STUDENT_ACTIVITY_STYLES: Record<StudentActivityType, { icon: string; color: string; }>

Rules

Pure functions in utils/, unit tested in tests/unit/. Statuses and segments are derived from the stored data, never stored themselves.

studentStatus()

The derived status.

utils/learning.ts
studentStatus(student: Pick<Student, 'enrollments' | 'activity' | 'joinedAt'>, courses: CourseLookup, now: Date): StudentStatus

studentProgress()

Overall progress.

utils/learning.ts
studentProgress(student: Pick<Student, 'enrollments'>, courses: CourseLookup): { done: number; total: number; percent: number; }
Returnsdonetotalpercent

studentStreak()

Study streak.

utils/learning.ts
studentStreak(student: Pick<Student, 'activity'>, now: Date): number

studentWeeklyMinutes()

Minutes per week.

utils/learning.ts
studentWeeklyMinutes(student: Pick<Student, 'activity'>, now: Date, weeks: number): number[]

enrollmentNextLesson()

The next lesson.

utils/learning.ts
enrollmentNextLesson(enrollment: Enrollment, course: CourseOutline): { lesson: CourseLesson; module: CourseModule; moduleIndex: number; } | undefined

How it works

  • The list has no KPI cards: a warning BaseAlert for students at risk (show and send reminder), views as BaseToggleGroup compact fit and a row click that opens LearningStudentQuickView.
  • The profile shows five stats, LearningEnrollmentCards (a BaseStepProgress per module and the next lesson), weekly study time as BaseSparkline type="column", a BaseTimeline and the profile facts.
  • Last activity and other date-only labels use useDayLabel().
© 2026 melsami UI.
Developer documentation for melsami UI.