diff --git a/design/payment-logos/cbebirr.svg b/design/payment-logos/cbebirr.svg new file mode 100644 index 0000000..c115831 --- /dev/null +++ b/design/payment-logos/cbebirr.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/design/payment-logos/mastercard.svg b/design/payment-logos/mastercard.svg new file mode 100644 index 0000000..a028a51 --- /dev/null +++ b/design/payment-logos/mastercard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/design/payment-logos/paypal.svg b/design/payment-logos/paypal.svg new file mode 100644 index 0000000..11f8559 --- /dev/null +++ b/design/payment-logos/paypal.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/design/payment-logos/telebirr.svg b/design/payment-logos/telebirr.svg new file mode 100644 index 0000000..15c5bc2 --- /dev/null +++ b/design/payment-logos/telebirr.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/design/payment-logos/visa.svg b/design/payment-logos/visa.svg new file mode 100644 index 0000000..d1d3500 --- /dev/null +++ b/design/payment-logos/visa.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/design/payment-logos/zelle.svg b/design/payment-logos/zelle.svg new file mode 100644 index 0000000..a868d04 --- /dev/null +++ b/design/payment-logos/zelle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/data/src/index.ts b/packages/data/src/index.ts index f081bdd..46829e1 100644 --- a/packages/data/src/index.ts +++ b/packages/data/src/index.ts @@ -32,6 +32,15 @@ export interface Chapter { lessons: Lesson[]; } +/** Multiple-choice check at the end of a chapter or course. `answer` indexes the options, which share an order across locales. */ +export interface Question { id: string; answer: number; translations: Tr<{ prompt: string; options: string[]; explain?: string }> } +export interface Assessment { + id: string; chapterId?: string | null; passPct: number; + translations: Tr<{ title: string; intro?: string }>; + questions: Question[]; +} +export interface AssessmentResult { courseId: string; score: number; total: number; bestPct: number; passed: boolean; attempts: number; answers: number[]; submittedAt: string } + export interface Course { id: string; slug: string; categoryId: string; instructorName: string; instructionLocale: Locale; coverAssetId?: string | null; coverTone?: string; @@ -40,6 +49,7 @@ export interface Course { translations: Tr<{ title: string; subtitle?: string; description: string; audience?: string; outcomes?: string[] }>; prices: Partial>; // integer minor units chapters: Chapter[]; + assessments?: Assessment[]; } export interface Settings { @@ -76,6 +86,7 @@ export interface Student { orders: Record; progress: Record; issues: Record; + assessments?: Record; // assessment id → latest attempt (best score kept) watchSec?: Record; // 'YYYY-MM' → seconds watched (Analytics watch hours) } diff --git a/packages/db/seed/demo-seed.mjs b/packages/db/seed/demo-seed.mjs index b3a13a6..bd7b189 100644 --- a/packages/db/seed/demo-seed.mjs +++ b/packages/db/seed/demo-seed.mjs @@ -17,7 +17,53 @@ cats.forEach(([id, slug, n], i) => put('categories', id, { slug, sortOrder: i + const L = (id, min, t, opts = {}) => ({ id, sortOrder: 0, isPreview: false, isPublished: true, durationSec: min * 60, videoAssetId: null, videoStatus: 'READY', translations: t, ...opts }); const tt = (en, am, om, ti, d) => ({ en: { title: en, description: d?.en }, am: { title: am, description: d?.am }, om: { title: om }, ti: { title: ti } }); const ch = (id, t, s, lessons) => ({ id, sortOrder: 0, translations: Object.fromEntries(Object.entries(t).map(([l, title]) => [l, { title, summary: s[l] }])), lessons: lessons.map((x, i) => ({ ...x, sortOrder: i + 1 })) }); -const order = (c) => ({ ...c, chapters: c.chapters.map((x, i) => ({ ...x, sortOrder: i + 1 })) }); +// Sample assessments (multiple choice). Each option list keeps the same order in every locale; om/ti fall back to English. +const Q = (id, answer, en, am) => ({ id, answer, translations: { en: { prompt: en[0], options: en[1], explain: en[2] }, am: { prompt: am[0], options: am[1], explain: am[2] } } }); +const QUIZZES = { + 'makeup-foundations': [ + { id: 'as-f1', chapterId: 'ch-f1', passPct: 70, translations: { en: { title: 'Skin check', intro: 'Three quick questions on reading skin.' }, am: { title: 'የቆዳ ፈተና', intro: 'ቆዳን ስለማንበብ ሦስት አጭር ጥያቄዎች።' } }, questions: [ + Q('q-f1-1', 0, ['Which light is best for reading undertones?', ['Window daylight', 'A warm bulb', 'Phone flash'], 'Daylight shows true color. Warm bulbs make every skin look golden.'], + ['የቆዳ ቀለም መሠረትን ለማንበብ ምርጡ ብርሃን የትኛው ነው?', ['የመስኮት የቀን ብርሃን', 'ሞቃት አምፖል', 'የስልክ ፍላሽ'], 'የቀን ብርሃን እውነተኛውን ቀለም ያሳያል።']), + Q('q-f1-2', 1, ['The veins on the wrist look green. The undertone is most likely:', ['Cool', 'Warm', 'Neutral'], 'Green-looking veins usually point to a warm undertone.'], + ['በእጅ አንጓ ላይ ያሉት የደም ሥሮች አረንጓዴ ይመስላሉ። የቆዳ ቀለም መሠረቱ ምን ሊሆን ይችላል?', ['ቀዝቃዛ', 'ሞቃት', 'ገለልተኛ'], 'አረንጓዴ የሚመስሉ የደም ሥሮች ብዙውን ጊዜ ሞቃት መሠረትን ያሳያሉ።']), + Q('q-f1-3', 1, ['Which prep is right for oily skin?', ['A heavy cream', 'Cleanse, then a light oil-free moisturizer', 'Skip moisturizer'], 'Oily skin still needs moisture. Choose a light, oil-free one.'], + ['ለቅባታማ ቆዳ ዝግጅት የትኛው ትክክል ነው?', ['ወፍራም ክሬም', 'ማጽዳት፣ ከዚያ ቀላል ቅባት የሌለው እርጥበት', 'እርጥበት አለመጠቀም'], 'ቅባታማ ቆዳም እርጥበት ያስፈልገዋል፤ ቀላልና ቅባት የሌለው ይምረጡ።']), + ] }, + { id: 'as-f2', chapterId: null, passPct: 70, translations: { en: { title: 'Final assessment', intro: 'Four questions from the whole course. You need 70% to pass.' }, am: { title: 'የማጠቃለያ ፈተና', intro: 'ከኮርሱ አራት ጥያቄዎች። ለማለፍ 70% ያስፈልጋል።' } }, questions: [ + Q('q-f2-1', 1, ['Where should you test a foundation shade?', ['Back of the hand', 'Along the jawline, in daylight', 'Forehead, under a lamp'], 'The jawline joins face and neck, and daylight shows the true match.'], + ['የፋውንዴሽን ቀለም የት መሞከር አለበት?', ['በእጅ ጀርባ', 'በመንጋጋ መስመር፣ በቀን ብርሃን', 'በግንባር፣ በመብራት ስር'], 'መንጋጋው ፊትንና አንገትን ያገናኛል፤ የቀን ብርሃን ትክክለኛውን ቀለም ያሳያል።']), + Q('q-f2-2', 0, ['A damp sponge is best for:', ['Pressing product in for a natural finish', 'Packing on thick powder', 'Drawing brows'], 'Pressing (not wiping) blends the base into the skin.'], + ['እርጥብ ስፖንጅ ለምን ይበልጥ ይጠቅማል?', ['ተፈጥሯዊ እንዲመስል ጫን ጫን አድርጎ ለማዋሃድ', 'ወፍራም ፓውደር ለመቀባት', 'ቅንድብ ለመሳል'], 'ጫን ጫን ማድረግ (መጥረግ ሳይሆን) ፋውንዴሽኑን ከቆዳ ጋር ያዋሕዳል።']), + Q('q-f2-3', 1, ['For all-day wear, setting powder goes mostly:', ['Everywhere, thickly', 'On the T-zone and under the eyes', 'Only on the cheeks'], 'Set where skin gets oily or creases; leave the rest fresh.'], + ['ቀኑን ሙሉ እንዲቆይ ፓውደር በብዛት የት ይደረጋል?', ['በፊት ሁሉ፣ በወፍራሙ', 'በግንባር፣ በአፍንጫና ከዓይን ስር', 'በጉንጭ ብቻ'], 'ቆዳ በሚቀባበት ወይም በሚታጠፍበት ቦታ ያድርጉ።']), + Q('q-f2-4', 0, ['A brow should start roughly:', ['In line with the side of the nose', 'At the middle of the eye', 'Above the pupil'], 'Hold a brush along the side of the nose to find the start.'], + ['ቅንድብ በግምት የት ይጀምራል?', ['ከአፍንጫው ጎን ትይዩ', 'ከዓይኑ መሃል', 'ከዓይን ብሌን በላይ'], 'መነሻውን ለማግኘት ብሩሽን ከአፍንጫው ጎን ጋር ትይዩ ይያዙ።']), + ] }, + ], + 'bridal-makeup': [ + { id: 'as-b1', chapterId: null, passPct: 75, translations: { en: { title: 'Bridal final assessment', intro: 'Four questions on planning and long wear. 75% to pass.' }, am: { title: 'የሙሽራ ማጠቃለያ ፈተና', intro: 'ስለ ዕቅድና ረጅም ጊዜ ስለሚቆይ ሜካፕ አራት ጥያቄዎች። ለማለፍ 75% ያስፈልጋል።' } }, questions: [ + Q('q-b1-1', 1, ['When should the bridal trial happen?', ['The morning of the wedding', '2 to 6 weeks before', '6 months before'], 'Close enough to match the final look, early enough to change it.'], + ['የሙሽራ ሙከራ መቼ መደረግ አለበት?', ['በሠርጉ ቀን ጠዋት', 'ከሠርጉ ከ2 እስከ 6 ሳምንት በፊት', 'ከ6 ወር በፊት'], 'ለመጨረሻው ሜካፕ ቅርብ፣ ለመቀየር ግን በቂ ጊዜ ያለው።']), + Q('q-b1-2', 1, ['For flash photography, avoid:', ['Matte setting powder', 'High-SPF foundation that leaves a white cast', 'Waterproof mascara'], 'Some sunscreens reflect flash and show up white in photos.'], + ['ለካሜራ ፍላሽ ምን መወገድ አለበት?', ['ማት ፓውደር', 'በፎቶ ላይ ነጭ የሚያሳይ ብዙ SPF ያለው ፋውንዴሽን', 'ውሃ የማያስገባ ማስካራ'], 'አንዳንድ የፀሐይ መከላከያዎች ፍላሽን አንጸባርቀው በፎቶ ነጭ ይታያሉ።']), + Q('q-b1-3', 0, ['Tears at the melse: which mascara?', ['Waterproof', 'Regular volumizing', 'No mascara'], 'Waterproof formulas survive tears and a long day.'], + ['በመልስ ላይ እንባ ቢመጣ የትኛው ማስካራ ይሻላል?', ['ውሃ የማያስገባ', 'መደበኛ', 'ማስካራ አያስፈልግም'], 'ውሃ የማያስገባ ማስካራ እንባንና ረጅም ቀንን ይቋቋማል።']), + Q('q-b1-4', 0, ['What goes in the touch-up kit you leave with the family?', ['Blotting papers, powder and the lip color', 'A full foundation kit', 'Nothing'], 'Small, simple items anyone can use between ceremonies.'], + ['ለቤተሰቡ በሚተዉት የማስተካከያ ኪት ውስጥ ምን ይገባል?', ['ቅባት መምጠጫ ወረቀት፣ ፓውደርና የከንፈር ቀለም', 'ሙሉ የፋውንዴሽን ኪት', 'ምንም'], 'በሥነ ሥርዓቶች መካከል ማንም ሊጠቀምባቸው የሚችሉ ቀላል ዕቃዎች።']), + ] }, + ], + 'skin-prep-and-care': [ + { id: 'as-s1', chapterId: null, passPct: 70, translations: { en: { title: 'Skin care check', intro: 'Three questions on safe, clean practice.' }, am: { title: 'የቆዳ እንክብካቤ ፈተና', intro: 'ስለ ደህንነቱ የተጠበቀና ንጹሕ አሠራር ሦስት ጥያቄዎች።' } }, questions: [ + Q('q-s1-1', 1, ['A client has a painful rash. What do you do?', ['Cover it with concealer', 'Stop and refer her to a doctor', 'Exfoliate it'], 'Painful or broken skin is a doctor\'s job, not a makeup job.'], + ['ደንበኛዋ የሚያም ሽፍታ አለባት። ምን ያደርጋሉ?', ['በኮንሲለር መሸፈን', 'ማቆምና ወደ ሐኪም መላክ', 'መፋቅ'], 'የሚያም ወይም የተሰነጠቀ ቆዳ የሐኪም ሥራ ነው።']), + Q('q-s1-2', 1, ['Sponges between clients:', ['Wipe and reuse', 'Wash and dry, or use a fresh one', 'Spray with perfume'], 'Bacteria survive a wipe. Wash, dry fully or use a new sponge.'], + ['በደንበኞች መካከል ስፖንጅ እንዴት ይያዛል?', ['በመጥረግ ብቻ እንደገና መጠቀም', 'ማጠብና ማድረቅ፣ ወይም አዲስ መጠቀም', 'ሽቶ መርጨት'], 'ባክቴሪያ በመጥረግ አይጠፋም።']), + Q('q-s1-3', 1, ['Dark spots get worse with:', ['Daily sunscreen', 'Sun without protection', 'A gentle cleanser'], 'Sun is the main trigger for hyperpigmentation.'], + ['የቆዳ መጥቆርን የሚያባብሰው የትኛው ነው?', ['በየቀኑ የፀሐይ መከላከያ', 'ያለ መከላከያ ፀሐይ', 'ለስላሳ ማጽጃ'], 'ፀሐይ የቆዳ መጥቆር ዋና ምክንያት ነው።']), + ] }, + ], +}; +const order = (c) => ({ ...c, chapters: c.chapters.map((x, i) => ({ ...x, sortOrder: i + 1 })), assessments: QUIZZES[c.slug] ?? [] }); const base = { coverAssetId: null, isFeatured: false, isTest: false, sequentialLessons: false, prerequisiteCourseId: null, createdAt: '2026-01-05T08:00:00.000Z' }; put('courses', 'crs-foundations', order({ ...base, slug: 'makeup-foundations', categoryId: 'cat-fundamentals', instructorName: 'Meron Tesfaye', instructionLocale: 'am', coverTone: 'rose', status: 'PUBLISHED', isFeatured: true, publishedAt: '2026-01-10T08:00:00.000Z', updatedAt: '2026-09-02T08:00:00.000Z', prices: { ETB: 120000 }, @@ -125,6 +171,15 @@ people.forEach(([name, phone, email, country, city, locale, joined], i) => { } if (st === 'REFUNDED') s.enrollments[courseId] = { courseId, source: 'PURCHASE', orderId: oid, createdAt: t(day, 11), revokedAt: t(addDays(day, 3)) }; }); + // sample assessment attempts (sample-2 is also the demo visitor's starting point: one failed attempt to retake) + const res = (courseId, score, total, passPct, attempts, day) => ({ courseId, score, total, bestPct: Math.round((score / total) * 100), passed: score / total * 100 >= passPct, attempts, answers: [], submittedAt: t(day, 19) }); + s.assessments = [ + { 'as-f1': res('crs-foundations', 3, 3, 70, 1, '2026-01-20'), 'as-f2': res('crs-foundations', 4, 4, 70, 2, '2026-02-10') }, + { 'as-f1': res('crs-foundations', 2, 3, 70, 1, '2026-02-12'), 'as-s1': res('crs-skin', 3, 3, 70, 1, '2026-03-10') }, + {}, {}, + { 'as-f1': res('crs-foundations', 3, 3, 70, 2, '2026-05-02') }, + {}, {}, {}, + ][i] ?? {}; if (i === 1) s.issues['iss-s2'] = { id: 'iss-s2', type: 'VIDEO', subject: 'Lesson stops on mobile data', description: 'The blending lesson stops every minute on Ethio Telecom 4G in Hawassa.', status: 'OPEN', createdAt: t('2026-09-25', 14), updatedAt: t('2026-09-25', 14) }; if (i === 4) s.issues['iss-s5'] = { id: 'iss-s5', type: 'PAYMENT', subject: 'Paid but bridal course is locked', description: 'Telebirr shows ETB 250 taken but the course did not open.', status: 'IN_PROGRESS', createdAt: t('2026-06-05', 9), updatedAt: t('2026-06-06', 9) }; if (i === 0) s.issues['iss-s1'] = { id: 'iss-s1', type: 'ACCOUNT', subject: 'Change my phone number', description: 'I have a new Safaricom number.', status: 'RESOLVED', resolutionNote: 'Updated on your profile.', createdAt: t('2026-03-02', 9), updatedAt: t('2026-03-03', 9) }; diff --git a/packages/features/src/admin.tsx b/packages/features/src/admin.tsx index afb72fa..a3b2645 100644 --- a/packages/features/src/admin.tsx +++ b/packages/features/src/admin.tsx @@ -9,7 +9,7 @@ import { owns, publishedLessons, publishProblems, ROLE_AREAS, tr, validateLocation, type Area, type Period, } from './domain'; import { LocationFields } from './student'; -import { Cover, Empty, FeedbackButton, fmtDate, fmtDateTime, Icon, Logo, Modal, Skeleton, StatusPill } from './ui'; +import { Cover, Empty, FeedbackButton, fmtDate, fmtDateTime, Icon, Logo, Modal, VIMEO_PLACEHOLDER, Skeleton, StatusPill } from './ui'; const ROLE_LABEL: Record = { SUPER_ADMIN: 'Super admin', CONTENT_MANAGER: 'Content manager', SUPPORT_AGENT: 'Support agent', FINANCE: 'Finance', ANALYST: 'Analyst' }; const NAV: { group: string; items: [Area, string, string][] }[] = [ @@ -491,8 +491,18 @@ function CurriculumTab({ c, set, loc, setLoc, editable }: { c: Course; set(p: Pa ))} {editable && } + {!!c.assessments?.length &&
+
AssessmentsSample quizzes from the seed. Editing questions comes with the production admin.
+
+ {c.assessments.map((a) => { + const rs = students.map((s) => s.assessments?.[a.id]).filter(Boolean); + const ch = c.chapters.find((x) => x.id === a.chapterId); + return ; + })} +
AssessmentPlacementQuestionsPass markTakenPassed
{tr(a.translations, 'en')?.title}{ch ? `After ${tr(ch.translations, 'en')?.title}` : 'End of course'}{a.questions.length}{a.passPct}%{rs.length}{rs.filter((r) => r!.passed).length}
+
} {preview && setPreview(null)}> - {preview.videoAssetId ?