Modules

Instructors

An instructor directory with invitations, derived stats, revenue by course and a profile page.

composables/useLearning.ts
View in the demo

An instructor stores status (active or invited), joinedAt (the invitation date while invited) and revenueShare. Students, rating, completion, revenue and payout are derived by instructorStats() from their courses.

Files

File
Role
pages/learning/instructors/index.vueThe directory.
pages/learning/instructors/[id].vueThe profile.
composables/useLearning.tsfindInstructor, coursesOf, statsOf, saveInstructor, removeInstructor.
composables/useInstructorForm.tsThe invite and edit form.
composables/useInstructorTiles.tsThe five tiles of the profile.
components/pages/learning/LearningInstructorCard, LearningInstructorInviteCard, LearningInstructorQuickView, LearningInstructorFormPanel, LearningInstructorCoursesCard, LearningInstructorRevenueCard, LearningInstructorReviewsCard, LearningInstructorAboutCard.

Configuration

INSTRUCTOR_VIEWS

The views: all, active and invited.

config/learning.config.ts
const INSTRUCTOR_VIEWS: InstructorView[]

INSTRUCTOR_SORTS

The sorts of the directory.

config/learning.config.ts
const INSTRUCTOR_SORTS: InstructorSort[]

INSTRUCTOR_INVITE_DAYS

Days before an invitation expires.

config/learning.config.ts
const INSTRUCTOR_INVITE_DAYS: 7

INSTRUCTOR_DEFAULT_SHARE

The default revenue share.

config/learning.config.ts
const INSTRUCTOR_DEFAULT_SHARE: 0.7

Rules

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

instructorStats()

The derived stats.

utils/learning.ts
instructorStats(instructor: { id: string; revenueShare: number }, courses: InstructorCourse[]): { courses: number; published: number; drafts: number; students: number; newThisMonth: number; reviews: number; rating: number; completion: number; revenue: number; payout: number;…
ReturnscoursespublisheddraftsstudentsnewThisMonthreviewsratingcompletionrevenuepayout

invitationDaysLeft()

Days left on an invitation.

utils/learning.ts
invitationDaysLeft(invitedAt: string, now: Date): number

instructorViewCounts()

The count of every view.

utils/learning.ts
instructorViewCounts(statuses: InstructorView[]): Record<InstructorView, number>

How it works

  • The directory has views, a sort menu and search above LearningInstructorCards (a BaseStatTiles divided compact strip) and LearningInstructorInviteCards (resend and cancel). Clicking a card opens LearningInstructorQuickView.
  • The profile shows the five tiles from useInstructorTiles(), a courses BaseDataTable, revenue by course as a BaseSegmentBar with a legend, recent reviews and the facts.
  • An instructor with courses cannot be removed.
© 2026 melsami UI.
Developer documentation for melsami UI.