feat(demo): real payment logos, Vimeo placeholder video, new footer, sample assessments

- Telebirr and CBE Birr logos from ethiopianlogos.com; Visa, Mastercard, PayPal and Zelle
  added as checkout methods with their logos (all simulated in ETB)
- Lessons without an upload play a Vimeo placeholder; progress tracked over the player API
- Footer redesigned: wordmark, short story, instructors, makeup-palette art, link columns
- Multiple-choice assessments: seed quizzes for three courses, quiz page with grading and
  review, results on My progress and in admin (student detail, curriculum tab)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kirukib 2026-10-07 14:04:37 +03:00
parent 62ea6de365
commit 1fccdc07c9
19 changed files with 534 additions and 40 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="199" preserveAspectRatio="xMidYMid"><path d="M46.54 198.011V184.84c0-5.05-3.074-8.342-8.343-8.342-2.634 0-5.488.878-7.464 3.732-1.536-2.415-3.731-3.732-7.024-3.732-2.196 0-4.39.658-6.147 3.073v-2.634h-4.61v21.074h4.61v-11.635c0-3.731 1.976-5.488 5.05-5.488 3.072 0 4.61 1.976 4.61 5.488v11.635h4.61v-11.635c0-3.731 2.194-5.488 5.048-5.488 3.074 0 4.61 1.976 4.61 5.488v11.635zm68.271-21.074h-7.463v-6.366h-4.61v6.366h-4.171v4.17h4.17v9.66c0 4.83 1.976 7.683 7.245 7.683 1.976 0 4.17-.658 5.708-1.536l-1.318-3.952c-1.317.878-2.853 1.098-3.951 1.098-2.195 0-3.073-1.317-3.073-3.513v-9.44h7.463zm39.076-.44c-2.634 0-4.39 1.318-5.488 3.074v-2.634h-4.61v21.074h4.61v-11.854c0-3.512 1.536-5.488 4.39-5.488.878 0 1.976.22 2.854.439l1.317-4.39c-.878-.22-2.195-.22-3.073-.22m-59.052 2.196c-2.196-1.537-5.269-2.195-8.562-2.195-5.268 0-8.78 2.634-8.78 6.805 0 3.513 2.634 5.488 7.244 6.147l2.195.22c2.415.438 3.732 1.097 3.732 2.195 0 1.536-1.756 2.634-4.83 2.634s-5.488-1.098-7.025-2.195l-2.195 3.512c2.415 1.756 5.708 2.634 9 2.634 6.147 0 9.66-2.853 9.66-6.805 0-3.732-2.854-5.708-7.245-6.366l-2.195-.22c-1.976-.22-3.512-.658-3.512-1.975 0-1.537 1.536-2.415 3.951-2.415 2.635 0 5.269 1.097 6.586 1.756zm122.495-2.195c-2.635 0-4.391 1.317-5.489 3.073v-2.634h-4.61v21.074h4.61v-11.854c0-3.512 1.537-5.488 4.39-5.488.879 0 1.977.22 2.855.439l1.317-4.39c-.878-.22-2.195-.22-3.073-.22m-58.833 10.976c0 6.366 4.39 10.976 11.196 10.976 3.073 0 5.268-.658 7.463-2.414l-2.195-3.732c-1.756 1.317-3.512 1.975-5.488 1.975-3.732 0-6.366-2.634-6.366-6.805 0-3.951 2.634-6.586 6.366-6.805 1.976 0 3.732.658 5.488 1.976l2.195-3.732c-2.195-1.757-4.39-2.415-7.463-2.415-6.806 0-11.196 4.61-11.196 10.976m42.588 0v-10.537h-4.61v2.634c-1.537-1.975-3.732-3.073-6.586-3.073-5.927 0-10.537 4.61-10.537 10.976s4.61 10.976 10.537 10.976c3.073 0 5.269-1.097 6.586-3.073v2.634h4.61zm-16.904 0c0-3.732 2.415-6.805 6.366-6.805 3.732 0 6.367 2.854 6.367 6.805 0 3.732-2.635 6.805-6.367 6.805-3.951-.22-6.366-3.073-6.366-6.805m-55.1-10.976c-6.147 0-10.538 4.39-10.538 10.976s4.39 10.976 10.757 10.976c3.073 0 6.147-.878 8.562-2.853l-2.196-3.293c-1.756 1.317-3.951 2.195-6.146 2.195-2.854 0-5.708-1.317-6.367-5.05h15.587v-1.755c.22-6.806-3.732-11.196-9.66-11.196m0 3.951c2.853 0 4.83 1.757 5.268 5.05h-10.976c.439-2.854 2.415-5.05 5.708-5.05m114.372 7.025v-18.879h-4.61v10.976c-1.537-1.975-3.732-3.073-6.586-3.073-5.927 0-10.537 4.61-10.537 10.976s4.61 10.976 10.537 10.976c3.074 0 5.269-1.097 6.586-3.073v2.634h4.61zm-16.903 0c0-3.732 2.414-6.805 6.366-6.805 3.732 0 6.366 2.854 6.366 6.805 0 3.732-2.634 6.805-6.366 6.805-3.952-.22-6.366-3.073-6.366-6.805m-154.107 0v-10.537h-4.61v2.634c-1.537-1.975-3.732-3.073-6.586-3.073-5.927 0-10.537 4.61-10.537 10.976s4.61 10.976 10.537 10.976c3.074 0 5.269-1.097 6.586-3.073v2.634h4.61zm-17.123 0c0-3.732 2.415-6.805 6.366-6.805 3.732 0 6.367 2.854 6.367 6.805 0 3.732-2.635 6.805-6.367 6.805-3.951-.22-6.366-3.073-6.366-6.805"/><path fill="#FF5F00" d="M93.298 16.903h69.15v124.251h-69.15z"/><path fill="#EB001B" d="M97.689 79.029c0-25.245 11.854-47.637 30.074-62.126C114.373 6.366 97.47 0 79.03 0 35.343 0 0 35.343 0 79.029s35.343 79.029 79.029 79.029c18.44 0 35.343-6.366 48.734-16.904-18.22-14.269-30.074-36.88-30.074-62.125"/><path fill="#F79E1B" d="M255.746 79.029c0 43.685-35.343 79.029-79.029 79.029-18.44 0-35.343-6.366-48.734-16.904 18.44-14.488 30.075-36.88 30.075-62.125s-11.855-47.637-30.075-62.126C141.373 6.366 158.277 0 176.717 0c43.686 0 79.03 35.563 79.03 79.029"/></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="302" preserveAspectRatio="xMidYMid"><path fill="#27346A" d="M217.168 23.507C203.234 7.625 178.046.816 145.823.816h-93.52A13.39 13.39 0 0 0 39.076 12.11L.136 259.077c-.774 4.87 2.997 9.28 7.933 9.28h57.736l14.5-91.971-.45 2.88c1.033-6.501 6.593-11.296 13.177-11.296h27.436c53.898 0 96.101-21.892 108.429-85.221.366-1.873.683-3.696.957-5.477q-2.334-1.236 0 0c3.671-23.407-.025-39.34-12.686-53.765"/><path fill="#27346A" d="M102.397 68.84a11.7 11.7 0 0 1 5.053-1.14h73.318c8.682 0 16.78.565 24.18 1.756a102 102 0 0 1 6.177 1.182 90 90 0 0 1 8.59 2.347c3.638 1.215 7.026 2.63 10.14 4.287 3.67-23.416-.026-39.34-12.687-53.765C203.226 7.625 178.046.816 145.823.816H52.295C45.71.816 40.108 5.61 39.076 12.11L.136 259.068c-.774 4.878 2.997 9.282 7.925 9.282h57.744L95.888 77.58a11.72 11.72 0 0 1 6.509-8.74"/><path fill="#2790C3" d="M228.897 82.749c-12.328 63.32-54.53 85.221-108.429 85.221H93.024c-6.584 0-12.145 4.795-13.168 11.296L61.817 293.621c-.674 4.262 2.622 8.124 6.934 8.124h48.67a11.71 11.71 0 0 0 11.563-9.88l.474-2.48 9.173-58.136.591-3.213a11.71 11.71 0 0 1 11.562-9.88h7.284c47.147 0 84.064-19.154 94.852-74.55 4.503-23.15 2.173-42.478-9.739-56.054-3.613-4.112-8.1-7.508-13.327-10.28-.283 1.79-.59 3.604-.957 5.477"/><path fill="#1F264F" d="M216.952 72.128a90 90 0 0 0-5.818-1.49 110 110 0 0 0-6.177-1.174c-7.408-1.199-15.5-1.765-24.19-1.765h-73.309a11.6 11.6 0 0 0-5.053 1.149 11.68 11.68 0 0 0-6.51 8.74l-15.582 98.798-.45 2.88c1.025-6.501 6.585-11.296 13.17-11.296h27.444c53.898 0 96.1-21.892 108.428-85.221.367-1.873.675-3.688.958-5.477q-4.682-2.47-10.14-4.279a83 83 0 0 0-2.77-.865"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="682.667" height="682.667"><path d="M510.68 657.133c-73.803-10.748-127.896-64.936-138.854-139.098-2.308-15.626-1.985-42.115.692-56.75.738-4.033 4.673-26.233 8.744-49.333s11.297-64.076 16.059-91.058 9.559-50.8 10.66-52.93 4.207-5.555 6.9-7.61l4.898-3.735h289.093l3.891 4.355c7.26 8.126 4.293 20.558-6.672 27.947-4.488 3.025-4.617 3.031-56.635 3.035-56.63.004-68.121.858-91.154 6.77-54.666 14.034-106.667 56.885-132.293 109.016-31.605 64.292-23.696 132.948 20.305 176.26C488.5 625.526 554.8 634.31 611.46 605.876c51.72-25.953 86.529-85.107 78.002-132.554-6.795-37.814-38.98-63.916-78.93-64.014-39.098-.096-78.008 31.406-86.624 70.133-7.097 31.899 10.08 57.144 41.205 60.561 7.876.865 9.978 1.633 12.504 4.569 3.52 4.091 3.806 7.357 1.104 12.582-3.564 6.891-7.862 8.566-19.954 7.775-24.843-1.625-44.43-14.548-55.31-36.494-14.71-29.663-4.237-73.557 25.048-104.983 14.444-15.5 40.513-31.09 60.814-36.37 12.631-3.283 40.385-3.232 52.664.098 40.7 11.039 67.39 40.883 73.416 82.098 4.171 28.531-5.985 69.309-24.77 99.447-27.92 44.797-76.263 78.131-127.369 87.826-11.828 2.244-39.096 2.546-52.58.582M307.74 474c-2.336-1.016-5.26-3.807-6.5-6.203-1.97-3.812-2.065-5.7-.751-15.1 9.842-70.436-25.966-131.726-89.2-152.678-12.573-4.166-24.206-6.37-39.302-7.445-7.333-.522-14.855-1.725-16.714-2.672-4.938-2.517-7.098-7.45-6.313-14.415.863-7.654 5.33-13.862 12.228-16.995 5.165-2.346 10.705-2.483 100.799-2.506 92.169-.024 95.475.062 99.594 2.573 8.775 5.351 9.026 2.524-9.485 107.056-9.187 51.881-17.563 95.981-18.613 98-2.614 5.025-7.287 9.007-12.695 10.818-5.74 1.923-7.788 1.855-13.048-.433m117.317-256.978c-2.962-1.431-7.07-8.475-7.07-12.123 0-5.868 33.755-191.228 35.404-194.418 3.14-6.073 10.851-10.53 18.218-10.53 5.123 0 7.17.747 10.69 3.9 4.312 3.862 4.348 3.998 3.716 13.667-.35 5.372-.623 19.367-.605 31.1.028 17.906.52 23.154 3.064 32.667 6.831 25.54 16.898 43.503 34.1 60.844 18.719 18.87 37.964 29.837 64.144 36.553 10.591 2.718 16.215 3.15 49.936 3.833 41.722.845 42.194.94 46.092 9.153 2.513 5.295 1.636 10.927-2.762 17.742-6.292 9.75 1.409 9.219-132.199 9.118-81.598-.062-120.732-.542-122.728-1.506" style="fill:#0172bb;stroke-width:1.33333" transform="translate(-87.77 13.021)"/></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="83" preserveAspectRatio="xMidYMid"><defs><linearGradient id="a" x1="45.974%" x2="54.877%" y1="-2.006%" y2="100%"><stop offset="0%" stop-color="#222357"/><stop offset="100%" stop-color="#254AA5"/></linearGradient></defs><path fill="url(#a)" d="M132.397 56.24c-.146-11.516 10.263-17.942 18.104-21.763 8.056-3.92 10.762-6.434 10.73-9.94-.06-5.365-6.426-7.733-12.383-7.825-10.393-.161-16.436 2.806-21.24 5.05l-3.744-17.519c4.82-2.221 13.745-4.158 23-4.243 21.725 0 35.938 10.724 36.015 27.351.085 21.102-29.188 22.27-28.988 31.702.069 2.86 2.798 5.912 8.778 6.688 2.96.392 11.131.692 20.395-3.574l3.636 16.95c-4.982 1.814-11.385 3.551-19.357 3.551-20.448 0-34.83-10.87-34.946-26.428m89.241 24.968c-3.967 0-7.31-2.314-8.802-5.865L181.803 1.245h21.709l4.32 11.939h26.528l2.506-11.939H256l-16.697 79.963zm3.037-21.601 6.265-30.027h-17.158zm-118.599 21.6L88.964 1.246h20.687l17.104 79.963zm-30.603 0L53.941 26.782l-8.71 46.277c-1.022 5.166-5.058 8.149-9.54 8.149H.493L0 78.886c7.226-1.568 15.436-4.097 20.41-6.803 3.044-1.653 3.912-3.098 4.912-7.026L41.819 1.245H63.68l33.516 79.963z" transform="matrix(1 0 0 -1 0 82.668)"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="#6D1ED4" viewBox="0 0 24 24"><path d="M13.559 24h-2.841a.483.483 0 0 1-.483-.483v-2.765H5.638a.667.667 0 0 1-.666-.666v-2.234a.67.67 0 0 1 .142-.412l8.139-10.382h-7.25a.667.667 0 0 1-.667-.667V3.914c0-.367.299-.666.666-.666h4.23V.483c0-.266.217-.483.483-.483h2.841c.266 0 .483.217.483.483v2.765h4.323c.367 0 .666.299.666.666v2.137a.67.67 0 0 1-.141.41l-8.19 10.481h7.665c.367 0 .666.299.666.666v2.477a.667.667 0 0 1-.666.667h-4.32v2.765a.483.483 0 0 1-.483.483"/></svg>

After

Width:  |  Height:  |  Size: 515 B

View File

@ -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<Record<Currency, number>>; // integer minor units
chapters: Chapter[];
assessments?: Assessment[];
}
export interface Settings {
@ -76,6 +86,7 @@ export interface Student {
orders: Record<string, Order>;
progress: Record<string, LessonProgress>;
issues: Record<string, Issue>;
assessments?: Record<string, AssessmentResult>; // assessment id → latest attempt (best score kept)
watchSec?: Record<string, number>; // 'YYYY-MM' → seconds watched (Analytics watch hours)
}

View File

@ -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) };

View File

@ -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<AdminRole, string> = { 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
</fieldset>
))}
{editable && <button className="btn btn-ghost" style={{ alignSelf: 'flex-start' }} onClick={() => put([...chapters, { id: newId('ch_'), sortOrder: chapters.length + 1, translations: { en: { title: 'New chapter' } }, lessons: [] }])}><Icon name="plus" size={16} />Add chapter</button>}
{!!c.assessments?.length && <div className="chapter-box">
<div className="row-between"><strong>Assessments</strong><span className="small muted">Sample quizzes from the seed. Editing questions comes with the production admin.</span></div>
<div className="tbl-wrap" style={{ border: 0 }}><table className="tbl"><thead><tr><th>Assessment</th><th>Placement</th><th className="r">Questions</th><th className="r">Pass mark</th><th className="r">Taken</th><th className="r">Passed</th></tr></thead><tbody>
{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 <tr key={a.id}><td>{tr(a.translations, 'en')?.title}</td><td>{ch ? `After ${tr(ch.translations, 'en')?.title}` : 'End of course'}</td><td className="r num">{a.questions.length}</td><td className="r num">{a.passPct}%</td><td className="r num">{rs.length}</td><td className="r num">{rs.filter((r) => r!.passed).length}</td></tr>;
})}
</tbody></table></div>
</div>}
{preview && <Modal title={tr(preview.translations, 'en')?.title ?? 'Preview'} onClose={() => setPreview(null)}>
{preview.videoAssetId ? <video src={ds.assetUrl(preview.videoAssetId)} controls style={{ width: '100%', borderRadius: 12 }} /> : <div className="screen"><div className="sim"><h2>{tr(preview.translations, 'am')?.title ?? tr(preview.translations, 'en')?.title}</h2><p className="muted small">Sample playback. Upload a clip to replace it.</p></div></div>}
{preview.videoAssetId ? <video src={ds.assetUrl(preview.videoAssetId)} controls style={{ width: '100%', borderRadius: 12 }} /> : <div className="stack-sm"><div className="screen"><iframe src={VIMEO_PLACEHOLDER} title={tr(preview.translations, 'en')?.title ?? 'Sample video'} allow="autoplay; fullscreen; picture-in-picture" allowFullScreen /></div><p className="muted small">Sample video from Vimeo. Upload a clip to replace it.</p></div>}
</Modal>}
</div>
);
@ -682,6 +692,9 @@ function StudentDetail({ id }: { id: string }) {
{manage && <div className="row"><select className="input grow" aria-label="Course to grant" value={grant} onChange={(e) => setGrant(e.target.value)}><option value="">Choose a course to grant…</option>{courses.filter((c) => !c.isTest && !owns(s, c.id)).map((c) => <option key={c.id} value={c.id}>{en(c)}</option>)}</select><button className="btn" disabled={!grant} onClick={doGrant}>Grant access</button></div>}
</div>
{can.seeRevenue(adminRole) || adminRole === 'SUPPORT_AGENT' ? <div className="a-card"><h2>Orders</h2><OrderTable rows={Object.values(s.orders ?? {}).map((o) => ({ s, o }))} /></div> : null}
<div className="a-card"><h2>Assessments</h2>{Object.keys(s.assessments ?? {}).length ? <div className="tbl-wrap" style={{ border: 0 }}><table className="tbl"><thead><tr><th>Assessment</th><th className="r">Last score</th><th className="r">Best</th><th className="r">Attempts</th><th>Result</th></tr></thead><tbody>
{Object.entries(s.assessments ?? {}).map(([aid, r]) => { const c = courses.find((x) => x.id === r.courseId); const a = c?.assessments?.find((x) => x.id === aid); return <tr key={aid}><td>{a ? tr(a.translations, 'en')?.title : aid}<div className="small muted">{c ? en(c) : r.courseId} · {fmtDate(r.submittedAt)}</div></td><td className="r num">{r.score}/{r.total}</td><td className="r num">{r.bestPct}%</td><td className="r num">{r.attempts}</td><td><span className={`pill ${r.passed ? 'pill-ok' : 'pill-warn'}`}>{r.passed ? 'passed' : 'not passed'}</span></td></tr>; })}
</tbody></table></div> : <p className="muted">No assessments taken.</p>}</div>
<div className="a-card"><h2>Reported issues</h2>{Object.values(s.issues ?? {}).length ? Object.values(s.issues).map((i) => <div key={i.id} className="row-between" style={{ borderTop: '1px solid var(--line)', paddingTop: 8 }}><span>{i.subject}<span className="small muted"> · {fmtDate(i.createdAt)}</span></span><StatusPill status={i.status} /></div>) : <p className="muted">No reports.</p>}</div>
</div>
<div className="a-card"><h2>Profile</h2>

View File

@ -1,7 +1,7 @@
// Runnable check for the money/access rules: `pnpm test`. Test IDs from SPEC §13.2.
import assert from 'node:assert/strict';
import type { Course, Student } from '@lms/data';
import { applyHeartbeat, applyPaymentEvent, createOrder, dashboardMetrics, effectiveStatus, isStudentVisible, lessonAccess, publishProblems, validateLocation, validPassword } from './domain.ts';
import { applyHeartbeat, DomainError, gradeAssessment, applyPaymentEvent, createOrder, dashboardMetrics, effectiveStatus, isStudentVisible, lessonAccess, publishProblems, validateLocation, validPassword } from './domain.ts';
const lesson = (id: string, extra = {}) => ({ id, sortOrder: Number(id.slice(-1)), isPreview: false, isPublished: true, durationSec: 100, videoStatus: 'READY' as const, translations: { en: { title: id } }, ...extra });
const course = (id: string, extra: Partial<Course> = {}): Course => ({
@ -79,4 +79,13 @@ assert.ok(validPassword('abcdefgh')); assert.ok(!validPassword('short'));
assert.equal(validateLocation('ET', 'Nairobi'), 'CITY_NOT_IN_LIST');
assert.equal(validateLocation('KE', 'Nairobi'), null);
// assessments: grading, best score kept, a pass is never lost, incomplete attempts rejected
const quiz = { id: 'q', passPct: 70, translations: { en: { title: 'Q' } }, questions: [0, 1, 2].map((answer, i) => ({ id: 'q' + i, answer, translations: { en: { prompt: 'p', options: ['a', 'b', 'c'] } } })) };
const g1 = gradeAssessment(A, quiz, [0, 1, 2], undefined, now);
assert.deepEqual([g1.score, g1.total, g1.bestPct, g1.passed, g1.attempts], [3, 3, 100, true, 1]);
const g2 = gradeAssessment(A, quiz, [0, 0, 0], g1, now);
assert.deepEqual([g2.score, g2.bestPct, g2.passed, g2.attempts], [1, 100, true, 2]);
assert.equal(gradeAssessment(A, quiz, [1, 1, 1], undefined, now).passed, false);
assert.throws(() => gradeAssessment(A, quiz, [0, 1], undefined, now), DomainError);
console.log('domain checks: all passed');

View File

@ -1,5 +1,5 @@
// Pure business rules shared by demo and production screens. No React, no I/O.
import type { Course, Currency, Lesson, LessonProgress, Locale, Order, OrderStatus, Student, Tr, AdminRole } from '@lms/data';
import type { Assessment, AssessmentResult, Course, Currency, Lesson, LessonProgress, Locale, Order, OrderStatus, Student, Tr, AdminRole } from '@lms/data';
export const ORDER_TTL_MS = 30 * 60 * 1000;
export const COMPLETE_AT = 0.9;
@ -92,6 +92,15 @@ export function applyHeartbeat(prev: LessonProgress | undefined, courseId: strin
export class DomainError extends Error { code: string; constructor(code: string) { super(code); this.code = code; } }
/** Score an attempt and fold it into the previous result: best score and a pass are kept, attempts are counted. */
export function gradeAssessment(c: Course, a: Assessment, answers: number[], prev: AssessmentResult | undefined, now: Date): AssessmentResult {
const total = a.questions.length;
if (answers.length !== total || answers.some((x) => !Number.isInteger(x) || x < 0)) throw new DomainError('INCOMPLETE');
const score = a.questions.filter((q, i) => answers[i] === q.answer).length;
const pct = total ? Math.round((score / total) * 100) : 0;
return { courseId: c.id, score, total, bestPct: Math.max(pct, prev?.bestPct ?? 0), passed: !!prev?.passed || pct >= a.passPct, attempts: (prev?.attempts ?? 0) + 1, answers, submittedAt: now.toISOString() };
}
export function effectiveStatus(o: Order, now = Date.now()): OrderStatus {
return o.status === 'PENDING' && Date.parse(o.expiresAt) < now ? 'EXPIRED' : o.status;
}

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,25 @@
'use client';
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';
import { useTranslations } from 'next-intl';
import type { Course, Issue, IssueType, Lesson, Locale, Order, Student } from '@lms/data';
import type { Assessment, AssessmentResult, Course, Issue, IssueType, Lesson, Locale, Order, Student } from '@lms/data';
import { LOCALES, newId } from '@lms/data';
import { LOCALE_NAMES, DRAFT_LOCALES } from '@lms/i18n';
import { lookup, useApp } from './store';
import {
applyHeartbeat, applyPaymentEvent, clock, COUNTRIES, courseDuration, courseProgress, createOrder, DomainError, effectiveStatus,
ET_CITIES, formatDuration, formatMoney, isCompleted, isStudentVisible, lessonAccess, owns, publishedLessons, resumePoint, tr, validateLocation, validPassword,
ET_CITIES, formatDuration, formatMoney, gradeAssessment, isCompleted, isStudentVisible, lessonAccess, owns, publishedLessons, resumePoint, tr, validateLocation, validPassword,
} from './domain';
import { CopyText, Cover, Empty, FeedbackButton, fmtDate, Icon, Logo, Modal, Ring, Skeleton, StatusPill } from './ui';
import { CopyText, Cover, Empty, FeedbackButton, fmtDate, Icon, Logo, MakeupBox, Modal, VIMEO_ORIGIN, VIMEO_PLACEHOLDER, Ring, Skeleton, StatusPill } from './ui';
import { PAY_LOGOS } from './payLogos';
const ISSUE_TYPES: IssueType[] = ['BUG', 'PAYMENT', 'VIDEO', 'ACCOUNT', 'CONTENT', 'OTHER'];
const METHODS = [{ id: 'TELEBIRR', name: 'Telebirr' }, { id: 'CBE_BIRR', name: 'CBE Birr' }];
// Demo checkout lists every method we plan to accept; all of them run through the same simulated ETB order.
const METHODS = [
{ id: 'TELEBIRR', name: 'Telebirr', via: 'ArifPay' }, { id: 'CBE_BIRR', name: 'CBE Birr', via: 'ArifPay' },
{ id: 'VISA', name: 'Visa', via: 'ArifPay' }, { id: 'MASTERCARD', name: 'Mastercard', via: 'ArifPay' },
{ id: 'PAYPAL', name: 'PayPal', via: 'International' }, { id: 'ZELLE', name: 'Zelle', via: 'International' },
];
const PayLogo = ({ id }: { id: string }) => <span className="pay-mark"><img src={PAY_LOGOS[id]} alt="" /></span>;
const methodName = (id: string) => METHODS.find((m) => m.id === id)?.name ?? id;
// ---------------------------------------------------------------- helpers
@ -137,19 +144,36 @@ function UserMenu() {
function Footer() {
const t = useTranslations();
const { settings, locale, nav, setLocale, categories, viewer } = useApp();
const { settings, locale, nav, setLocale, categories, courses, viewer, signedIn, me } = useApp();
const instructors = [...new Set(courses.filter((c) => isStudentVisible(c, me) && !c.isTest).map((c) => c.instructorName))].slice(0, 3);
const go = (p: string) => nav(`/${locale}${p}`);
return (
<footer className="foot">
<div className="foot-in">
<div className="stack-sm"><strong style={{ color: 'var(--ink)' }}>{settings.brandName}</strong><p>{t('landing.footer')}</p></div>
<div className="stack-sm"><h3>{t('nav.courses')}</h3>{categories.filter((c) => c.isActive).map((c) => <button key={c.id} onClick={() => nav(`/${locale}/courses/${c.slug}`)}>{tr(c.translations, locale)?.name}</button>)}</div>
<div className="stack-sm"><h3>{t('help.contact')}</h3>
<a href={settings.telegramLink} target="_blank" rel="noreferrer">{t('help.telegram')}</a>
<span className="num">{t('help.call')}: {settings.supportPhone}</span>
<button onClick={() => nav(`/${locale}/help`)}>{t('nav.help')}</button>
{viewer?.canEdit && <button onClick={() => nav('/admin')}>{t('nav.admin')}</button>}
<div className="foot-wrap">
<div className="foot-top">
<div className="foot-story">
<h2 className="foot-word">{settings.brandName}</h2>
<p className="foot-tag">{t('footer.tagline')}</p>
<p className="foot-desc">{t('landing.footer')}</p>
{instructors.length > 0 && <ul className="foot-people">{instructors.map((n) => <li key={n}><strong>{n}</strong><span>{t('footer.instructors')}</span></li>)}</ul>}
</div>
<MakeupBox />
</div>
<div className="stack-sm"><h3>{t('common.language')}</h3>{LOCALES.map((l) => <button key={l} lang={l} aria-current={l === locale} onClick={() => setLocale(l)}>{LOCALE_NAMES[l]}</button>)}</div>
<nav className="foot-cols" aria-label="Footer">
<div><h3>{t('nav.courses')}</h3>{categories.filter((c) => c.isActive).map((c) => <button key={c.id} onClick={() => go(`/courses/${c.slug}`)}>{tr(c.translations, locale)?.name}</button>)}</div>
<div><h3>{t('footer.learn')}</h3>
<button onClick={() => go('/courses')}>{t('catalog.title')}</button>
{signedIn && <button onClick={() => go('/progress')}>{t('nav.progress')}</button>}
<button onClick={() => go('/help')}>{t('nav.help')}</button>
</div>
<div><h3>{t('footer.support')}</h3>
<a href={settings.telegramLink} target="_blank" rel="noreferrer">{t('help.telegram')}</a>
<span className="num">{settings.supportPhone}</span>
{viewer?.canEdit && <button onClick={() => nav('/admin')}>{t('nav.admin')}</button>}
</div>
<div><h3>{t('common.language')}</h3>{LOCALES.map((l) => <button key={l} lang={l} aria-current={l === locale} onClick={() => setLocale(l)}>{LOCALE_NAMES[l]}</button>)}</div>
</nav>
<div className="foot-base"><Logo size={22} /><span>© {new Date().getFullYear()} {settings.brandName}</span><span className="foot-rights">{t('footer.rights')}</span></div>
</div>
</footer>
);
@ -163,6 +187,7 @@ function StudentRoutes() {
case 'courses': return <Catalog categorySlug={a} />;
case 'course': return <CoursePage slug={a} />;
case 'learn': return <Player slug={a} lessonId={b} />;
case 'assess': return <SignInGate><AssessmentPage slug={a} id={b} /></SignInGate>;
case 'checkout': return <SignInGate><Checkout slug={a} /></SignInGate>;
case 'pay': return <SignInGate><ProviderSim orderId={a} /></SignInGate>;
case 'orders': return <SignInGate><OrderStatusPage orderId={a} /></SignInGate>;
@ -247,7 +272,7 @@ function Landing() {
<section className="how-panel">
<div className="stack"><h2>{t('landing.howTitle')}</h2><ol className="steps"><li>{t('landing.how1')}</li><li>{t('landing.how2')}</li><li>{t('landing.how3')}</li></ol></div>
<div className="stack-sm"><h3>{t('landing.payTitle')}</h3><div className="pay-logos">{METHODS.map((m) => <span key={m.id} className="pay-logo"><span className="pay-ic" aria-hidden>{m.name[0]}</span>{m.name}</span>)}</div></div>
<div className="stack-sm"><h3>{t('landing.payTitle')}</h3><div className="pay-logos">{METHODS.map((m) => <span key={m.id} className="pay-logo"><PayLogo id={m.id} />{m.name}</span>)}</div></div>
</section>
<section className="cta-band">
@ -437,6 +462,10 @@ function CoursePage({ slug }: { slug?: string }) {
</details>
);
})}
{!!c.assessments?.length && <details className="ch" open>
<summary><span className="grow"><strong>{t('assess.title')}</strong><span className="small muted num">{c.assessments.filter((a) => me?.assessments?.[a.id]?.passed).length}/{c.assessments.length}</span></span><Icon name="down" size={18} /></summary>
{c.assessments.map((a) => <AssessmentRow key={a.id} c={c} a={a} />)}
</details>}
</div>
</aside>
</div>
@ -460,6 +489,109 @@ function LessonRow({ c, l, current }: { c: Course; l: Lesson; current?: boolean
);
}
// ---------------------------------------------------------------- assessments
function AssessmentRow({ c, a }: { c: Course; a: Assessment }) {
const t = useTranslations();
const { me, locale, nav } = useApp();
const r = me?.assessments?.[a.id];
const ch = a.chapterId ? c.chapters.find((x) => x.id === a.chapterId) : undefined;
const where = ch ? t('assess.chapter', { chapter: tr(ch.translations, locale)?.title ?? '' }) : t('assess.final');
return (
<button className="lesson-row" onClick={() => nav(`/${locale}/assess/${c.slug}/${a.id}`)}>
<span className={`ic ${r?.passed ? 'done' : ''}`}>{r?.passed ? <Icon name="check" size={14} /> : owns(me, c.id) ? <Icon name="quiz" size={14} /> : <Icon name="lock" size={14} />}</span>
<span className="grow"><span style={{ display: 'block', fontWeight: 700 }}>{tr(a.translations, locale)?.title}</span>
<span className="small muted num">{where} · {t('assess.questions', { n: a.questions.length })}</span>
{r && <span className={`small num ${r.passed ? 'quiz-ok' : 'quiz-todo'}`}>{r.passed ? t('assess.passed') : t('assess.notPassed')} · {t('assess.best', { pct: r.bestPct })}</span>}</span>
<Icon name="chevron" size={16} />
</button>
);
}
function AssessmentPage({ slug, id }: { slug?: string; id?: string }) {
const t = useTranslations();
const { courses, me, locale, nav, ds, write, catalogLoaded, toast } = useApp();
const c = courses.find((x) => x.slug === slug);
const a = c?.assessments?.find((x) => x.id === id);
const [answers, setAnswers] = useState<number[]>([]);
const [result, setResult] = useState<AssessmentResult | null>(null);
const [busy, setBusy] = useState(false);
const top = useRef<HTMLDivElement>(null);
if (!catalogLoaded) return <Skeleton h={260} n={2} />;
if (!c || !a || !me) return <Empty action={<button className="btn" onClick={() => nav(`/${locale}/courses`)}>{t('catalog.title')}</button>}>{t('assess.notFound')}</Empty>;
const text = tr(a.translations, locale);
const back = () => nav(`/${locale}/course/${c.slug}`);
if (!owns(me, c.id)) return <Empty action={<button className="btn btn-accent" onClick={back}>{ct(c, locale).title}</button>}>{t('assess.locked')}</Empty>;
const prev = me.assessments?.[a.id];
const done = a.questions.filter((_, i) => answers[i] != null).length;
const submit = async () => {
setBusy(true);
try {
const r = gradeAssessment(c, a, a.questions.map((_, i) => answers[i] ?? -1), prev, new Date());
if (await write(() => ds.patchStudent(me.id, { assessments: { [a.id]: r } }))) { setResult(r); toast(t('assess.saved')); top.current?.scrollIntoView({ behavior: 'smooth' }); }
} catch { /* INCOMPLETE: the button is disabled until every question is answered */ }
setBusy(false);
};
const retake = () => { setAnswers([]); setResult(null); top.current?.scrollIntoView({ behavior: 'smooth' }); };
const pct = result ? Math.round((result.score / result.total) * 100) : 0;
return (
<section className="quiz" ref={top}>
<nav className="crumbs" aria-label="Breadcrumb">
<button onClick={() => nav(`/${locale}/courses`)}>{t('nav.courses')}</button><Icon name="chevron" size={14} />
<button onClick={back}>{ct(c, locale).title}</button><Icon name="chevron" size={14} />
<button aria-current="page">{text?.title}</button>
</nav>
<header className="quiz-head">
<span className="quiz-ic"><Icon name="quiz" size={22} /></span>
<div className="stack-sm grow">
<h1>{text?.title}</h1>
{text?.intro && <p className="muted">{text.intro}</p>}
<div className="row small muted num"><span>{t('assess.questions', { n: a.questions.length })}</span><span>·</span><span>{t('assess.passMark', { pct: a.passPct })}</span>
{prev && <><span>·</span><span>{t('assess.best', { pct: prev.bestPct })}</span><span>·</span><span>{t('assess.attempts', { n: prev.attempts })}</span></>}</div>
</div>
</header>
{result && (
<div className={`quiz-result ${pct >= a.passPct ? 'ok' : 'bad'}`} role="status">
<Ring pct={pct} />
<div className="grow stack-sm"><strong>{pct >= a.passPct ? t('assess.wellDone') : t('assess.tryAgain', { pct: a.passPct })}</strong><span className="small num">{t('assess.score', { score: result.score, total: result.total })} · {t('assess.best', { pct: result.bestPct })}</span></div>
<div className="row"><button className="btn btn-ghost btn-sm" onClick={retake}>{t('assess.retake')}</button><button className="btn btn-sm" onClick={back}>{t('assess.back')}</button></div>
</div>
)}
<ol className="quiz-list">
{a.questions.map((q, i) => {
const qt = tr(q.translations, locale);
if (!qt) return null;
return (
<li key={q.id} className="quiz-q">
<fieldset disabled={!!result}>
<legend><span className="quiz-n num">{i + 1}</span>{qt.prompt}</legend>
<div className="quiz-opts">
{qt.options.map((o, k) => {
const state = !result ? '' : k === q.answer ? 'right' : answers[i] === k ? 'wrong' : '';
return (
<label key={k} className={`quiz-opt ${state}`}>
<input type="radio" name={q.id} checked={answers[i] === k} onChange={() => setAnswers((x) => { const n = [...x]; n[i] = k; return n; })} />
<span className="grow">{o}</span>
{state === 'right' && <span className="pill pill-ok"><Icon name="check" size={12} />{t('assess.correct')}</span>}
{state === 'wrong' && <span className="pill pill-bad">{t('assess.wrong')}</span>}
</label>
);
})}
</div>
{result && qt.explain && <p className="quiz-explain small">{qt.explain}</p>}
</fieldset>
</li>
);
})}
</ol>
{!result && <div className="quiz-foot">
<span className="small muted num">{done < a.questions.length ? t('assess.answerAll', { done, total: a.questions.length }) : ''}</span>
<button className="btn btn-accent" disabled={busy || done < a.questions.length} onClick={submit}>{t('assess.submit')}</button>
</div>}
</section>
);
}
// ---------------------------------------------------------------- player
function Player({ slug, lessonId }: { slug?: string; lessonId?: string }) {
@ -523,7 +655,9 @@ function Player({ slug, lessonId }: { slug?: string; lessonId?: string }) {
function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Lesson }) {
const t = useTranslations();
const { me, locale, nav, ds, write, signedIn, viewer } = useApp();
const dur = lesson.durationSec || 1;
const vimeo = !lesson.videoAssetId; // no upload yet: play the Vimeo placeholder instead
const [vdur, setVdur] = useState(0);
const dur = (vimeo && vdur) || lesson.durationSec || 1;
const saved = me?.progress?.[lesson.id];
const [pos, setPos] = useState(() => (saved && !saved.completedAt ? Math.min(saved.positionSec, dur - 5) : 0));
const [playing, setPlaying] = useState(false);
@ -533,6 +667,7 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
const [quality, setQuality] = useState('auto');
const [justDone, setJustDone] = useState(false);
const videoRef = useRef<HTMLVideoElement>(null);
const frameRef = useRef<HTMLIFrameElement>(null);
const screenRef = useRef<HTMLDivElement>(null);
const posRef = useRef(pos); posRef.current = pos;
const sentAt = useRef(pos); // position at last heartbeat, for watch-time accounting
@ -554,12 +689,23 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
write(() => ds.patchStudent(s.id, { progress: { [lesson.id]: hb }, lastActiveAt: now, watchSec: { [ym]: (s.watchSec?.[ym] ?? 0) + Math.min(delta, 60) } }));
}, [canSave, c.id, dur, lesson.id, ds, write]);
// simulated playback clock when no video is uploaded
// Vimeo placeholder, driven over the player's postMessage API so progress and heartbeats still work
const vcall = (method: string, value?: unknown) => frameRef.current?.contentWindow?.postMessage(JSON.stringify(value === undefined ? { method } : { method, value }), VIMEO_ORIGIN);
const vlisten = () => { ['timeupdate', 'play', 'pause', 'ended'].forEach((ev) => vcall('addEventListener', ev)); vcall('getDuration'); if (posRef.current) vcall('setCurrentTime', posRef.current); };
useEffect(() => {
if (!playing || lesson.videoAssetId) return;
const id = setInterval(() => setPos((p) => { const n = Math.min(dur, p + 0.25 * rate); if (n >= dur) setPlaying(false); return n; }), 250);
return () => clearInterval(id);
}, [playing, rate, dur, lesson.videoAssetId]);
if (!vimeo) return;
const on = (e: MessageEvent) => {
if (e.origin !== VIMEO_ORIGIN || e.source !== frameRef.current?.contentWindow) return;
let m: any; try { m = typeof e.data === 'string' ? JSON.parse(e.data) : e.data; } catch { return; }
if (m.event === 'ready') vlisten();
else if (m.event === 'timeupdate') { setPos(m.data.seconds); if (m.data.duration) setVdur(m.data.duration); }
else if (m.event === 'play') setPlaying(true);
else if (m.event === 'pause' || m.event === 'ended') setPlaying(false);
else if (m.method === 'getDuration' && m.value) setVdur(m.value);
};
addEventListener('message', on);
return () => removeEventListener('message', on);
}, [vimeo]);
// heartbeat every 15 s while playing, and on pause / leave (§5.8)
useEffect(() => { if (!playing) { heartbeat(); return; } const id = setInterval(heartbeat, 15000); return () => clearInterval(id); }, [playing, heartbeat]);
useEffect(() => {
@ -568,14 +714,14 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
return () => { removeEventListener('visibilitychange', vis); removeEventListener('pagehide', heartbeat); heartbeat(); };
}, [heartbeat]);
useEffect(() => { const v = videoRef.current; if (v) v.playbackRate = rate; }, [rate]);
useEffect(() => { if (vimeo && rate !== 1) vcall('setPlaybackRate', rate); }, [rate]);
const toggle = () => {
const v = videoRef.current;
if (v) { v.paused ? v.play().catch(() => setPlaying(false)) : v.pause(); return; }
if (pos >= dur) setPos(0);
setPlaying((p) => !p);
vcall(playing ? 'pause' : 'play');
};
const seek = (to: number) => { const n = Math.max(0, Math.min(dur, to)); setPos(n); if (videoRef.current) videoRef.current.currentTime = n; };
const seek = (to: number) => { const n = Math.max(0, Math.min(dur, to)); setPos(n); if (videoRef.current) videoRef.current.currentTime = n; else vcall('setCurrentTime', n); };
const full = () => { screenRef.current?.requestFullscreen?.().catch(() => { /* not allowed in this frame */ }); };
const onKey = (e: React.KeyboardEvent) => {
if ((e.target as HTMLElement).tagName === 'SELECT' || (e.target as HTMLElement).tagName === 'INPUT') return;
@ -592,13 +738,10 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
onLoadedMetadata={(e) => { if (pos) e.currentTarget.currentTime = pos; }}
onTimeUpdate={(e) => setPos(e.currentTarget.currentTime)} onPlay={() => setPlaying(true)} onPause={() => setPlaying(false)} onEnded={() => setPlaying(false)} />
) : (
<div className="sim" onClick={toggle}>
<h2>{lessonTitle(lesson, locale)}</h2>
<p className="small muted">{t('player.demoVideo')}</p>
</div>
<iframe ref={frameRef} src={VIMEO_PLACEHOLDER} onLoad={vlisten} title={lessonTitle(lesson, locale)} allow="autoplay; fullscreen; picture-in-picture" allowFullScreen />
)}
{canSave && <span className="wm" aria-hidden>{mark}</span>}
<div className="controls">
{!vimeo && <div className="controls">
<input type="range" min={0} max={dur} step={1} value={Math.floor(pos)} onChange={(e) => seek(Number(e.target.value))} aria-label={`${clock(pos)} / ${clock(dur)}`} />
<div className="row">
<button onClick={toggle} aria-label={playing ? t('player.pause') : t('player.play')}><Icon name={playing ? 'pause' : 'play'} size={16} /></button>
@ -615,8 +758,9 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
<button aria-pressed={saver} onClick={() => { setSaver((s) => !s); if (!saver && (quality === '480p' || quality === '720p')) setQuality('360p'); }}>{t('player.dataSaver')}: {saver ? 'on' : 'off'}</button>
<button onClick={full} aria-label={t('player.fullscreen')}><Icon name="expand" size={16} /></button>
</div>
</div>
</div>}
</div>
{vimeo && <p className="small muted">{t('player.demoVideo')}</p>}
{done && (
<div className="done-flash" role="status"><Ring pct={pct} /><span className="grow">{t('player.completed')}</span>
{next && <button className="btn btn-sm" onClick={() => nav(`/${locale}/learn/${c.slug}/${next.id}`)}>{t('player.next')}</button>}
@ -660,7 +804,7 @@ function Checkout({ slug }: { slug?: string }) {
{METHODS.map((m) => (
<label key={m.id} className="card check" style={{ padding: 16, alignItems: 'center' }}>
<input type="radio" name="method" value={m.id} checked={method === m.id} onChange={() => setMethod(m.id)} />
<span className="grow" style={{ fontWeight: 700 }}>{m.name}</span><span className="pill">ArifPay</span>
<PayLogo id={m.id} /><span className="grow" style={{ fontWeight: 700 }}>{m.name}</span><span className="pill">{m.via}</span>
</label>
))}
</fieldset>
@ -777,6 +921,7 @@ function MyProgress() {
<div className="row"><Ring pct={courseProgress(c, me).pct} /><div className="grow"><h2 style={{ fontSize: 'var(--fs-lg)' }}>{ct(c, locale).title}</h2></div>
<button className="btn btn-ghost btn-sm" onClick={() => nav(`/${locale}/course/${c.slug}`)}>{t('course.content')}</button></div>
{[...c.chapters].sort((a, b) => a.sortOrder - b.sortOrder).map((ch) => <div key={ch.id}><p className="small" style={{ fontWeight: 700, padding: '8px 4px 2px' }}>{tr(ch.translations, locale)?.title}</p>{ch.lessons.filter((l) => l.isPublished).sort((a, b) => a.sortOrder - b.sortOrder).map((l) => <LessonRow key={l.id} c={c} l={l} />)}</div>)}
{!!c.assessments?.length && <div><p className="small" style={{ fontWeight: 700, padding: '8px 4px 2px' }}>{t('assess.title')}</p>{c.assessments.map((a) => <AssessmentRow key={a.id} c={c} a={a} />)}</div>}
</div>
))}
</section>

View File

@ -521,9 +521,6 @@ h1:lang(en), h2:lang(en), h3:lang(en), h1:lang(om), h2:lang(om), h3:lang(om), .a
.how-panel { background: var(--canvas); border: 1px solid color-mix(in srgb, var(--brand-3) 40%, transparent); }
.steps li::before { background: var(--accent); color: #fff; }
.pay-logo { background: var(--paper); }
.pay-logo .pay-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--brand-2); }
.pay-logo:nth-child(2) .pay-ic { background: var(--accent); }
.pay-logo:nth-child(3) .pay-ic { background: var(--ink); color: var(--on-ink); }
.cta-band { position: relative; overflow: hidden; background: linear-gradient(120deg, #1D3557, #29495E 60%, #457B9D); color: #fff; }
.cta-band::after { content: ''; position: absolute; right: -60px; bottom: -120px; width: 280px; height: 280px; border-radius: 50%; background: #A8DADC; opacity: .18; pointer-events: none; }
.cta-band > * { position: relative; z-index: 1; }
@ -533,5 +530,62 @@ h1:lang(en), h2:lang(en), h3:lang(en), h1:lang(om), h2:lang(om), h3:lang(om), .a
.a-me { background: linear-gradient(160deg, #1D3557, #29495E); color: #fff; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.ccard:hover .ccard-cta { background: var(--accent); border-color: var(--accent); color: #fff; }
.foot { background: var(--canvas); border-top-color: transparent; }
.a-shell { background: var(--paper); }
.pay-mark { width: 48px; height: 28px; flex: none; display: grid; place-items: center; }
.pay-mark img { width: 48px; height: 28px; object-fit: contain; }
.pay-logo { padding: 8px 14px 8px 10px; }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* footer (inspo: Juggle about/footer): wordmark + story left, palette art right, quiet uppercase link columns */
.foot { background: var(--paper); border-top: 1px solid var(--line); margin-top: 48px; padding: 64px 20px calc(96px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { .foot { padding-bottom: 40px; } }
.foot-wrap { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; }
.foot-top { display: grid; gap: 40px; }
@media (min-width: 860px) { .foot-top { grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); align-items: end; } }
.foot-story { display: flex; flex-direction: column; min-width: 0; }
.foot-word { font-family: var(--f-head); font-size: clamp(40px, 6.4vw, 68px); font-weight: 800; letter-spacing: -.035em; line-height: 1; color: var(--ink); }
.foot-tag { margin-top: 18px; font-weight: 700; color: var(--ink); }
.foot-desc { margin-top: 6px; font-size: var(--fs-sm); color: var(--ink-2); max-width: 42ch; }
.foot-people { list-style: none; padding: 0; margin: 40px 0 0; display: flex; flex-wrap: wrap; gap: 16px 48px; }
.foot-people strong { display: block; color: var(--ink); }
.foot-people span { font-size: var(--fs-sm); color: var(--ink-3); }
.foot-box { width: 100%; max-width: 340px; justify-self: end; }
.foot-box svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 18px 30px rgba(29, 53, 87, .18)); transition: transform .4s ease; }
.foot-box:hover svg { transform: rotate(-1.5deg) translateY(-4px); }
@media (max-width: 859px) { .foot-box { max-width: 260px; justify-self: start; } }
.foot-cols { display: grid; gap: 32px 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .foot-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.foot-cols h3 { font-family: var(--f-latin); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.foot-cols button, .foot-cols a, .foot-cols span { display: block; width: fit-content; text-align: left; background: none; border: 0; padding: 5px 0; color: var(--ink); text-decoration: none; cursor: pointer; font-size: var(--fs-base); }
.foot-cols span { cursor: default; color: var(--ink-2); }
.foot-cols button:hover, .foot-cols a:hover { color: var(--accent); }
.foot-cols button[aria-current="true"] { font-weight: 700; }
.foot-base { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.foot-rights { margin-left: auto; letter-spacing: .06em; text-transform: none; }
/* assessments */
.quiz { display: flex; flex-direction: column; gap: 24px; max-width: 760px; width: 100%; margin: 0 auto; }
.quiz-head { display: flex; gap: 16px; align-items: flex-start; }
.quiz-head h1 { font-size: clamp(26px, 3.4vw, 34px); }
.quiz-ic { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--brand-2-soft); color: var(--brand-2); }
.quiz-result { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 16px 18px; border-radius: var(--r-lg); }
.quiz-result.ok { background: var(--success-soft); } .quiz-result.ok strong { color: var(--success); }
.quiz-result.bad { background: var(--warn-soft); }
.quiz-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.quiz-q fieldset { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin: 0; min-width: 0; background: var(--paper); box-shadow: var(--shadow-soft); }
.quiz-q legend { float: left; width: 100%; display: flex; gap: 12px; align-items: flex-start; font-weight: 700; font-size: var(--fs-lg); line-height: 1.4; margin-bottom: 14px; padding: 0; }
.quiz-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: var(--fs-sm); }
.quiz-opts { clear: both; display: flex; flex-direction: column; gap: 8px; }
.quiz-opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; transition: border-color .15s, background .15s; }
.quiz-opt:hover { border-color: var(--brand-2); }
.quiz-opt:has(input:checked) { border-color: var(--brand-2); background: var(--info-soft); }
.quiz-opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand-2); flex: none; }
.quiz-opt.right, .quiz-opt.right:has(input:checked) { border-color: var(--success); background: var(--success-soft); }
.quiz-opt.wrong, .quiz-opt.wrong:has(input:checked) { border-color: var(--alert); background: var(--alert-soft); }
fieldset[disabled] .quiz-opt { cursor: default; }
.quiz-explain { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--brand-3); background: var(--mist); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--ink-2); }
.quiz-foot { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-soft); }
@media (min-width: 900px) { .quiz-foot { bottom: 16px; } }
.ch .lesson-row .pill { flex: none; }
.lesson-row .quiz-ok, .lesson-row .quiz-todo { display: block; font-weight: 700; }
.lesson-row .quiz-ok { color: var(--success); } .lesson-row .quiz-todo { color: var(--alert); }

View File

@ -16,6 +16,7 @@ const PATHS: Record<string, string> = {
pause: 'M7 4h4v16H7zM13 4h4v16h-4z',
lock: 'M6 11h12v10H6zM8 11V7a4 4 0 0 1 8 0v4',
check: 'M5 12l5 5 9-10',
quiz: 'M9 3h6v3H9zM7 4.5H5V21h14V4.5h-2M9 14l2 2 4-4',
chevron: 'M9 6l6 6-6 6',
back: 'M15 6l-6 6 6 6',
x: 'M6 6l12 12M18 6L6 18',
@ -71,6 +72,50 @@ export function Logo({ size = 34 }: { size?: number }) {
);
}
// Stand-in lesson video until real uploads exist: Blender's openly licensed "Big Buck Bunny" on Vimeo.
export const VIMEO_ORIGIN = 'https://player.vimeo.com';
export const VIMEO_PLACEHOLDER = `${VIMEO_ORIGIN}/video/1084537?dnt=1&title=0&byline=0&portrait=0`;
// Footer art: an eyeshadow palette. Twelve pans in brand and skin shades; a white brush and compact mirror sit
// under the case's grid lines so the shapes break across tiles (the reference's cut-paper look).
const PANS = ['#E63946', '#F5AFB5', '#A8DADC', '#E9B8A7', '#457B9D', '#F1FAEE', '#C98B6B', '#FAD7DA', '#315A93', '#8E4B45', '#70C3C6', '#CB1928'];
export function MakeupBox() {
const W = 92, H = 92, G = 6, P = 14; // tile size, gap, case padding
return (
<div className="foot-box" aria-hidden>
<svg viewBox={`0 0 ${P * 2 + W * 3 + G * 2} ${P * 2 + H * 4 + G * 3}`} role="presentation">
<defs>
<radialGradient id="pan-shine" cx="35%" cy="30%" r="70%"><stop offset="0" stopColor="#fff" stopOpacity=".55" /><stop offset=".45" stopColor="#fff" stopOpacity="0" /></radialGradient>
</defs>
<rect width="100%" height="100%" rx="22" fill="#1D3557" />
{PANS.map((c, i) => {
const x = P + (i % 3) * (W + G), y = P + Math.floor(i / 3) * (H + G);
return (
<g key={i}>
<rect x={x} y={y} width={W} height={H} rx="6" fill={c} />
<circle cx={x + W / 2} cy={y + H / 2} r={W * 0.34} fill={c} stroke="rgba(0,0,0,.12)" strokeWidth="2" />
<circle cx={x + W / 2} cy={y + H / 2} r={W * 0.34} fill="url(#pan-shine)" />
</g>
);
})}
<g fill="#fff">
<g transform="rotate(-40 160 220)">
<rect x="10" y="206" width="180" height="28" rx="14" />
<rect x="184" y="198" width="44" height="44" rx="6" />
<path d="M226 192 C 290 176, 340 200, 352 220 C 340 240, 290 264, 226 248 Z" />
</g>
<circle cx="262" cy="64" r="44" fill="none" stroke="#fff" strokeWidth="12" />
<path d="M40 404 a40 40 0 0 1 80 0 Z" />
</g>
<g fill="#1D3557">
{[1, 2].map((k) => <rect key={'v' + k} x={P + k * W + (k - 1) * G} y={0} width={G} height="100%" />)}
{[1, 2, 3].map((k) => <rect key={'h' + k} x={0} y={P + k * H + (k - 1) * G} width="100%" height={G} />)}
</g>
</svg>
</div>
);
}
const TONES = ['rose', 'clay', 'plum', 'sand', 'sage', 'ink'];
export function Cover({ course, locale, badge }: { course: Course; locale: Locale; badge?: ReactNode }) {

View File

@ -300,5 +300,39 @@
"issueBody": "«{subject}» አሁን {status} ነው።",
"grantTitle": "ኮርስ ወደ መለያዎ ተጨምሯል",
"grantBody": "አሁን «{title}»ን ማግኘት ይችላሉ።"
},
"assess": {
"title": "ፈተናዎች",
"questions": "{n} ጥያቄዎች",
"passMark": "ማለፊያ {pct}%",
"start": "ጀምር",
"retake": "እንደገና ሞክር",
"review": "ገምግም",
"submit": "መልሶችን አስገባ",
"answerAll": "ለማስገባት ሁሉንም ጥያቄዎች ይመልሱ ({done}/{total})።",
"score": "ከ{total} {score} ትክክል",
"passed": "አልፈዋል",
"notPassed": "ገና አላለፉም",
"best": "ምርጥ {pct}%",
"attempts": "{n} ሙከራ",
"locked": "ፈተናዎቹን ለመውሰድ ኮርሱን ይግዙ።",
"correct": "ትክክል",
"wrong": "የእርስዎ መልስ",
"answerIs": "መልስ፦ {answer}",
"back": "ወደ ኮርሱ ተመለስ",
"notFound": "ፈተናው አልተገኘም።",
"final": "ማጠቃለያ",
"chapter": "ከ{chapter} በኋላ",
"none": "እስካሁን ምንም ፈተና አልወሰዱም።",
"saved": "ውጤቱ ተቀምጧል",
"tryAgain": "ለማለፍ {pct}% ያስፈልጋል። ትምህርቶቹን ከልሰው እንደገና ይሞክሩ።",
"wellDone": "በጣም ጥሩ — አልፈዋል።"
},
"footer": {
"tagline": "ሙያውን ይማሩ። ለዘላለም ያቆዩት።",
"instructors": "አሠልጣኝ",
"learn": "ትምህርት",
"support": "እገዛ",
"rights": "መብቱ በሕግ የተጠበቀ ነው"
}
}

View File

@ -300,5 +300,39 @@
"issueBody": "“{subject}” is now {status}.",
"grantTitle": "Course added to your account",
"grantBody": "You now have access to “{title}”."
},
"assess": {
"title": "Assessments",
"questions": "{n, plural, one {# question} other {# questions}}",
"passMark": "Pass mark {pct}%",
"start": "Start",
"retake": "Retake",
"review": "Review",
"submit": "Submit answers",
"answerAll": "Answer every question to submit ({done}/{total}).",
"score": "{score} of {total} correct",
"passed": "Passed",
"notPassed": "Not passed yet",
"best": "Best {pct}%",
"attempts": "{n, plural, one {# attempt} other {# attempts}}",
"locked": "Buy the course to take its assessments.",
"correct": "Correct",
"wrong": "Your answer",
"answerIs": "Answer: {answer}",
"back": "Back to course",
"notFound": "Assessment not found.",
"final": "Final",
"chapter": "After: {chapter}",
"none": "No assessments taken yet.",
"saved": "Result saved",
"tryAgain": "You need {pct}% to pass. Review the lessons and try again.",
"wellDone": "Well done — you passed."
},
"footer": {
"tagline": "Learn the craft. Keep it for life.",
"instructors": "Instructor",
"learn": "Learn",
"support": "Support",
"rights": "All rights reserved"
}
}

View File

@ -300,5 +300,39 @@
"issueBody": "“{subject}” amma {status}.",
"grantTitle": "Koorsiin herrega keetti dabalameera",
"grantBody": "Amma “{title}” argachuu dandeessa."
},
"assess": {
"title": "Madaallii",
"questions": "Gaaffii {n}",
"passMark": "Qabxii darbii {pct}%",
"start": "Jalqabi",
"retake": "Irra deebi'i",
"review": "Ilaali",
"submit": "Deebii galchi",
"answerAll": "Galchuuf gaaffii hunda deebisi ({done}/{total}).",
"score": "{total} keessaa {score} sirrii",
"passed": "Darbiteetta",
"notPassed": "Ammallee hin darbine",
"best": "Kan caale {pct}%",
"attempts": "Yaalii {n}",
"locked": "Madaallii fudhachuuf koorsicha bitadhu.",
"correct": "Sirrii",
"wrong": "Deebii kee",
"answerIs": "Deebii: {answer}",
"back": "Gara koorsichaatti deebi'i",
"notFound": "Madaalliin hin argamne.",
"final": "Xumuraa",
"chapter": "{chapter} booda",
"none": "Hanga ammaatti madaallii hin fudhanne.",
"saved": "Bu'aan olkaa'ameera",
"tryAgain": "Darbuuf {pct}% barbaachisa. Barnoota irra deebi'ii ilaaliitii yaali.",
"wellDone": "Baay'ee gaarii — darbiteetta."
},
"footer": {
"tagline": "Ogummaa baradhu. Bara baraan qabadhu.",
"instructors": "Leenjisaa",
"learn": "Barnoota",
"support": "Deeggarsa",
"rights": "Mirgi seeraan eegameera"
}
}

View File

@ -300,5 +300,39 @@
"issueBody": "«{subject}» ሕጂ {status} እዩ።",
"grantTitle": "ኮርስ ናብ ሕሳብካ ተወሲኹ",
"grantBody": "ሕጂ «{title}» ክትረክብ ትኽእል።"
},
"assess": {
"title": "ፈተናታት",
"questions": "{n} ሕቶታት",
"passMark": "መሕለፊ {pct}%",
"start": "ጀምር",
"retake": "ደጊምካ ፈትን",
"review": "ርአ",
"submit": "መልስታት ኣእቱ",
"answerAll": "ንምእታው ንኹሉ ሕቶታት መልሲ ሃብ ({done}/{total})።",
"score": "ካብ {total} {score} ቅኑዕ",
"passed": "ሓሊፍካ",
"notPassed": "ገና ኣይሓለፍካን",
"best": "ዝበለጸ {pct}%",
"attempts": "{n} ፈተነ",
"locked": "ፈተናታት ንምውሳድ ነቲ ኮርስ ዕደግ።",
"correct": "ቅኑዕ",
"wrong": "ናትካ መልሲ",
"answerIs": "መልሲ፦ {answer}",
"back": "ናብ ኮርስ ተመለስ",
"notFound": "ፈተና ኣይተረኽበን።",
"final": "መደምደምታ",
"chapter": "ድሕሪ {chapter}",
"none": "ክሳብ ሕጂ ፈተና ኣይወሰድካን።",
"saved": "ውጽኢት ተዓቂቡ",
"tryAgain": "ንምሕላፍ {pct}% የድሊ። ትምህርትታት ከሊስካ ደጊምካ ፈትን።",
"wellDone": "ጽቡቕ — ሓሊፍካ።"
},
"footer": {
"tagline": "ሞያ ተማሃር። ንሓዋሩ ሓዞ።",
"instructors": "መምህር",
"learn": "ትምህርቲ",
"support": "ሓገዝ",
"rights": "መሰል ብሕጊ ዝተሓለወ እዩ"
}
}