Compare commits
15 Commits
ui-experie
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d6d36b224d | |||
| 9ccd21584f | |||
| 1028caf109 | |||
| 26d518b631 | |||
| ff5772e9cf | |||
| d92180542b | |||
| 8ba936baae | |||
| d1e398eaa0 | |||
| 67650698bf | |||
| fd382359c0 | |||
| 529f35cdf6 | |||
| 7c9c9d97d5 | |||
| a25c02365f | |||
| a94514eb6b | |||
| 754cebeeff |
|
|
@ -31,6 +31,6 @@ npx -y pnpm@9 run i18n:check # every locale has every key
|
||||||
node tools/waitlist-check.mjs # waitlist Apps Script: validation, dedupe, formula-injection guard
|
node tools/waitlist-check.mjs # waitlist Apps Script: validation, dedupe, formula-injection guard
|
||||||
```
|
```
|
||||||
|
|
||||||
**Vercel (standalone demo):** `vercel.json` builds the static export, then `tools/vercel-build.mjs` injects the runtime mock and the seed. Outside Claude, all data lives in memory in each visitor's browser and resets on reload. Deploy with `npx vercel deploy --prod`.
|
**Builds:** a plain build (`next build`, `app:build`, the CI server, Vercel) talks to the real API, `https://api.rezina.yaltopia.com`, the default in `apps/demo/app/page.tsx`. Point it elsewhere (e.g. staging) with `NEXT_PUBLIC_LMS_API=<url>`. `demo:build` sets it empty and keeps demo data: it feeds the hosted artifact demo, whose sandbox can't reach outside servers. To preview the old in-memory demo, build with `NEXT_PUBLIC_LMS_API= npx -y pnpm@9 --filter demo build && node tools/vercel-build.mjs`. Deploy to Vercel with `npx vercel deploy --prod`.
|
||||||
|
|
||||||
Phases 1–3 (Fastify API, Postgres, ArifPay, R2 video) haven't started yet. They wait on decisions D1, D2 and D8 in SPEC §17.
|
Phases 1–3 (Fastify API, Postgres, ArifPay, R2 video) haven't started yet. They wait on decisions D1, D2 and D8 in SPEC §17.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
'use client';
|
'use client';
|
||||||
import { ClaudeDbDataSource } from '@lms/data';
|
import { ApiDataSource, ClaudeDbDataSource } from '@lms/data';
|
||||||
import { Platform } from '@lms/features';
|
import { Platform } from '@lms/features';
|
||||||
|
|
||||||
const makeDs = () => new ClaudeDbDataSource();
|
// Any plain build (`next build`, as the CI server runs it) talks to the real API.
|
||||||
|
// The hosted artifact demo opts out by building with NEXT_PUBLIC_LMS_API set to an empty value (`demo:build`):
|
||||||
|
// its sandbox can't reach outside servers, so it keeps its own data. Another API (e.g. staging) is a different value.
|
||||||
|
const DEFAULT_API = 'https://api.rezina.yaltopia.com';
|
||||||
|
const API = process.env.NEXT_PUBLIC_LMS_API ?? DEFAULT_API;
|
||||||
|
const makeDs = () => (API ? new ApiDataSource(API) : new ClaudeDbDataSource());
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return <Platform dataSource={makeDs} />;
|
return <Platform dataSource={makeDs} />;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,9 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@9.15.9",
|
"packageManager": "pnpm@9.15.9",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"demo:build": "pnpm --filter demo build && node tools/artifact-inline.mjs apps/demo/out dist/demo.html && node tools/artifact-check.mjs dist/demo.html",
|
"app:build": "pnpm --filter demo build",
|
||||||
"test": "node packages/features/src/domain.check.ts",
|
"demo:build": "NEXT_PUBLIC_LMS_API= pnpm --filter demo build && node tools/artifact-inline.mjs apps/demo/out dist/demo.html && node tools/artifact-check.mjs dist/demo.html",
|
||||||
|
"test": "node packages/features/src/domain.check.ts && node packages/data/src/api.check.ts",
|
||||||
"typecheck": "pnpm -r exec tsc --noEmit",
|
"typecheck": "pnpm -r exec tsc --noEmit",
|
||||||
"i18n:check": "node tools/i18n-check.mjs"
|
"i18n:check": "node tools/i18n-check.mjs"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@
|
||||||
"name": "@lms/data",
|
"name": "@lms/data",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"types": "src/index.ts",
|
"types": "src/index.ts",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^19"
|
"@types/react": "^19",
|
||||||
|
"@types/node": "^22"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
73
packages/data/src/api.check.ts
Normal file
73
packages/data/src/api.check.ts
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
// Runnable check for the API → domain mapping: `pnpm test`. The fixtures are real responses from
|
||||||
|
// https://api.rezina.yaltopia.com (2026-11-02): GET /catalog/courses and GET /catalog/courses/12.
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { absolute, ids, mapIssue, mapNotification, mapOutline, mapStudent, slugify, type RawOutline } from './api.ts';
|
||||||
|
|
||||||
|
const BASE = 'https://api.rezina.yaltopia.com';
|
||||||
|
const fixture = (f: string) => JSON.parse(readFileSync(new URL(f, import.meta.url), 'utf8')).data;
|
||||||
|
|
||||||
|
// ids and urls
|
||||||
|
assert.equal(ids.course(12), 'c12');
|
||||||
|
assert.equal(ids.num('ch19'), 19);
|
||||||
|
assert.equal(ids.num('l38'), 38);
|
||||||
|
assert.equal(slugify('Everyday English', 12), 'everyday-english-12');
|
||||||
|
assert.equal(slugify('የሜካፕ መሠረታዊ', 5), 'የሜካፕ-መሠረታዊ-5', 'Ge’ez titles keep their letters');
|
||||||
|
assert.equal(slugify('!!!', 7), '7');
|
||||||
|
assert.equal(absolute(BASE, '/static/demo/course-cover.svg'), `${BASE}/static/demo/course-cover.svg`);
|
||||||
|
assert.equal(absolute(BASE + '/', 'static/x.png'), `${BASE}/static/x.png`);
|
||||||
|
assert.equal(absolute(BASE, 'https://cdn.example/x.png'), 'https://cdn.example/x.png');
|
||||||
|
assert.equal(absolute(BASE, ''), null);
|
||||||
|
|
||||||
|
// catalog list has what the outline calls need
|
||||||
|
const catalog = fixture('./fixtures-catalog.json');
|
||||||
|
assert.ok(catalog.courses.length > 0);
|
||||||
|
for (const c of catalog.courses) assert.ok(Number.isInteger(c.id) && typeof c.name === 'string');
|
||||||
|
|
||||||
|
// outline → Course
|
||||||
|
const outline: RawOutline = fixture('./fixtures-outline-12.json');
|
||||||
|
const c = mapOutline(outline, BASE);
|
||||||
|
assert.equal(c.id, 'c12');
|
||||||
|
assert.equal(c.slug, 'everyday-english-12');
|
||||||
|
assert.equal(c.translations.en?.title, 'Everyday English');
|
||||||
|
assert.equal(c.status, 'PUBLISHED');
|
||||||
|
assert.equal(c.coverAssetId, `${BASE}/static/demo/course-cover.svg`);
|
||||||
|
assert.deepEqual(c.prices, {}, 'no per-course price on the API');
|
||||||
|
assert.equal(c.chapters.length, outline.chapters.length);
|
||||||
|
assert.equal(c.chapters[0].id, 'ch19');
|
||||||
|
assert.equal(c.chapters[0].translations.en?.title, 'Meet and greet');
|
||||||
|
assert.equal(c.chapters.flatMap((ch) => ch.lessons).length, outline.lesson_count, 'every lesson in the outline is mapped');
|
||||||
|
assert.deepEqual(c.chapters[0].lessons.map((l) => l.sortOrder), [1, 2, 3]);
|
||||||
|
assert.ok(c.chapters[0].lessons.every((l) => l.isPreview), 'a FREE course plays for anyone');
|
||||||
|
const premium = mapOutline({ ...outline, access_tier: 'PREMIUM', chapters: [{ ...outline.chapters[0], lessons: outline.chapters[0].lessons.map((l, i) => ({ ...l, access_tier: i ? 'PREMIUM' : 'FREE' })) }] }, BASE);
|
||||||
|
assert.deepEqual(premium.chapters[0].lessons.map((l) => l.isPreview), [true, false, false], 'in a PREMIUM course only FREE lessons preview');
|
||||||
|
|
||||||
|
// issues and notifications
|
||||||
|
const issue = mapIssue({ id: 4, issue_type: 'video', subject: 'Stops', description: 'd', status: 'in_progress', created_at: 'a', updated_at: 'b' });
|
||||||
|
assert.deepEqual([issue.id, issue.type, issue.status], ['4', 'VIDEO', 'IN_PROGRESS']);
|
||||||
|
assert.equal(mapIssue({ id: 5, issue_type: 'weird', subject: '', description: '', status: '???', created_at: '', updated_at: '' }).type, 'OTHER');
|
||||||
|
const n = mapNotification({ id: 'n1', is_read: true, timestamp: 't', type: 'payment_verified', payload: { headline: 'Paid', message: 'Thanks' }, metadata: { link: '/en/my' } });
|
||||||
|
assert.deepEqual([n.type, n.title, n.body, n.readAt, n.link], ['PAYMENT_VERIFIED', 'Paid', 'Thanks', 't', '/en/my']);
|
||||||
|
assert.equal(mapNotification({ id: 'n2', is_read: false, timestamp: 't', type: 'x' }).readAt, null);
|
||||||
|
|
||||||
|
// profile + progress summary → Student
|
||||||
|
const now = '2026-11-02T00:00:00.000Z';
|
||||||
|
const access = (x: Partial<{ is_accessible: boolean; is_completed: boolean }>) => ({ is_accessible: false, is_completed: false, progress_percent: 0, ...x });
|
||||||
|
const s = mapStudent(
|
||||||
|
{ id: 9, first_name: 'Meron', last_name: 'T', phone_number: '+251911000000', preferred_language: 'am', status: 'SUSPENDED', region: 'Adama', country: 'ET' },
|
||||||
|
{ courses: [
|
||||||
|
{ id: 12, access: access({ is_accessible: true }), chapters: [{ id: 19, lessons: [{ id: 38, access: access({ is_completed: true }) }, { id: 39, access: access({}) }] }] },
|
||||||
|
{ id: 13, access: access({ is_accessible: false }), chapters: [] },
|
||||||
|
] },
|
||||||
|
[{ id: 1, issue_type: 'payment', subject: 's', description: 'd', status: 'open', created_at: 'a', updated_at: 'b' }],
|
||||||
|
{ l39: { courseId: 'c12', positionSec: 40, maxPositionSec: 60, updatedAt: now } },
|
||||||
|
now,
|
||||||
|
);
|
||||||
|
assert.deepEqual([s.id, s.name, s.locale, s.status, s.city], ['9', 'Meron T', 'am', 'DEACTIVATED', 'Adama']);
|
||||||
|
assert.deepEqual(Object.keys(s.enrollments), ['c12'], 'accessible courses count as owned');
|
||||||
|
assert.equal(s.progress.l38?.completedAt, now, 'server completion becomes a completed lesson');
|
||||||
|
assert.equal(s.progress.l39?.positionSec, 40, 'this session’s resume point survives a refresh');
|
||||||
|
assert.equal(s.issues['1']?.type, 'PAYMENT');
|
||||||
|
assert.equal(mapStudent({ id: 1, preferred_language: 'fr' }, null, [], {}, now).locale, 'en', 'unknown language falls back to English');
|
||||||
|
|
||||||
|
console.log('api checks: all passed');
|
||||||
382
packages/data/src/api.ts
Normal file
382
packages/data/src/api.ts
Normal file
|
|
@ -0,0 +1,382 @@
|
||||||
|
// ApiDataSource: the DataSource over the Rezina Go API. Live spec: <base>/swagger/doc.json.
|
||||||
|
//
|
||||||
|
// What is wired, and how sure we are of it:
|
||||||
|
// verified against the live API public catalog + course outline (GET /catalog/courses, /catalog/courses/{id})
|
||||||
|
// built from the spec, untested sign-in, profile, progress summary, lesson video URLs, video heartbeat,
|
||||||
|
// notifications, issue reports (all need a signed-in learner)
|
||||||
|
// not on the API yet per-course prices/purchases, translations, categories, teacher, lesson
|
||||||
|
// durations, prerequisites; quizzes are left out until their question shape is known
|
||||||
|
// Screens never see the API's shapes: everything is mapped onto the domain types in ./index.
|
||||||
|
import type {
|
||||||
|
Campaign, Category, Course, DataSource, InboxItem, Issue, IssueStatus, IssueType, LessonProgress, Locale, Settings,
|
||||||
|
Student, Unsub, UserStatus, Viewer, AuditEntry,
|
||||||
|
} from './index';
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- API shapes (the subset we read)
|
||||||
|
|
||||||
|
type Tier = 'FREE' | 'PREMIUM';
|
||||||
|
export interface RawCourse { id: number; name: string; description: string; thumbnail: string; access_tier: Tier; chapter_count: number; lesson_count: number; quiz_count: number }
|
||||||
|
export interface RawLesson { id: number; title: string; description: string; thumbnail: string; access_tier: Tier; video_url?: string; sort_order?: number }
|
||||||
|
export interface RawChapter { id: number; name: string; description: string; lessons: RawLesson[]; quizzes: { id: number; title: string; question_count: number }[] }
|
||||||
|
export interface RawOutline extends RawCourse { chapters: RawChapter[] }
|
||||||
|
interface RawAccess { is_accessible: boolean; is_completed: boolean; progress_percent: number }
|
||||||
|
interface RawSummary { courses: { id: number; access: RawAccess; chapters: { id: number; lessons: { id: number; access: RawAccess }[] }[] }[] }
|
||||||
|
interface RawProfile { id: number; first_name?: string; last_name?: string; nick_name?: string; email?: string; phone_number?: string; country?: string; region?: string; preferred_language?: string; status?: string; created_at?: string; updated_at?: string; last_login?: string }
|
||||||
|
interface RawIssue { id: number; issue_type: string; subject: string; description: string; status: string; created_at: string; updated_at: string }
|
||||||
|
interface RawNotification { id: string; is_read: boolean; timestamp: string; type: string; payload?: { headline?: string; message?: string }; metadata?: Record<string, unknown> }
|
||||||
|
interface Tokens { access: string; refresh: string; userId: number }
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- ids and mapping (pure: covered by api.check.ts)
|
||||||
|
|
||||||
|
/** Domain ids are strings with a kind prefix, so ids from different API tables can't collide in one record. */
|
||||||
|
export const ids = {
|
||||||
|
course: (n: number) => `c${n}`, chapter: (n: number) => `ch${n}`, lesson: (n: number) => `l${n}`, quiz: (n: number) => `q${n}`,
|
||||||
|
num: (id: string) => Number(id.replace(/^[a-z]+/, '')),
|
||||||
|
};
|
||||||
|
|
||||||
|
/** URL slug: readable name plus the API id, so renaming a course never breaks a shared link (the id wins). */
|
||||||
|
export function slugify(name: string, id: number): string {
|
||||||
|
const s = name.toLowerCase().normalize('NFKD').replace(/[^\p{L}\p{N}]+/gu, '-').replace(/^-+|-+$/g, '');
|
||||||
|
return s ? `${s}-${id}` : String(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const absolute = (base: string, url: string | null | undefined) =>
|
||||||
|
!url ? null : /^https?:\/\//.test(url) ? url : base.replace(/\/+$/, '') + (url.startsWith('/') ? url : `/${url}`);
|
||||||
|
|
||||||
|
/** Course outline → domain Course. Text is English-only until the API carries translations. */
|
||||||
|
export function mapOutline(o: RawOutline, base: string): Course {
|
||||||
|
return {
|
||||||
|
id: ids.course(o.id), slug: slugify(o.name, o.id), categoryId: '', instructorName: '', instructionLocale: 'en',
|
||||||
|
coverAssetId: absolute(base, o.thumbnail), status: 'PUBLISHED', isFeatured: false, isTest: false, sequentialLessons: false,
|
||||||
|
prerequisiteCourseId: null, publishedAt: null, createdAt: '', updatedAt: '',
|
||||||
|
translations: { en: { title: o.name, description: o.description } },
|
||||||
|
prices: {}, // the API sells subscription plans, not courses: no per-course price yet
|
||||||
|
chapters: o.chapters.map((ch, i) => ({
|
||||||
|
id: ids.chapter(ch.id), sortOrder: i + 1,
|
||||||
|
translations: { en: { title: ch.name, summary: ch.description || undefined } },
|
||||||
|
lessons: ch.lessons.map((l, j) => ({
|
||||||
|
id: ids.lesson(l.id), sortOrder: l.sort_order ?? j + 1,
|
||||||
|
// a FREE lesson (or a lesson in a FREE course) plays for anyone, like our preview lessons
|
||||||
|
isPreview: o.access_tier === 'FREE' || l.access_tier === 'FREE', isPublished: true,
|
||||||
|
durationSec: 0, // not on the API yet
|
||||||
|
videoAssetId: l.video_url || null, videoStatus: 'READY' as const,
|
||||||
|
translations: { en: { title: l.title, description: l.description || undefined } },
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
assessments: [], // chapter quizzes exist on the API; their question shape isn't mapped yet
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISSUE_TYPES: IssueType[] = ['BUG', 'PAYMENT', 'VIDEO', 'ACCOUNT', 'CONTENT', 'OTHER'];
|
||||||
|
const ISSUE_STATUSES: IssueStatus[] = ['OPEN', 'IN_PROGRESS', 'RESOLVED', 'CLOSED'];
|
||||||
|
const USER_STATUSES: UserStatus[] = ['PENDING', 'ACTIVE', 'DEACTIVATED'];
|
||||||
|
const LOCALES: Locale[] = ['am', 'en', 'om', 'ti'];
|
||||||
|
const upper = (s: string | undefined) => (s ?? '').toUpperCase().replace(/[\s-]+/g, '_');
|
||||||
|
|
||||||
|
export function mapIssue(i: RawIssue): Issue {
|
||||||
|
const type = upper(i.issue_type) as IssueType, status = upper(i.status) as IssueStatus;
|
||||||
|
return {
|
||||||
|
id: String(i.id), type: ISSUE_TYPES.includes(type) ? type : 'OTHER', subject: i.subject, description: i.description,
|
||||||
|
status: ISSUE_STATUSES.includes(status) ? status : 'OPEN', createdAt: i.created_at, updatedAt: i.updated_at,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mapNotification(n: RawNotification): InboxItem {
|
||||||
|
const link = typeof n.metadata?.link === 'string' ? n.metadata.link : null;
|
||||||
|
return { id: n.id, type: upper(n.type), title: n.payload?.headline ?? '', body: n.payload?.message ?? '', link, readAt: n.is_read ? n.timestamp : null, createdAt: n.timestamp };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Profile + progress summary + issues → the domain Student the screens read. */
|
||||||
|
export function mapStudent(p: RawProfile, summary: RawSummary | null, issues: RawIssue[], local: Record<string, LessonProgress>, now: string): Student {
|
||||||
|
const name = [p.first_name, p.last_name].filter(Boolean).join(' ') || p.nick_name || p.phone_number || p.email || '';
|
||||||
|
const status = upper(p.status) === 'SUSPENDED' ? 'DEACTIVATED' : (upper(p.status) as UserStatus);
|
||||||
|
const locale = (p.preferred_language ?? '').slice(0, 2) as Locale;
|
||||||
|
const enrollments: Student['enrollments'] = {};
|
||||||
|
const progress: Record<string, LessonProgress> = { ...local };
|
||||||
|
for (const c of summary?.courses ?? []) {
|
||||||
|
const courseId = ids.course(c.id);
|
||||||
|
if (c.access?.is_accessible) enrollments[courseId] = { courseId, source: 'FREE', createdAt: p.created_at ?? now };
|
||||||
|
for (const ch of c.chapters ?? []) for (const l of ch.lessons ?? []) {
|
||||||
|
if (!l.access?.is_completed) continue;
|
||||||
|
const id = ids.lesson(l.id);
|
||||||
|
const seen = progress[id];
|
||||||
|
progress[id] = { positionSec: seen?.positionSec ?? 0, maxPositionSec: seen?.maxPositionSec ?? 0, updatedAt: seen?.updatedAt ?? now, courseId, completedAt: seen?.completedAt ?? now };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: String(p.id), name, phone: p.phone_number || undefined, email: p.email || undefined, country: p.country ?? '', city: p.region ?? '',
|
||||||
|
locale: LOCALES.includes(locale) ? locale : 'en', status: USER_STATUSES.includes(status) ? status : 'ACTIVE',
|
||||||
|
createdAt: p.created_at ?? now, updatedAt: p.updated_at ?? now, lastActiveAt: p.last_login,
|
||||||
|
enrollments, orders: {}, progress, issues: Object.fromEntries(issues.map((i) => [String(i.id), mapIssue(i)])), assessments: {}, watchSec: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- HTTP
|
||||||
|
|
||||||
|
export class ApiError extends Error {
|
||||||
|
readonly status: number; readonly code: string;
|
||||||
|
constructor(status: number, message: string) {
|
||||||
|
super(message);
|
||||||
|
this.status = status;
|
||||||
|
this.code = status === 0 ? 'network' : status === 401 ? 'unauthenticated' : status === 403 ? 'not_granted' : 'api_error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const notConnected = (what: string) => Object.assign(new Error(`${what} isn't connected to the API yet.`), { code: 'not_granted' });
|
||||||
|
|
||||||
|
const TOKENS_KEY = 'lms.api.tokens';
|
||||||
|
const REQUEST_TIMEOUT_MS = 12000;
|
||||||
|
const REQUEST_RETRIES = 2;
|
||||||
|
const PARALLEL = 3; // the catalog fans out one call per course/chapter; a smaller burst is gentler on the server
|
||||||
|
|
||||||
|
/** Like Promise.all over `items`, with at most `limit` calls in flight. */
|
||||||
|
async function mapLimit<T, R>(items: T[], limit: number, fn: (x: T) => Promise<R>): Promise<R[]> {
|
||||||
|
const out: R[] = new Array(items.length); let next = 0;
|
||||||
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, async () => {
|
||||||
|
while (next < items.length) { const i = next++; out[i] = await fn(items[i]); }
|
||||||
|
}));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
const readTokens = (): Tokens | null => { try { return JSON.parse(localStorage.getItem(TOKENS_KEY) ?? 'null'); } catch { return null; } };
|
||||||
|
const writeTokens = (t: Tokens | null) => { try { t ? localStorage.setItem(TOKENS_KEY, JSON.stringify(t)) : localStorage.removeItem(TOKENS_KEY); } catch { /* storage blocked: session-only */ } };
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- data source
|
||||||
|
|
||||||
|
type Contact = { phone?: string; email?: string; password?: string };
|
||||||
|
|
||||||
|
export class ApiDataSource implements DataSource {
|
||||||
|
readonly kind = 'api' as const;
|
||||||
|
private tokens: Tokens | null = readTokens();
|
||||||
|
private refreshing: Promise<boolean> | null = null;
|
||||||
|
private courseCbs = new Set<(c: Course[]) => void>();
|
||||||
|
private studentCbs = new Map<(s: Student | null) => void, string>();
|
||||||
|
private inboxCbs = new Set<(i: InboxItem[]) => void>();
|
||||||
|
/** Positions reported this session; the API only tells us completion, so resume points live here until reload. */
|
||||||
|
private localProgress: Record<string, LessonProgress> = {};
|
||||||
|
|
||||||
|
readonly base: string;
|
||||||
|
constructor(base: string) { this.base = base; }
|
||||||
|
|
||||||
|
// ---- transport
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One API call. Every attempt gives up after REQUEST_TIMEOUT_MS: the server has been seen dropping new connections
|
||||||
|
* (they hang instead of failing), and a hung sign-in looks like a broken button. Calls that are safe to repeat
|
||||||
|
* (reads, the account lookup, password login) retry; ones with side effects (sending a code, verifying it) never do,
|
||||||
|
* so a learner can't get two texts or burn a code.
|
||||||
|
*/
|
||||||
|
private async request<T>(method: string, path: string, body?: unknown, auth = true, retry = method === 'GET'): Promise<T> {
|
||||||
|
const attempt = () => fetch(`${this.base.replace(/\/+$/, '')}/api/v1${path}`, {
|
||||||
|
method, headers: { 'content-type': 'application/json', ...(auth && this.tokens ? { authorization: `Bearer ${this.tokens.access}` } : {}) },
|
||||||
|
body: body === undefined ? undefined : JSON.stringify(body),
|
||||||
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
||||||
|
});
|
||||||
|
const send = async () => {
|
||||||
|
for (let i = 0; ; i++) {
|
||||||
|
try { return await attempt(); }
|
||||||
|
catch { if (!retry || i >= REQUEST_RETRIES) throw new ApiError(0, "Couldn't reach the server."); }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let res = await send();
|
||||||
|
if (res.status === 401 && auth && this.tokens && (await this.refresh())) res = await send();
|
||||||
|
const json = await res.json().catch(() => null);
|
||||||
|
// Some endpoints answer `success: false` on a 200, so the HTTP status is what counts.
|
||||||
|
if (!res.ok) throw new ApiError(res.status, json?.message || json?.error || res.statusText);
|
||||||
|
return (json && 'data' in json ? json.data : json) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
private refresh(): Promise<boolean> {
|
||||||
|
if (!this.tokens) return Promise.resolve(false);
|
||||||
|
this.refreshing ??= fetch(`${this.base.replace(/\/+$/, '')}/api/v1/auth/refresh`, {
|
||||||
|
method: 'POST', headers: { 'content-type': 'application/json' },
|
||||||
|
body: JSON.stringify({ access_token: this.tokens.access, refresh_token: this.tokens.refresh }),
|
||||||
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
||||||
|
}).then(async (r) => {
|
||||||
|
const j = await r.json().catch(() => null);
|
||||||
|
if (!r.ok || !j?.data?.access_token) { this.setTokens(null); return false; }
|
||||||
|
this.setTokens({ access: j.data.access_token, refresh: j.data.refresh_token, userId: j.data.user_id });
|
||||||
|
return true;
|
||||||
|
}, () => false).finally(() => { this.refreshing = null; });
|
||||||
|
return this.refreshing;
|
||||||
|
}
|
||||||
|
|
||||||
|
private setTokens(t: Tokens | null) { this.tokens = t; writeTokens(t); }
|
||||||
|
|
||||||
|
// ---- auth (the screens reach this through `ds.auth` when it exists; the demo has none)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Phone: existing learners get a login code (resend-otp → customer-login with otp_code); new ones get a register
|
||||||
|
* code (sendRegisterCode → verify-otp). Email: password login; an unknown email registers and confirms by code.
|
||||||
|
* The exact endpoint pairing is our reading of the spec and still needs confirming with the backend.
|
||||||
|
*/
|
||||||
|
readonly auth = {
|
||||||
|
signedIn: () => !!this.tokens,
|
||||||
|
/** 'code' when the learner must enter a one-time code next; 'done' when they're signed in already. */
|
||||||
|
start: async (c: Contact): Promise<'code' | 'done'> => {
|
||||||
|
const who = c.phone ? { phone_number: c.phone } : { email: c.email };
|
||||||
|
const exists = await this.request<{ email_exist: boolean; phone_number_exist: boolean }>('POST', '/user/checkPhoneEmailExist', who, false, true);
|
||||||
|
const known = c.phone ? exists.phone_number_exist : exists.email_exist;
|
||||||
|
if (c.email && known) { await this.login({ email: c.email, password: c.password }); return 'done'; }
|
||||||
|
if (c.phone && known) { await this.request('POST', '/user/resend-otp', who, false); return 'code'; }
|
||||||
|
if (c.phone) await this.request('POST', '/user/sendRegisterCode', who, false);
|
||||||
|
else await this.request('POST', '/user/register', { email: c.email, password: c.password }, false);
|
||||||
|
return 'code';
|
||||||
|
},
|
||||||
|
verify: async (c: Contact, code: string): Promise<void> => {
|
||||||
|
const who = c.phone ? { phone_number: c.phone } : { email: c.email };
|
||||||
|
const exists = await this.request<{ email_exist: boolean; phone_number_exist: boolean }>('POST', '/user/checkPhoneEmailExist', who, false, true);
|
||||||
|
if (c.phone && exists.phone_number_exist) { await this.login({ phone_number: c.phone, otp_code: code }); return; }
|
||||||
|
const t = await this.request<{ access_token: string; refresh_token: string; user_id: number }>('POST', '/user/verify-otp', { ...who, otp: code }, false);
|
||||||
|
this.setTokens({ access: t.access_token, refresh: t.refresh_token, userId: t.user_id });
|
||||||
|
this.refreshAll();
|
||||||
|
},
|
||||||
|
signOut: async () => {
|
||||||
|
const t = this.tokens;
|
||||||
|
this.setTokens(null);
|
||||||
|
if (t) await this.request('POST', '/auth/logout', { refresh_token: t.refresh }, false).catch(() => { /* already gone server-side */ });
|
||||||
|
this.localProgress = {};
|
||||||
|
this.refreshAll();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
private async login(body: Record<string, unknown>) {
|
||||||
|
const t = await this.request<{ access_token: string; refresh_token: string; user_id: number }>('POST', '/auth/customer-login', body, false, !body.otp_code); // a code is single-use: no retry
|
||||||
|
this.setTokens({ access: t.access_token, refresh: t.refresh_token, userId: t.user_id });
|
||||||
|
this.refreshAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- reads
|
||||||
|
|
||||||
|
async viewer(): Promise<Viewer> {
|
||||||
|
const none: Viewer = { id: null, name: '', avatarUrl: '', isOwner: false, canEdit: false };
|
||||||
|
if (!this.tokens) return none;
|
||||||
|
try {
|
||||||
|
const p = await this.request<RawProfile>('GET', '/user/user-profile');
|
||||||
|
return { id: String(p.id), name: [p.first_name, p.last_name].filter(Boolean).join(' '), avatarUrl: '', isOwner: false, canEdit: true };
|
||||||
|
} catch { return none; }
|
||||||
|
}
|
||||||
|
async names() { return {}; }
|
||||||
|
|
||||||
|
private async loadCourses(): Promise<Course[]> {
|
||||||
|
const page = await this.request<{ courses: RawCourse[]; total_count: number }>('GET', '/catalog/courses?limit=100', undefined, false);
|
||||||
|
const outlines = await mapLimit(page.courses, PARALLEL, (c) => this.request<RawOutline>('GET', `/catalog/courses/${c.id}`, undefined, false).catch(() => null));
|
||||||
|
const courses = outlines.filter((o): o is RawOutline => !!o).map((o) => mapOutline(o, this.base));
|
||||||
|
if (this.tokens) await mapLimit(courses.flatMap((c) => c.chapters), PARALLEL, async (ch) => {
|
||||||
|
// Signed in: lesson video URLs (and sort order) only come from the authenticated lesson list.
|
||||||
|
const r = await this.request<{ lessons: RawLesson[] }>('GET', `/chapters/${ids.num(ch.id)}/lessons?limit=200`).catch(() => null);
|
||||||
|
for (const l of r?.lessons ?? []) {
|
||||||
|
const m = ch.lessons.find((x) => x.id === ids.lesson(l.id));
|
||||||
|
if (m) { m.videoAssetId = l.video_url || m.videoAssetId; if (l.sort_order != null) m.sortOrder = l.sort_order; }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return courses;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async loadStudent(): Promise<Student | null> {
|
||||||
|
if (!this.tokens) return null;
|
||||||
|
const [p, summary, issues] = await Promise.all([
|
||||||
|
this.request<RawProfile>('GET', '/user/user-profile'),
|
||||||
|
this.request<RawSummary>('GET', '/progress-summary').catch(() => null),
|
||||||
|
this.request<{ issues: RawIssue[] }>('GET', '/issues/me?limit=100').catch(() => ({ issues: [] })),
|
||||||
|
]);
|
||||||
|
return mapStudent(p, summary, issues.issues ?? [], this.localProgress, new Date().toISOString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async loadInbox(): Promise<InboxItem[]> {
|
||||||
|
if (!this.tokens) return [];
|
||||||
|
const r = await this.request<{ notifications: RawNotification[] }>('GET', '/notifications?limit=100');
|
||||||
|
return (r.notifications ?? []).map(mapNotification);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Re-runs every watcher, e.g. after sign-in, sign-out or a write the server changes state for. */
|
||||||
|
refreshAll() {
|
||||||
|
if (this.courseCbs.size) this.loadCourses().then((c) => this.courseCbs.forEach((cb) => cb(c)), (e) => console.warn('courses', e));
|
||||||
|
this.refreshStudent();
|
||||||
|
if (this.inboxCbs.size) this.loadInbox().then((i) => this.inboxCbs.forEach((cb) => cb(i)), () => this.inboxCbs.forEach((cb) => cb([])));
|
||||||
|
}
|
||||||
|
private refreshStudent() {
|
||||||
|
if (!this.studentCbs.size) return;
|
||||||
|
this.loadStudent().then((s) => this.studentCbs.forEach((_, cb) => cb(s)), (e) => { console.warn('student', e); this.studentCbs.forEach((_, cb) => cb(null)); });
|
||||||
|
}
|
||||||
|
|
||||||
|
watchCourses(cb: (c: Course[]) => void): Unsub {
|
||||||
|
this.courseCbs.add(cb);
|
||||||
|
this.loadCourses().then((c) => { if (this.courseCbs.has(cb)) cb(c); }, (e) => { console.warn('courses', e); if (this.courseCbs.has(cb)) cb([]); });
|
||||||
|
return () => { this.courseCbs.delete(cb); };
|
||||||
|
}
|
||||||
|
watchStudent(id: string, cb: (s: Student | null) => void): Unsub {
|
||||||
|
this.studentCbs.set(cb, id);
|
||||||
|
this.loadStudent().then((s) => { if (this.studentCbs.has(cb)) cb(s); }, () => { if (this.studentCbs.has(cb)) cb(null); });
|
||||||
|
return () => { this.studentCbs.delete(cb); };
|
||||||
|
}
|
||||||
|
watchInbox(_studentId: string, cb: (i: InboxItem[]) => void): Unsub {
|
||||||
|
this.inboxCbs.add(cb);
|
||||||
|
this.loadInbox().then((i) => { if (this.inboxCbs.has(cb)) cb(i); }, () => { if (this.inboxCbs.has(cb)) cb([]); });
|
||||||
|
return () => { this.inboxCbs.delete(cb); };
|
||||||
|
}
|
||||||
|
// Not on the API: categories, app settings (the screens fall back to their defaults) and the admin collections.
|
||||||
|
watchCategories(cb: (c: Category[]) => void): Unsub { cb([]); return () => {}; }
|
||||||
|
watchSettings(cb: (s: Settings | null) => void): Unsub { cb(null); return () => {}; }
|
||||||
|
watchStudents(cb: (s: Student[]) => void): Unsub { cb([]); return () => {}; }
|
||||||
|
watchCampaigns(cb: (c: Campaign[]) => void): Unsub { cb([]); return () => {}; }
|
||||||
|
watchAudit(cb: (a: AuditEntry[]) => void): Unsub { cb([]); return () => {}; }
|
||||||
|
|
||||||
|
// ---- writes
|
||||||
|
|
||||||
|
/** Profile setup after a first sign-in. */
|
||||||
|
async saveStudent(s: Student) {
|
||||||
|
const [first_name, ...rest] = s.name.trim().split(/\s+/);
|
||||||
|
await this.request('PUT', '/user', { first_name, last_name: rest.join(' '), country: s.country, region: s.city, preferred_language: s.locale });
|
||||||
|
this.refreshStudent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The screens write partial student records; each key maps to the endpoint that owns it.
|
||||||
|
* Keys the API has no home for (watch time, notification prefs, last active) stay local.
|
||||||
|
*/
|
||||||
|
async patchStudent(_id: string, patch: Record<string, unknown>) {
|
||||||
|
const jobs: Promise<unknown>[] = [];
|
||||||
|
if (patch.orders) throw notConnected('Buying a course');
|
||||||
|
const progress = patch.progress as Record<string, LessonProgress> | undefined;
|
||||||
|
for (const [lessonId, p] of Object.entries(progress ?? {})) {
|
||||||
|
this.localProgress[lessonId] = { ...this.localProgress[lessonId], ...p };
|
||||||
|
jobs.push(this.request('POST', '/videos/engagement/heartbeat', {
|
||||||
|
content_id: ids.num(lessonId), content_kind: 'lms_lesson', position_sec: Math.floor(p.positionSec),
|
||||||
|
// durations aren't on the API, so the furthest point reached stands in for the length
|
||||||
|
duration_sec: Math.max(1, Math.floor(p.maxPositionSec ?? p.positionSec)), ended: !!p.completedAt,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
for (const i of Object.values((patch.issues ?? {}) as Record<string, Partial<Issue>>)) {
|
||||||
|
if (!i.subject) continue; // status changes are the support team's, not the learner's
|
||||||
|
jobs.push(this.request('POST', '/issues', { subject: i.subject, description: i.description ?? '', issue_type: (i.type ?? 'OTHER').toLowerCase() }));
|
||||||
|
}
|
||||||
|
const profile: Record<string, unknown> = {};
|
||||||
|
if (typeof patch.locale === 'string') profile.preferred_language = patch.locale;
|
||||||
|
if (typeof patch.name === 'string') { const [f, ...r] = patch.name.trim().split(/\s+/); profile.first_name = f; profile.last_name = r.join(' '); }
|
||||||
|
if (typeof patch.country === 'string') profile.country = patch.country;
|
||||||
|
if (typeof patch.city === 'string') profile.region = patch.city;
|
||||||
|
if (Object.keys(profile).length) jobs.push(this.request('PUT', '/user', profile));
|
||||||
|
await Promise.all(jobs);
|
||||||
|
this.refreshStudent();
|
||||||
|
}
|
||||||
|
|
||||||
|
async patchInbox(_studentId: string, id: string, patch: Partial<InboxItem>) {
|
||||||
|
if (patch.readAt !== undefined) await this.request('PATCH', `/notifications/${id}/${patch.readAt ? 'read' : 'unread'}`);
|
||||||
|
if (this.inboxCbs.size) this.loadInbox().then((i) => this.inboxCbs.forEach((cb) => cb(i)), () => {});
|
||||||
|
}
|
||||||
|
/** The server writes its own notifications (payment, issue updates); the client never adds to a learner's inbox. */
|
||||||
|
async addInbox() {}
|
||||||
|
|
||||||
|
async saveCourse() { throw notConnected('Course editing'); }
|
||||||
|
async deleteCourse() { throw notConnected('Course editing'); }
|
||||||
|
async saveCategory() { throw notConnected('Categories'); }
|
||||||
|
async deleteCategory() { throw notConnected('Categories'); }
|
||||||
|
async saveSettings() { throw notConnected('Settings'); }
|
||||||
|
async saveCampaign() { throw notConnected('Campaigns'); }
|
||||||
|
async addAudit() {}
|
||||||
|
|
||||||
|
async uploads() { return null; }
|
||||||
|
assetUrl(id: string) { return absolute(this.base, id) ?? ''; }
|
||||||
|
async download() { return false; }
|
||||||
|
async feedback() { return false; }
|
||||||
|
async feedbackAvailable() { return false; }
|
||||||
|
}
|
||||||
1
packages/data/src/fixtures-catalog.json
Normal file
1
packages/data/src/fixtures-catalog.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"message":"Course highlights retrieved","data":{"courses":[{"id":2,"name":"Intermediate","description":"Default program for the intermediate level.","thumbnail":"","access_tier":"PREMIUM","chapter_count":2,"lesson_count":0,"quiz_count":0},{"id":1,"name":"Beginner","description":"Default program for the beginner level.","thumbnail":"","access_tier":"PREMIUM","chapter_count":2,"lesson_count":0,"quiz_count":0},{"id":3,"name":"Advanced","description":"Default program for the advanced level.","thumbnail":"","access_tier":"PREMIUM","chapter_count":2,"lesson_count":0,"quiz_count":0},{"id":12,"name":"Everyday English","description":"Build confidence with introductions, daily conversations, and practical vocabulary.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE","chapter_count":2,"lesson_count":6,"quiz_count":2},{"id":13,"name":"Workplace Communication","description":"Communicate clearly in meetings, write effective messages, and present your ideas.","thumbnail":"/static/demo/course-cover.svg","access_tier":"PREMIUM","chapter_count":2,"lesson_count":6,"quiz_count":2},{"id":14,"name":"Digital Skills Essentials","description":"Learn practical habits for working online, organizing information, and collaborating safely.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE","chapter_count":2,"lesson_count":6,"quiz_count":2}],"total_count":6,"limit":50,"offset":0},"success":true,"status_code":200,"metadata":null}
|
||||||
1
packages/data/src/fixtures-outline-12.json
Normal file
1
packages/data/src/fixtures-outline-12.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"message":"Course outline retrieved","data":{"id":12,"name":"Everyday English","description":"Build confidence with introductions, daily conversations, and practical vocabulary.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE","chapter_count":2,"lesson_count":6,"quiz_count":2,"chapters":[{"id":19,"name":"Meet and greet","description":"Practice the key ideas through short lessons and a chapter review quiz.","lessons":[{"id":38,"title":"Introduce yourself","description":"In this demo lesson, explore how to introduce yourself. Review the examples, try it yourself, and complete the chapter quiz. The video is sample media for testing playback.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE"},{"id":39,"title":"Ask friendly questions","description":"In this demo lesson, explore how to ask friendly questions. Review the examples, try it yourself, and complete the chapter quiz. The video is sample media for testing playback.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE"},{"id":40,"title":"Start a conversation","description":"In this demo lesson, explore how to start a conversation. Review the examples, try it yourself, and complete the chapter quiz. The video is sample media for testing playback.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE"}],"quizzes":[{"id":14,"title":"Meet and greet review","question_count":3}]},{"id":20,"name":"Everyday situations","description":"Practice the key ideas through short lessons and a chapter review quiz.","lessons":[{"id":41,"title":"Order food and drinks","description":"In this demo lesson, explore how to order food and drinks. Review the examples, try it yourself, and complete the chapter quiz. The video is sample media for testing playback.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE"},{"id":42,"title":"Ask for directions","description":"In this demo lesson, explore how to ask for directions. Review the examples, try it yourself, and complete the chapter quiz. The video is sample media for testing playback.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE"},{"id":43,"title":"Make simple plans","description":"In this demo lesson, explore how to make simple plans. Review the examples, try it yourself, and complete the chapter quiz. The video is sample media for testing playback.","thumbnail":"/static/demo/course-cover.svg","access_tier":"FREE"}],"quizzes":[{"id":15,"title":"Everyday situations review","question_count":3}]}]},"success":true,"status_code":200,"metadata":null}
|
||||||
|
|
@ -109,9 +109,19 @@ export interface Viewer { id: string | null; name: string; avatarUrl: string; is
|
||||||
|
|
||||||
export type Unsub = () => void;
|
export type Unsub = () => void;
|
||||||
|
|
||||||
|
/** Real sign-in, present only on data sources backed by an account system (the API); the demo simulates it. */
|
||||||
|
export interface AuthApi {
|
||||||
|
signedIn(): boolean;
|
||||||
|
/** Starts sign-in or sign-up for a phone, or an email with password: 'code' means a one-time code was sent. */
|
||||||
|
start(c: { phone?: string; email?: string; password?: string }): Promise<'code' | 'done'>;
|
||||||
|
verify(c: { phone?: string; email?: string; password?: string }, code: string): Promise<void>;
|
||||||
|
signOut(): Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
/** Everything a screen may ask of the backend. */
|
/** Everything a screen may ask of the backend. */
|
||||||
export interface DataSource {
|
export interface DataSource {
|
||||||
readonly kind: 'claude-db' | 'api';
|
readonly kind: 'claude-db' | 'api';
|
||||||
|
readonly auth?: AuthApi;
|
||||||
viewer(): Promise<Viewer>;
|
viewer(): Promise<Viewer>;
|
||||||
/** Display names for stored user ids (never store names). */
|
/** Display names for stored user ids (never store names). */
|
||||||
names(ids: string[]): Promise<Record<string, string>>;
|
names(ids: string[]): Promise<Record<string, string>>;
|
||||||
|
|
@ -227,3 +237,5 @@ export class ClaudeDbDataSource implements DataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const newId = (prefix = '') => prefix + Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
|
export const newId = (prefix = '') => prefix + Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
|
||||||
|
|
||||||
|
export { ApiDataSource, ApiError } from './api';
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ interface Ctx {
|
||||||
/** Serialized writes: the db wants one write at a time per document. */
|
/** Serialized writes: the db wants one write at a time per document. */
|
||||||
write(fn: () => Promise<void>, okMsg?: string): Promise<boolean>;
|
write(fn: () => Promise<void>, okMsg?: string): Promise<boolean>;
|
||||||
signIn(): void; signOut(): void;
|
signIn(): void; signOut(): void;
|
||||||
|
/** Re-reads who is signed in, after a real (API) sign-in. */
|
||||||
|
reloadViewer(): Promise<void>;
|
||||||
notify(studentId: string, item: Omit<InboxItem, 'id' | 'createdAt'>): Promise<void>;
|
notify(studentId: string, item: Omit<InboxItem, 'id' | 'createdAt'>): Promise<void>;
|
||||||
msg(loc: Locale, key: string, vars?: Record<string, string | number>): string;
|
msg(loc: Locale, key: string, vars?: Record<string, string | number>): string;
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +142,9 @@ export function AppProvider({ ds, children }: { ds: DataSource; children: ReactN
|
||||||
me: me && !me.deletedAt && !signedOut ? me : null, account: me, meLoaded, signedIn: !!me && !me.deletedAt && !signedOut, inbox,
|
me: me && !me.deletedAt && !signedOut ? me : null, account: me, meLoaded, signedIn: !!me && !me.deletedAt && !signedOut, inbox,
|
||||||
locale, setLocale, route, nav, toast, write,
|
locale, setLocale, route, nav, toast, write,
|
||||||
signIn: () => { store.set('signedOut', null); setSignedOut(false); },
|
signIn: () => { store.set('signedOut', null); setSignedOut(false); },
|
||||||
signOut: () => { store.set('signedOut', '1'); setSignedOut(true); },
|
// With a real account system, signing out also ends the server session and forgets the user.
|
||||||
|
signOut: () => { store.set('signedOut', '1'); setSignedOut(true); if (ds.auth) ds.auth.signOut().then(() => ds.viewer()).then(setViewer, () => {}); },
|
||||||
|
reloadViewer: async () => { setViewer(await ds.viewer()); },
|
||||||
notify, msg,
|
notify, msg,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,25 +33,35 @@ function useCatalog() {
|
||||||
|
|
||||||
const ct = (c: Course, l: Locale) => tr(c.translations, l) ?? { title: c.slug, description: '' };
|
const ct = (c: Course, l: Locale) => tr(c.translations, l) ?? { title: c.slug, description: '' };
|
||||||
const lessonTitle = (l: Lesson, loc: Locale) => tr(l.translations, loc)?.title ?? '';
|
const lessonTitle = (l: Lesson, loc: Locale) => tr(l.translations, loc)?.title ?? '';
|
||||||
|
/** Length as text, or '' when unknown (the API carries no durations yet), so no screen shows "0 min". */
|
||||||
|
const dur = (sec: number) => (sec > 0 ? formatDuration(sec) : '');
|
||||||
|
const withDur = (sec: number, before = ' · ') => (sec > 0 ? `${before}${formatDuration(sec)}` : '');
|
||||||
const lessonNumber = (c: Course, id: string) => publishedLessons(c).findIndex((l) => l.id === id) + 1;
|
const lessonNumber = (c: Course, id: string) => publishedLessons(c).findIndex((l) => l.id === id) + 1;
|
||||||
|
|
||||||
function CourseCard({ c }: { c: Course }) {
|
// C1: one quiet "lessons · length" line, with "new course" / student count as a tag on the photo.
|
||||||
|
// C2: the whole card is the target, so the footer is just the price. C3: owned cards say what's next.
|
||||||
|
// `tall` keeps the photo-on-top layout on phones too (the home Featured rail, C4).
|
||||||
|
function CourseCard({ c, tall }: { c: Course; tall?: boolean }) {
|
||||||
const { locale, nav, me, signedIn } = useApp();
|
const { locale, nav, me, signedIn } = useApp();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { catName } = useCatalog();
|
const { catName } = useCatalog();
|
||||||
const p = courseProgress(c, me);
|
const p = courseProgress(c, me);
|
||||||
const mine = signedIn && owns(me, c.id);
|
const mine = signedIn && owns(me, c.id);
|
||||||
|
const r = mine ? resumePoint(c, me) : null;
|
||||||
|
const tag = c.enrolledCount ? t('course.enrolled', { n: c.enrolledCount }) : t('course.newCourse');
|
||||||
return (
|
return (
|
||||||
<button className="ccard" onClick={() => nav(`/${locale}/course/${c.slug}`)}>
|
<button className={`ccard${tall ? ' ccard-tall' : ''}`} onClick={() => nav(`/${locale}/course/${c.slug}`)}>
|
||||||
<Cover course={c} locale={locale} badge={<span className="pill">{catName(c.categoryId)}</span>} />
|
<Cover course={c} locale={locale} badge={<>{catName(c.categoryId) && <span className="pill">{catName(c.categoryId)}</span>}{!mine && <span className="ccard-tag">{tag}</span>}</>} />
|
||||||
<div className="ccard-body">
|
<div className="ccard-body">
|
||||||
<h3>{ct(c, locale).title}</h3>
|
<h3>{ct(c, locale).title}</h3>
|
||||||
<span className="meta"><span><Icon name="video" size={14} />{t('course.lessons', { n: p.total })}</span><span><Icon name="clock" size={14} />{formatDuration(courseDuration(c))}</span><span><Icon name="users" size={14} />{c.enrolledCount ? t('course.enrolled', { n: c.enrolledCount }) : t('course.newCourse')}</span></span>
|
<span className="meta num">{t('course.lessons', { n: p.total })}{withDur(courseDuration(c))}</span>
|
||||||
<span className="ccard-by">{t('course.by', { name: c.instructorName })}</span>
|
{c.instructorName && <span className="ccard-by">{t('course.by', { name: c.instructorName })}</span>}
|
||||||
<div className="ccard-foot">
|
{(mine || c.prices.ETB != null) && <div className="ccard-foot">
|
||||||
{mine ? <><div className="bar grow" aria-label={`${p.pct}%`}><i style={{ width: `${p.pct}%` }} /></div><span className="small num">{p.pct}%</span></>
|
{mine ? <>
|
||||||
: <>{c.prices.ETB != null ? <strong className="num">{formatMoney(c.prices.ETB, 'ETB')}</strong> : <span />}<span className="ccard-go" aria-hidden><Icon name="chevron" size={18} /></span></>}
|
{r && <span className="ccard-next">{p.pct === 100 ? <b>{t('course.completed')}</b> : <><b>{t('player.upNext')}</b> {r.index + 1}. {lessonTitle(r.lesson, locale)}<span className="num">{withDur(r.lesson.durationSec)}</span></>}</span>}
|
||||||
</div>
|
<span className="ccard-prog"><span className="bar grow" aria-label={`${p.pct}%`}><i style={{ width: `${p.pct}%` }} /></span><span className="small num">{p.pct}%</span></span>
|
||||||
|
</> : <strong className="num">{formatMoney(c.prices.ETB!, 'ETB')}</strong>}
|
||||||
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
@ -92,9 +102,10 @@ export function StudentApp() {
|
||||||
const tabs: [string, string, string][] = [['', 'home', t('nav.home')], ['courses', 'grid', t('nav.courses')], ['my', 'book', t('nav.myCourses')], ['help', 'help', t('nav.help')], ['profile', 'user', t('nav.profile')]];
|
const tabs: [string, string, string][] = [['', 'home', t('nav.home')], ['courses', 'grid', t('nav.courses')], ['my', 'book', t('nav.myCourses')], ['help', 'help', t('nav.help')], ['profile', 'user', t('nav.profile')]];
|
||||||
const links = tabs.filter(([p]) => p !== 'profile' && (p !== 'my' || signedIn));
|
const links = tabs.filter(([p]) => p !== 'profile' && (p !== 'my' || signedIn));
|
||||||
const current = (s: string) => (s === section || (s === 'courses' && (section === 'course')) || (s === 'profile' && (section === 'progress' || section === 'history')) ? 'page' : undefined);
|
const current = (s: string) => (s === section || (s === 'courses' && (section === 'course')) || (s === 'profile' && (section === 'progress' || section === 'history')) ? 'page' : undefined);
|
||||||
|
const focus = section === 'learn'; // L1: watching a lesson drops the site links and the marketing footer
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div lang={locale}>
|
<div lang={locale} className={focus ? 's-focus' : undefined}>
|
||||||
<header className={`s-top${scrolled ? ' scrolled' : ''}`}>
|
<header className={`s-top${scrolled ? ' scrolled' : ''}`}>
|
||||||
<div className="s-top-in">
|
<div className="s-top-in">
|
||||||
<button className="brand" onClick={() => go('')} aria-label={settings.brandName}><Logo size={36} /><Logo size={36} mark /></button>
|
<button className="brand" onClick={() => go('')} aria-label={settings.brandName}><Logo size={36} /><Logo size={36} mark /></button>
|
||||||
|
|
@ -135,7 +146,7 @@ export function StudentApp() {
|
||||||
{settings.maintenanceBanner && <div className="banner small" role="status">{settings.maintenanceBanner}</div>}
|
{settings.maintenanceBanner && <div className="banner small" role="status">{settings.maintenanceBanner}</div>}
|
||||||
<StudentRoutes />
|
<StudentRoutes />
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
{!focus && <Footer />}
|
||||||
{signedIn && section !== 'learn' && section !== 'course' && <nav className="s-tabs" aria-label="Main">
|
{signedIn && section !== 'learn' && section !== 'course' && <nav className="s-tabs" aria-label="Main">
|
||||||
{tabs.map(([p, icon, label]) => <button key={p} data-tour={p} aria-current={current(p)} onClick={() => go(p ? '/' + p : '')}><Icon name={icon} size={22} />{label}</button>)}
|
{tabs.map(([p, icon, label]) => <button key={p} data-tour={p} aria-current={current(p)} onClick={() => go(p ? '/' + p : '')}><Icon name={icon} size={22} />{label}</button>)}
|
||||||
</nav>}
|
</nav>}
|
||||||
|
|
@ -462,33 +473,44 @@ function Home() {
|
||||||
const others = visible.filter((c) => !owns(me, c.id));
|
const others = visible.filter((c) => !owns(me, c.id));
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1 style={{ fontSize: 'var(--fs-2xl)' }}>{t('home.hello', { name: me?.name.split(' ')[0] ?? '' })}</h1>
|
<div className="home-top">
|
||||||
{cont ? <ContinueCard c={cont} /> : <Empty action={<button className="btn" onClick={() => nav(`/${locale}/courses`)}>{t('landing.browse')}</button>}>{t('home.emptyMine')}</Empty>}
|
<h1 style={{ fontSize: 'var(--fs-2xl)' }}>{t('home.hello', { name: me?.name.split(' ')[0] ?? '' })}</h1>
|
||||||
|
{cont ? <ContinueCard c={cont} /> : <Empty action={<button className="btn" onClick={() => nav(`/${locale}/courses`)}>{t('landing.browse')}</button>}>{t('home.emptyMine')}</Empty>}
|
||||||
|
</div>
|
||||||
{mine.length > 1 && <section className="stack"><div className="section-h"><h2>{t('nav.myCourses')}</h2><button className="link" onClick={() => nav(`/${locale}/my`)}>{t('my.viewProgress')}</button></div><div className="grid-cards">{mine.map((c) => <CourseCard key={c.id} c={c} />)}</div></section>}
|
{mine.length > 1 && <section className="stack"><div className="section-h"><h2>{t('nav.myCourses')}</h2><button className="link" onClick={() => nav(`/${locale}/my`)}>{t('my.viewProgress')}</button></div><div className="grid-cards">{mine.map((c) => <CourseCard key={c.id} c={c} />)}</div></section>}
|
||||||
<section className="stack">
|
<section className="stack">
|
||||||
<div className="section-h"><h2>{t('home.categories')}</h2></div>
|
<div className="section-h"><h2>{t('home.categories')}</h2></div>
|
||||||
<div className="chips">{categories.filter((c) => c.isActive).map((c) => <button key={c.id} className="chip" onClick={() => nav(`/${locale}/courses/${c.slug}`)}>{tr(c.translations, locale)?.name}</button>)}</div>
|
<div className="chips">{categories.filter((c) => c.isActive).map((c) => <button key={c.id} className="chip" onClick={() => nav(`/${locale}/courses/${c.slug}`)}>{tr(c.translations, locale)?.name}</button>)}</div>
|
||||||
</section>
|
</section>
|
||||||
{others.length > 0 && <section className="stack"><div className="section-h"><h2>{others.some((c) => c.isFeatured) ? t('home.featured') : t('home.new')}</h2><button className="link" onClick={() => nav(`/${locale}/courses`)}>{t('catalog.title')}</button></div><div className="grid-cards">{[...others.filter((c) => c.isFeatured), ...others.filter((c) => !c.isFeatured)].slice(0, 4).map((c) => <CourseCard key={c.id} c={c} />)}</div></section>}
|
{others.length > 0 && <section className="stack"><div className="section-h"><h2>{others.some((c) => c.isFeatured) ? t('home.featured') : t('home.new')}</h2><button className="link" onClick={() => nav(`/${locale}/courses`)}>{t('catalog.title')}</button></div><div className="rail">{[...others.filter((c) => c.isFeatured), ...others.filter((c) => !c.isFeatured)].slice(0, 4).map((c) => <CourseCard key={c.id} c={c} tall />)}</div></section>}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// H1/H2: a short photo header carries the course and its progress; the body leads with the next lesson and how long
|
||||||
|
// it takes, with the button at the bottom where a thumb reaches it.
|
||||||
function ContinueCard({ c }: { c: Course }) {
|
function ContinueCard({ c }: { c: Course }) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { me, locale, nav } = useApp();
|
const { me, locale, nav, ds, categories } = useApp();
|
||||||
const p = courseProgress(c, me);
|
const p = courseProgress(c, me);
|
||||||
const r = resumePoint(c, me);
|
const r = resumePoint(c, me);
|
||||||
|
const finished = p.pct === 100;
|
||||||
|
const photo = c.coverAssetId ? ds.assetUrl(c.coverAssetId) : coursePhoto(c, categories.map((k) => k.id));
|
||||||
return (
|
return (
|
||||||
<section className="continue" aria-label={t('home.continue')}>
|
<section className="continue" aria-label={t('home.continue')}>
|
||||||
<Cover course={c} locale={locale} />
|
<div className="continue-media">
|
||||||
<div className="stack-sm">
|
<img src={photo} alt="" />
|
||||||
<span className="small" style={{ opacity: .8 }}>{t('home.continue')}</span>
|
<span className="continue-kicker">{t('home.continue')}</span>
|
||||||
<h2 style={{ fontSize: 'var(--fs-xl)' }}>{ct(c, locale).title}</h2>
|
<h2>{ct(c, locale).title}</h2>
|
||||||
{r && <p style={{ opacity: .85 }}>{r.index + 1}. {lessonTitle(r.lesson, locale)}</p>}
|
<span className="continue-bar" role="progressbar" aria-valuenow={p.pct} aria-valuemin={0} aria-valuemax={100} aria-label={t('my.lessonsDone', { done: p.done, total: p.total })}><i style={{ width: `${p.pct}%` }} /></span>
|
||||||
<div className="bar"><i style={{ width: `${p.pct}%` }} /></div>
|
</div>
|
||||||
<span className="small num" style={{ opacity: .8 }}>{t('my.lessonsDone', { done: p.done, total: p.total })}</span>
|
<div className="continue-body">
|
||||||
{r && <div><button className="btn btn-accent" onClick={() => nav(`/${locale}/learn/${c.slug}/${r.lesson.id}`)}><Icon name="play" size={16} />{p.pct === 100 ? t('course.watchAgain') : t('course.continue', { n: r.index + 1 })}</button></div>}
|
{r && <p className="continue-next">
|
||||||
|
<span>{finished ? t('course.completed') : t('player.upNext')}</span>
|
||||||
|
<strong>{r.index + 1}. {lessonTitle(r.lesson, locale)}</strong>
|
||||||
|
<span className="num">{[dur(r.lesson.durationSec), t('my.lessonsDone', { done: p.done, total: p.total })].filter(Boolean).join(' · ')}</span>
|
||||||
|
</p>}
|
||||||
|
{r && <button className="btn btn-accent btn-lg" onClick={() => nav(`/${locale}/learn/${c.slug}/${r.lesson.id}`)}><Icon name="play" size={16} />{finished ? t('course.watchAgain') : t('course.continue', { n: r.index + 1 })}</button>}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|
@ -501,27 +523,43 @@ function Catalog({ categorySlug }: { categorySlug?: string }) {
|
||||||
const { categories, locale, nav, catalogLoaded } = useApp();
|
const { categories, locale, nav, catalogLoaded } = useApp();
|
||||||
const { visible, catName } = useCatalog();
|
const { visible, catName } = useCatalog();
|
||||||
const [q, setQ] = useState('');
|
const [q, setQ] = useState('');
|
||||||
const [dq, setDq] = useState('');
|
const [lang, setLang] = useState(''); // '' = any language the course is taught in (CT3)
|
||||||
useEffect(() => { const id = setTimeout(() => setDq(q.trim().toLowerCase()), 300); return () => clearTimeout(id); }, [q]);
|
const searchRef = useRef<HTMLInputElement>(null);
|
||||||
|
const dq = q.trim().toLowerCase(); // the list is in memory: filter on every keystroke, no debounce (CT2)
|
||||||
const cat = categories.find((c) => c.slug === categorySlug);
|
const cat = categories.find((c) => c.slug === categorySlug);
|
||||||
const list = visible.filter((c) => (!cat || c.categoryId === cat.id) && (!dq || [
|
const langs = [...new Set(visible.map((c) => c.instructionLocale))];
|
||||||
|
const list = visible.filter((c) => (!cat || c.categoryId === cat.id) && (!lang || c.instructionLocale === lang) && (!dq || [
|
||||||
...Object.values(c.translations).map((x) => x?.title ?? ''), c.instructorName,
|
...Object.values(c.translations).map((x) => x?.title ?? ''), c.instructorName,
|
||||||
...Object.values(categories.find((k) => k.id === c.categoryId)?.translations ?? {}).map((x) => x?.name ?? ''),
|
...Object.values(categories.find((k) => k.id === c.categoryId)?.translations ?? {}).map((x) => x?.name ?? ''),
|
||||||
].some((s) => s.toLowerCase().includes(dq))));
|
].some((s) => s.toLowerCase().includes(dq))));
|
||||||
|
const clear = () => { setQ(''); searchRef.current?.focus(); };
|
||||||
return (
|
return (
|
||||||
<section className="stack">
|
<section className="stack">
|
||||||
<h1 style={{ fontSize: 'var(--fs-2xl)' }}>{cat ? catName(cat.id) : t('catalog.title')}</h1>
|
<h1 style={{ fontSize: 'var(--fs-2xl)' }}>{cat ? catName(cat.id) : t('catalog.title')}</h1>
|
||||||
<label className="field"><span className="sr-only">{t('catalog.search')}</span>
|
<label className="search">
|
||||||
<input id="search" className="input" type="search" placeholder={t('catalog.search')} value={q} onChange={(e) => setQ(e.target.value)} />
|
<span className="sr-only">{t('catalog.search')}</span>
|
||||||
|
<Icon name="search" size={18} />
|
||||||
|
<input ref={searchRef} id="search" className="input" type="search" placeholder={t('catalog.search')} value={q} onChange={(e) => setQ(e.target.value)} onKeyDown={(e) => { if (e.key === 'Escape' && q) clear(); }} />
|
||||||
|
{q && <button type="button" className="search-clear" onClick={clear} aria-label={t('catalog.clearSearch')}><Icon name="x" size={16} /></button>}
|
||||||
</label>
|
</label>
|
||||||
<div className="chips" role="group">
|
<div className="chips" role="group">
|
||||||
<button className="chip" aria-pressed={!cat} onClick={() => nav(`/${locale}/courses`)}>{t('catalog.all')}</button>
|
<button className="chip" aria-pressed={!cat} onClick={() => nav(`/${locale}/courses`)}>{t('catalog.all')}</button>
|
||||||
{categories.filter((c) => c.isActive).map((c) => <button key={c.id} className="chip" aria-pressed={cat?.id === c.id} onClick={() => nav(`/${locale}/courses/${c.slug}`)}>{tr(c.translations, locale)?.name}</button>)}
|
{categories.filter((c) => c.isActive).map((c) => <button key={c.id} className="chip" aria-pressed={cat?.id === c.id} onClick={() => nav(`/${locale}/courses/${c.slug}`)}>{tr(c.translations, locale)?.name}</button>)}
|
||||||
</div>
|
</div>
|
||||||
{!catalogLoaded ? <Skeleton h={220} n={2} /> : list.length ? <>
|
{!catalogLoaded ? <Skeleton h={220} n={2} /> : <>
|
||||||
<p className="muted small" aria-live="polite">{t('catalog.count', { n: list.length })}</p>
|
<div className="catalog-bar">
|
||||||
<div className="grid-cards">{list.map((c) => <CourseCard key={c.id} c={c} />)}</div>
|
<p className="muted small" aria-live="polite">{t('catalog.count', { n: list.length })}</p>
|
||||||
</> : <Empty action={dq ? <button className="btn btn-ghost" onClick={() => setQ('')}>{t('catalog.all')}</button> : undefined}>{dq ? t('catalog.empty', { q }) : t('catalog.emptyCategory')}</Empty>}
|
{langs.length > 1 && <label className="catalog-lang">
|
||||||
|
<span>{t('catalog.taughtIn')}</span>
|
||||||
|
<select id="catalog-lang" value={lang} onChange={(e) => setLang(e.target.value)}>
|
||||||
|
<option value="">{t('catalog.anyLanguage')}</option>
|
||||||
|
{langs.map((l) => <option key={l} value={l}>{LOCALE_NAMES[l]}</option>)}
|
||||||
|
</select>
|
||||||
|
</label>}
|
||||||
|
</div>
|
||||||
|
{list.length ? <div className="grid-cards">{list.map((c) => <CourseCard key={c.id} c={c} />)}</div>
|
||||||
|
: <Empty action={dq || lang ? <button className="btn btn-ghost" onClick={() => { setQ(''); setLang(''); }}>{t('catalog.clearFilters')}</button> : undefined}>{dq ? t('catalog.empty', { q }) : lang ? t('catalog.emptyLanguage') : t('catalog.emptyCategory')}</Empty>}
|
||||||
|
</>}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -532,9 +570,19 @@ function CoursePage({ slug }: { slug?: string }) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { courses, categories, me, locale, nav, catalogLoaded, toast, ds } = useApp();
|
const { courses, categories, me, locale, nav, catalogLoaded, toast, ds } = useApp();
|
||||||
const { catName } = useCatalog();
|
const { catName } = useCatalog();
|
||||||
const [tab, setTab] = useState('overview');
|
const [tab, setTab] = useState<string | null>(null); // null: the viewer's default (curriculum once they own it)
|
||||||
|
// The sticky bar repeats the buy card's button, so it only shows while that button is off screen (P1).
|
||||||
|
const [ctaEl, setCtaEl] = useState<HTMLDivElement | null>(null);
|
||||||
|
const [ctaInView, setCtaInView] = useState(true); // start hidden: the bar slides in once the button is known to be off screen, never flashes out on load
|
||||||
const c = courses.find((x) => x.slug === slug);
|
const c = courses.find((x) => x.slug === slug);
|
||||||
useEffect(() => { if (c) document.title = `${ct(c, locale).title} · Sirkul Makeup`; }, [c, locale]); // before the early returns: hooks must run every render
|
useEffect(() => { if (c) document.title = `${ct(c, locale).title} · Sirkul Makeup`; }, [c, locale]); // before the early returns: hooks must run every render
|
||||||
|
useEffect(() => {
|
||||||
|
if (!ctaEl || typeof IntersectionObserver === 'undefined') { setCtaInView(false); return; }
|
||||||
|
// The bottom margin is the bar's own height: a button still underneath the bar doesn't count as visible.
|
||||||
|
const io = new IntersectionObserver(([e]) => setCtaInView(e.isIntersecting), { rootMargin: '0px 0px -88px 0px' });
|
||||||
|
io.observe(ctaEl);
|
||||||
|
return () => io.disconnect();
|
||||||
|
}, [ctaEl]);
|
||||||
if (!catalogLoaded) return <Skeleton h={260} n={2} />;
|
if (!catalogLoaded) return <Skeleton h={260} n={2} />;
|
||||||
if (!c || !isStudentVisible(c, me)) return <Empty action={<button className="btn" onClick={() => nav(`/${locale}/courses`)}>{t('catalog.title')}</button>}>{t('course.notFound')}</Empty>;
|
if (!c || !isStudentVisible(c, me)) return <Empty action={<button className="btn" onClick={() => nav(`/${locale}/courses`)}>{t('catalog.title')}</button>}>{t('course.notFound')}</Empty>;
|
||||||
const text = ct(c, locale);
|
const text = ct(c, locale);
|
||||||
|
|
@ -549,21 +597,30 @@ function CoursePage({ slug }: { slug?: string }) {
|
||||||
const previews = lessons.filter((l) => l.isPreview).length;
|
const previews = lessons.filter((l) => l.isPreview).length;
|
||||||
const cat = categories.find((k) => k.id === c.categoryId);
|
const cat = categories.find((k) => k.id === c.categoryId);
|
||||||
const chapters = [...c.chapters].sort((a, b) => a.sortOrder - b.sortOrder);
|
const chapters = [...c.chapters].sort((a, b) => a.sortOrder - b.sortOrder);
|
||||||
const play = mine && r ? `/${locale}/learn/${c.slug}/${r.lesson.id}` : preview ? `/${locale}/learn/${c.slug}/${preview.id}` : null;
|
// The hero only offers the free preview; once owned, the progress card below carries the one "continue" button (P2).
|
||||||
|
const play = !mine && preview && !(c.prices.ETB == null && lessons.every((l) => l.isPreview)) ? `/${locale}/learn/${c.slug}/${preview.id}` : null;
|
||||||
const playLabel = mine && r ? (done ? t('course.watchAgain') : t('course.continue', { n: r.index + 1 })) : t('course.watchPreview');
|
const playLabel = mine && r ? (done ? t('course.watchAgain') : t('course.continue', { n: r.index + 1 })) : t('course.watchPreview');
|
||||||
const share = () => { navigator.clipboard?.writeText(location.href).then(() => toast(t('course.linkCopied')), () => { /* clipboard blocked */ }); };
|
const share = () => { navigator.clipboard?.writeText(location.href).then(() => toast(t('course.linkCopied')), () => { /* clipboard blocked */ }); };
|
||||||
const teaches = courses.filter((x) => x.instructorName === c.instructorName && isStudentVisible(x, me)).length;
|
const teaches = courses.filter((x) => x.instructorName === c.instructorName && isStudentVisible(x, me)).length;
|
||||||
// No uploaded cover in the demo → a category photo stands in on the preview card.
|
// No uploaded cover in the demo → a category photo stands in on the preview card.
|
||||||
const photo = c.coverAssetId ? ds.assetUrl(c.coverAssetId) : coursePhoto(c, categories.map((k) => k.id));
|
const photo = c.coverAssetId ? ds.assetUrl(c.coverAssetId) : coursePhoto(c, categories.map((k) => k.id));
|
||||||
const tabs: [string, string][] = [['overview', t('course.tabOverview')], ['content', t('course.content')], ['instructor', t('course.tabInstructor')]];
|
// Owners come back for the curriculum, buyers for the pitch (P4). Desktop shows one tab at a time;
|
||||||
|
// phones drop the tabs and stack every section in one scroll (P3).
|
||||||
|
const active = tab ?? (mine ? 'content' : 'overview');
|
||||||
|
const tabs: [string, string][] = [['overview', t('course.tabOverview')], ['content', t('course.content')]];
|
||||||
|
const quizzes = c.assessments ?? [];
|
||||||
|
const finalQuizzes = quizzes.filter((a) => !a.chapterId || !chapters.some((ch) => ch.id === a.chapterId && ch.lessons.some((l) => l.isPublished)));
|
||||||
|
const nextChapter = mine && r ? chapters.find((ch) => ch.lessons.some((l) => l.id === r.lesson.id))?.id : undefined;
|
||||||
const includes: [string, ReactNode][] = [
|
const includes: [string, ReactNode][] = [
|
||||||
['globe', LOCALE_NAMES[c.instructionLocale]],
|
['globe', LOCALE_NAMES[c.instructionLocale]],
|
||||||
['video', t('course.lessons', { n: lessons.length })],
|
['video', t('course.lessons', { n: lessons.length })],
|
||||||
['clock', formatDuration(courseDuration(c))],
|
...(courseDuration(c) ? [['clock', formatDuration(courseDuration(c))] as [string, ReactNode]] : []),
|
||||||
...(previews ? [['play', t('course.previewLessons', { n: previews })] as [string, ReactNode]] : []),
|
...(previews ? [['play', t('course.previewLessons', { n: previews })] as [string, ReactNode]] : []),
|
||||||
...(c.assessments?.length ? [['quiz', t('assess.title')] as [string, ReactNode]] : []),
|
...(c.assessments?.length ? [['quiz', t('assess.title')] as [string, ReactNode]] : []),
|
||||||
['shield', t('course.lifetimeAccess')],
|
|
||||||
];
|
];
|
||||||
|
const free = !mine && c.prices.ETB == null && lessons.length > 0 && lessons.every((l) => l.isPreview);
|
||||||
|
const showBar = !!(mine ? r : c.prices.ETB != null && c.status === 'PUBLISHED');
|
||||||
|
const barHidden = showBar && ctaInView;
|
||||||
return (
|
return (
|
||||||
<div className="cd">
|
<div className="cd">
|
||||||
<section className="cd-head">
|
<section className="cd-head">
|
||||||
|
|
@ -576,22 +633,21 @@ function CoursePage({ slug }: { slug?: string }) {
|
||||||
</nav>
|
</nav>
|
||||||
<span className="row" style={{ gap: 6 }}>
|
<span className="row" style={{ gap: 6 }}>
|
||||||
{c.status === 'ARCHIVED' && <StatusPill status="ARCHIVED" />}
|
{c.status === 'ARCHIVED' && <StatusPill status="ARCHIVED" />}
|
||||||
{mine && <span className="cd-chip"><Icon name="check" size={12} />{done ? t('course.completed') : t('course.owned')}</span>}
|
<button className="cd-share" onClick={share} aria-label={t('course.share')}><Icon name="share" size={16} /></button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<h1>{text.title}</h1>
|
<h1>{text.title}</h1>
|
||||||
<div className="cd-stats">
|
<div className="cd-stats">
|
||||||
<span className="cd-pill"><Icon name="video" size={14} /><strong className="num">{lessons.length}</strong>{t('course.lessonsLabel')}</span>
|
<span className="cd-pill"><Icon name="video" size={14} /><strong className="num">{lessons.length}</strong>{t('course.lessonsLabel')}</span>
|
||||||
<span className="cd-pill"><Icon name="clock" size={14} /><strong className="num">{formatDuration(courseDuration(c))}</strong></span>
|
{courseDuration(c) > 0 && <span className="cd-pill"><Icon name="clock" size={14} /><strong className="num">{formatDuration(courseDuration(c))}</strong></span>}
|
||||||
{previews > 0 && <span className="muted small">{t('course.previewLessons', { n: previews })}</span>}
|
{mine && <span className="cd-pill cd-pill-own"><Icon name="check" size={14} /><strong>{done ? t('course.completed') : t('course.owned')}</strong></span>}
|
||||||
</div>
|
</div>
|
||||||
{(text.subtitle || text.description) && <p className="cd-lead">{text.subtitle || text.description}</p>}
|
{(text.subtitle || text.description) && <p className="cd-lead">{text.subtitle || text.description}</p>}
|
||||||
{play && <button className="cd-hero-play" onClick={() => nav(play)}><span className="play-dot"><Icon name="play" size={12} /></span>{playLabel}</button>}
|
{play && <button className="cd-hero-play" onClick={() => nav(play)}><span className="play-dot"><Icon name="play" size={12} /></span>{playLabel}</button>}
|
||||||
<div className="cd-by">
|
{c.instructorName && <div className="cd-by">
|
||||||
<span className="avatar" aria-hidden>{initials(c.instructorName)}</span>
|
<span className="avatar" aria-hidden>{initials(c.instructorName)}</span>
|
||||||
<span className="cd-by-txt"><em>{t('course.createdBy')}</em><strong>{c.instructorName}</strong></span>
|
<span className="cd-by-txt"><em>{t('course.createdBy')}</em><strong>{c.instructorName}</strong><span className="cd-by-n">{t('course.teaches', { n: teaches })}</span></span>
|
||||||
<span className="cd-updated"><Icon name="calendar" size={14} />{t('course.lastUpdated')} <span className="num">{fmtDate(c.updatedAt)}</span></span>
|
</div>}
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<aside className="cd-side">
|
<aside className="cd-side">
|
||||||
|
|
@ -600,25 +656,27 @@ function CoursePage({ slug }: { slug?: string }) {
|
||||||
<div className="row-between"><strong>{done ? t('course.completed') : t('course.owned')}</strong><span className="small num">{p.pct}%</span></div>
|
<div className="row-between"><strong>{done ? t('course.completed') : t('course.owned')}</strong><span className="small num">{p.pct}%</span></div>
|
||||||
<div className="bar"><i style={{ width: `${p.pct}%` }} /></div>
|
<div className="bar"><i style={{ width: `${p.pct}%` }} /></div>
|
||||||
<span className="small muted num">{t('my.lessonsDone', { done: p.done, total: p.total })}</span>
|
<span className="small muted num">{t('my.lessonsDone', { done: p.done, total: p.total })}</span>
|
||||||
{r && <div className="cd-cta"><button className={`btn btn-lg ${done ? 'btn-ghost' : 'btn-accent'}`} onClick={() => nav(`/${locale}/learn/${c.slug}/${r.lesson.id}`)}>{playLabel}</button><button className="cd-round" onClick={share} aria-label={t('course.share')}><Icon name="share" size={18} /></button></div>}
|
{pre && !preDone && <p className="cd-prereq"><Icon name="lock" size={14} /><span>{t('course.prereq', { title: ct(pre, locale).title })} <button className="link" onClick={() => nav(`/${locale}/course/${pre.slug}`)}>{t('course.prereqLink', { title: ct(pre, locale).title })}</button></span></p>}
|
||||||
|
{r && !done && <p className="cd-next"><span>{t('player.upNext')}</span><strong>{r.index + 1}. {lessonTitle(r.lesson, locale)}</strong>{r.lesson.durationSec > 0 && <span className="num">{clock(r.lesson.durationSec)}</span>}</p>}
|
||||||
|
{r && <div className="cd-cta" ref={setCtaEl}><button className={`btn btn-lg ${done ? 'btn-ghost' : 'btn-accent'}`} onClick={() => nav(`/${locale}/learn/${c.slug}/${r.lesson.id}`)}>{playLabel}</button></div>}
|
||||||
</> : <>
|
</> : <>
|
||||||
{c.prices.ETB != null && <div className="cd-price"><span className="num">{formatMoney(c.prices.ETB, 'ETB')}</span><span>{t('course.lifetime')}</span></div>}
|
{c.prices.ETB != null && <div className="cd-price"><span className="num">{formatMoney(c.prices.ETB, 'ETB')}</span><span>{t('checkout.lifetime')}</span></div>}
|
||||||
<div className="cd-cta">
|
{pre && !preDone && <p className="cd-prereq"><Icon name="lock" size={14} /><span>{t('course.prereq', { title: ct(pre, locale).title })} <button className="link" onClick={() => nav(`/${locale}/course/${pre.slug}`)}>{t('course.prereqLink', { title: ct(pre, locale).title })}</button></span></p>}
|
||||||
<button className="btn btn-accent btn-lg" disabled={c.status !== 'PUBLISHED' || c.prices.ETB == null} onClick={() => nav(`/${locale}/checkout/${c.slug}`)}>{t('course.buy', { price: formatMoney(c.prices.ETB ?? 0, 'ETB') })}</button>
|
<div className="cd-cta" ref={setCtaEl}>
|
||||||
<button className="cd-round" onClick={share} aria-label={t('course.share')}><Icon name="share" size={18} /></button>
|
{/* a course whose every lesson is free (the API's FREE tier) has nothing to buy: it starts instead */}
|
||||||
|
{free ? <button className="btn btn-accent btn-lg" onClick={() => nav(`/${locale}/learn/${c.slug}/${lessons[0].id}`)}><Icon name="play" size={16} />{t('checkout.start')}</button>
|
||||||
|
: <button className="btn btn-accent btn-lg" disabled={c.status !== 'PUBLISHED' || c.prices.ETB == null} onClick={() => nav(`/${locale}/checkout/${c.slug}`)}>{t('course.buyShort')}</button>}
|
||||||
|
</div>
|
||||||
|
<div className="cd-includes">
|
||||||
|
<h2>{t('course.includes')}</h2>
|
||||||
|
<ul>{includes.map(([icon, label], k) => <li key={k}><Icon name={icon} size={18} />{label}</li>)}</ul>
|
||||||
|
{c.sequentialLessons && <p className="small muted">{t('course.sequential')}</p>}
|
||||||
</div>
|
</div>
|
||||||
{preview && <button className="btn btn-ghost btn-block" onClick={() => nav(`/${locale}/learn/${c.slug}/${preview.id}`)}><Icon name="play" size={16} />{t('course.watchPreview')}</button>}
|
|
||||||
<p className="cd-note"><Icon name="lock" size={14} />{t('checkout.lifetime')}</p>
|
|
||||||
</>}
|
</>}
|
||||||
<div className="cd-includes">
|
|
||||||
<h2>{t('course.includes')}</h2>
|
|
||||||
<ul>{includes.map(([icon, label], k) => <li key={k}><Icon name={icon} size={18} />{label}</li>)}</ul>
|
|
||||||
{c.sequentialLessons && <p className="small muted">{t('course.sequential')}</p>}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
{(mine ? r : c.prices.ETB != null && c.status === 'PUBLISHED') && <div className="cd-bar">
|
{showBar && <div className="cd-bar" data-hidden={barHidden} aria-hidden={barHidden || undefined} inert={barHidden || undefined}>
|
||||||
{mine && r ? <>
|
{mine && r ? <>
|
||||||
<span className="cd-bar-txt"><strong className="num">{p.pct}%</strong><span>{t('my.lessonsDone', { done: p.done, total: p.total })}</span></span>
|
<span className="cd-bar-txt"><strong className="num">{p.pct}%</strong><span>{t('my.lessonsDone', { done: p.done, total: p.total })}</span></span>
|
||||||
<button className="btn btn-accent" onClick={() => nav(`/${locale}/learn/${c.slug}/${r.lesson.id}`)}>{playLabel}</button>
|
<button className="btn btn-accent" onClick={() => nav(`/${locale}/learn/${c.slug}/${r.lesson.id}`)}>{playLabel}</button>
|
||||||
|
|
@ -628,36 +686,38 @@ function CoursePage({ slug }: { slug?: string }) {
|
||||||
</>}
|
</>}
|
||||||
</div>}
|
</div>}
|
||||||
|
|
||||||
<section className="cd-body">
|
<section className={`cd-body${mine ? ' is-owner' : ''}`}>
|
||||||
{pre && !preDone && <div className="banner">{t('course.prereq', { title: ct(pre, locale).title })} <button className="link" onClick={() => nav(`/${locale}/course/${pre.slug}`)}>{t('course.prereqLink', { title: ct(pre, locale).title })}</button></div>}
|
<div className="cd-tabs" role="tablist">{tabs.map(([k, label]) => <button key={k} role="tab" aria-selected={active === k} onClick={() => setTab(k)}>{label}</button>)}</div>
|
||||||
<div className="cd-tabs" role="tablist">{tabs.map(([k, label]) => <button key={k} role="tab" aria-selected={tab === k} onClick={() => setTab(k)}>{label}</button>)}</div>
|
{!!text.outcomes?.length && <div className="cd-pane" data-tab="overview" data-active={active === 'overview'}>
|
||||||
{tab === 'overview' && <div className="cd-pane">
|
<h2><KitIcon name="brush" size={22} />{t('course.outcomes')}</h2>
|
||||||
{!!text.outcomes?.length && <>
|
<ul className="cd-learn">{text.outcomes.map((o, k) => <li key={k}><Icon name="check" size={16} />{o}</li>)}</ul>
|
||||||
<h2><KitIcon name="brush" size={22} />{t('course.outcomes')}</h2>
|
|
||||||
<ul className="cd-learn">{text.outcomes.map((o, k) => <li key={k}><Icon name="check" size={16} />{o}</li>)}</ul>
|
|
||||||
</>}
|
|
||||||
{text.description && <p style={{ whiteSpace: 'pre-line' }}>{text.description}</p>}
|
|
||||||
{text.audience && <p className="small"><strong>{t('course.audience')}: </strong>{text.audience}</p>}
|
|
||||||
</div>}
|
</div>}
|
||||||
{tab === 'content' && <div className="cd-pane cd-content">
|
<div className="cd-pane cd-content" data-tab="content" data-active={active === 'content'}>
|
||||||
<p className="small muted num">{t('course.lessons', { n: lessons.length })} · {formatDuration(courseDuration(c))}</p>
|
<h2 className="cd-pane-h">{t('course.content')}</h2>
|
||||||
|
<p className="small muted num">{t('course.lessons', { n: lessons.length })}{withDur(courseDuration(c))}</p>
|
||||||
{chapters.map((ch, i) => {
|
{chapters.map((ch, i) => {
|
||||||
const ls = [...ch.lessons].sort((a, b) => a.sortOrder - b.sortOrder).filter((l) => l.isPublished);
|
const ls = [...ch.lessons].sort((a, b) => a.sortOrder - b.sortOrder).filter((l) => l.isPublished);
|
||||||
if (!ls.length) return null;
|
if (!ls.length) return null;
|
||||||
const d = ls.filter((l) => isCompleted(me, l.id)).length;
|
const d = ls.filter((l) => isCompleted(me, l.id)).length;
|
||||||
return (
|
return (
|
||||||
<details key={ch.id} className="ch" open={i === 0}>
|
<details key={ch.id} className="ch" open={nextChapter ? ch.id === nextChapter : i === 0}>
|
||||||
<summary><span className="grow"><strong>{tr(ch.translations, locale)?.title}</strong><span className="small muted num">{d}/{ls.length} · {formatDuration(ls.reduce((s, l) => s + l.durationSec, 0))}</span></span><Icon name="down" size={18} /></summary>
|
<summary><span className="grow"><strong>{tr(ch.translations, locale)?.title}</strong><span className="small muted num">{d}/{ls.length}{withDur(ls.reduce((s, l) => s + l.durationSec, 0))}</span></span><Icon name="down" size={18} /></summary>
|
||||||
{ls.map((l) => <LessonRow key={l.id} c={c} l={l} />)}
|
{ls.map((l) => <LessonRow key={l.id} c={c} l={l} />)}
|
||||||
|
{quizzes.filter((a) => a.chapterId === ch.id).map((a) => <AssessmentRow key={a.id} c={c} a={a} inline />)}
|
||||||
</details>
|
</details>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{!!c.assessments?.length && <details className="ch" open>
|
{!!finalQuizzes.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>
|
<summary><span className="grow"><strong>{t('assess.title')}</strong><span className="small muted num">{finalQuizzes.filter((a) => me?.assessments?.[a.id]?.passed).length}/{finalQuizzes.length}</span></span><Icon name="down" size={18} /></summary>
|
||||||
{c.assessments.map((a) => <AssessmentRow key={a.id} c={c} a={a} />)}
|
{finalQuizzes.map((a) => <AssessmentRow key={a.id} c={c} a={a} />)}
|
||||||
</details>}
|
</details>}
|
||||||
|
</div>
|
||||||
|
{(text.description || text.audience) && <div className="cd-pane" data-tab="overview" data-active={active === 'overview'}>
|
||||||
|
<h2>{t('course.about')}</h2>
|
||||||
|
{text.description && <p style={{ whiteSpace: 'pre-line' }}>{text.description}</p>}
|
||||||
|
{text.audience && <p className="small"><strong>{t('course.audience')}: </strong>{text.audience}</p>}
|
||||||
|
<p className="cd-updated"><Icon name="calendar" size={14} />{t('course.lastUpdated')} <span className="num">{fmtDate(c.updatedAt)}</span></p>
|
||||||
</div>}
|
</div>}
|
||||||
{tab === 'instructor' && <div className="cd-pane"><div className="row"><span className="avatar avatar-lg" aria-hidden>{initials(c.instructorName)}</span><div><strong>{c.instructorName}</strong><p className="small muted">{t('course.teaches', { n: teaches })}</p></div></div></div>}
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
@ -672,10 +732,10 @@ function LessonRow({ c, l, current }: { c: Course; l: Lesson; current?: boolean
|
||||||
const seen = !done && l.durationSec ? Math.min(100, ((me?.progress?.[l.id]?.maxPositionSec ?? 0) / l.durationSec) * 100) : 0;
|
const seen = !done && l.durationSec ? Math.min(100, ((me?.progress?.[l.id]?.maxPositionSec ?? 0) / l.durationSec) * 100) : 0;
|
||||||
return (
|
return (
|
||||||
<button className={`lesson-row${current ? ' is-current' : ''}${done ? ' is-done' : ''}${access.ok ? '' : ' is-locked'}`} aria-current={current ? 'step' : undefined} onClick={() => nav(`/${locale}/learn/${c.slug}/${l.id}`)}>
|
<button className={`lesson-row${current ? ' is-current' : ''}${done ? ' is-done' : ''}${access.ok ? '' : ' is-locked'}`} aria-current={current ? 'step' : undefined} onClick={() => nav(`/${locale}/learn/${c.slug}/${l.id}`)}>
|
||||||
<span className="lr-ic" aria-hidden>{current && !done ? <span className="eq"><i /><i /><i /></span> : done ? <Icon name="check" size={14} /> : access.ok ? <span className="num">{n}</span> : <Icon name="lock" size={14} />}</span>
|
<span className="lr-ic" aria-hidden>{current && !done ? <span className="eq"><i /><i /><i /></span> : done ? <Icon name="check" size={14} /> : access.ok ? <Icon name="play" size={12} /> : <Icon name="lock" size={14} />}</span>
|
||||||
<span className="lr-txt">
|
<span className="lr-txt">
|
||||||
<span className="lr-title">{current || done || !access.ok ? `${n}. ` : ''}{lessonTitle(l, locale)}</span>
|
<span className="lr-title">{n}. {lessonTitle(l, locale)}</span>
|
||||||
<span className="lr-meta num">{clock(l.durationSec)}{l.isPreview && !owns(me, c.id) && <span className="lr-tag">{t('course.preview')}</span>}{!access.ok && access.reason === 'COMING_SOON' && <span className="lr-tag">{t('course.comingSoon')}</span>}</span>
|
<span className="lr-meta num">{l.durationSec > 0 && clock(l.durationSec)}{l.isPreview && !owns(me, c.id) && <span className="lr-tag">{t('course.preview')}</span>}{!access.ok && access.reason === 'COMING_SOON' && <span className="lr-tag">{t('course.comingSoon')}</span>}</span>
|
||||||
{seen > 0 && <span className="lr-seen" aria-hidden><i style={{ width: `${seen}%` }} /></span>}
|
{seen > 0 && <span className="lr-seen" aria-hidden><i style={{ width: `${seen}%` }} /></span>}
|
||||||
</span>
|
</span>
|
||||||
{current ? <span className="lr-now">{t('player.nowPlaying')}</span> : <Icon name="chevron" size={16} />}
|
{current ? <span className="lr-now">{t('player.nowPlaying')}</span> : <Icon name="chevron" size={16} />}
|
||||||
|
|
@ -685,18 +745,21 @@ function LessonRow({ c, l, current }: { c: Course; l: Lesson; current?: boolean
|
||||||
|
|
||||||
// ---------------------------------------------------------------- assessments
|
// ---------------------------------------------------------------- assessments
|
||||||
|
|
||||||
function AssessmentRow({ c, a }: { c: Course; a: Assessment }) {
|
function AssessmentRow({ c, a, inline }: { c: Course; a: Assessment; inline?: boolean }) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { me, locale, nav } = useApp();
|
const { me, locale, nav } = useApp();
|
||||||
const r = me?.assessments?.[a.id];
|
const r = me?.assessments?.[a.id];
|
||||||
|
const mine = owns(me, c.id);
|
||||||
const ch = a.chapterId ? c.chapters.find((x) => x.id === a.chapterId) : undefined;
|
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');
|
const where = inline ? '' : ch ? t('assess.chapter', { chapter: tr(ch.translations, locale)?.title ?? '' }) : t('assess.final');
|
||||||
return (
|
return (
|
||||||
<button className="lesson-row" onClick={() => nav(`/${locale}/assess/${c.slug}/${a.id}`)}>
|
<button className={`lesson-row is-quiz${r?.passed ? ' is-done' : ''}${mine ? '' : ' is-locked'}`} 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="lr-ic" aria-hidden>{r?.passed ? <Icon name="check" size={14} /> : mine ? <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="lr-txt">
|
||||||
<span className="small muted num">{where} · {t('assess.questions', { n: a.questions.length })}</span>
|
<span className="lr-title">{tr(a.translations, locale)?.title}</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>
|
<span className="lr-meta num">{where && <>{where} · </>}{t('assess.questions', { n: a.questions.length })}
|
||||||
|
{r && <span className={`lr-tag ${r.passed ? 'quiz-ok' : 'quiz-todo'}`}>{r.passed ? t('assess.passed') : t('assess.notPassed')} · {t('assess.best', { pct: r.bestPct })}</span>}</span>
|
||||||
|
</span>
|
||||||
<Icon name="chevron" size={16} />
|
<Icon name="chevron" size={16} />
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
|
@ -791,30 +854,33 @@ function AssessmentPage({ slug, id }: { slug?: string; id?: string }) {
|
||||||
function Player({ slug, lessonId }: { slug?: string; lessonId?: string }) {
|
function Player({ slug, lessonId }: { slug?: string; lessonId?: string }) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { courses, me, locale, nav, catalogLoaded, signedIn, viewer } = useApp();
|
const { courses, me, locale, nav, catalogLoaded, signedIn, viewer } = useApp();
|
||||||
|
const sheet = useRef<HTMLDialogElement>(null);
|
||||||
|
useEffect(() => { sheet.current?.close(); }, [lessonId]); // picking a lesson in the sheet closes it
|
||||||
const c = courses.find((x) => x.slug === slug);
|
const c = courses.find((x) => x.slug === slug);
|
||||||
const lessons = c ? publishedLessons(c) : [];
|
const lessons = c ? publishedLessons(c) : [];
|
||||||
const lesson = lessons.find((l) => l.id === lessonId);
|
const lesson = lessons.find((l) => l.id === lessonId);
|
||||||
if (!catalogLoaded) return <Skeleton h={320} />;
|
if (!catalogLoaded) return <Skeleton h={320} />;
|
||||||
if (!c || !lesson || !isStudentVisible(c, me)) return <Empty action={<button className="btn" onClick={() => nav(`/${locale}/courses`)}>{t('catalog.title')}</button>}>{t('course.notFound')}</Empty>;
|
if (!c || !lesson || !isStudentVisible(c, me)) return <Empty action={<button className="btn" onClick={() => nav(`/${locale}/courses`)}>{t('catalog.title')}</button>}>{t('course.notFound')}</Empty>;
|
||||||
const access = lessonAccess(c, lesson, signedIn ? me : null, courses);
|
const access = lessonAccess(c, lesson, signedIn ? me : null, courses);
|
||||||
const p = courseProgress(c, me);
|
|
||||||
const idx = lessons.indexOf(lesson);
|
const idx = lessons.indexOf(lesson);
|
||||||
const next = lessons[idx + 1];
|
const next = lessons[idx + 1];
|
||||||
const notes = tr(lesson.translations, locale)?.description;
|
const notes = tr(lesson.translations, locale)?.description;
|
||||||
const chapter = c.chapters.find((ch) => ch.lessons.some((l) => l.id === lesson.id));
|
const chapter = c.chapters.find((ch) => ch.lessons.some((l) => l.id === lesson.id));
|
||||||
|
// L2: the video comes first; where you are (course, chapter, lesson) sits right under it
|
||||||
|
const head = (
|
||||||
|
<div className="p-head">
|
||||||
|
<p className="p-crumb">
|
||||||
|
<button onClick={() => nav(`/${locale}/course/${c.slug}`)} aria-label={`${t('player.back')}: ${ct(c, locale).title}`}><Icon name="back" size={14} />{ct(c, locale).title}</button>
|
||||||
|
{chapter && <span>{tr(chapter.translations, locale)?.title}</span>}
|
||||||
|
</p>
|
||||||
|
<h1>{idx + 1}. {lessonTitle(lesson, locale)}</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<div className="stack">
|
<div className="stack">
|
||||||
<div className="row-between">
|
|
||||||
<button className="btn btn-quiet" onClick={() => nav(`/${locale}/course/${c.slug}`)}><Icon name="back" size={16} />{t('player.back')}</button>
|
|
||||||
<span className="small muted">{ct(c, locale).title}</span>
|
|
||||||
</div>
|
|
||||||
<div className="p-wrap">
|
<div className="p-wrap">
|
||||||
<div className="stack">
|
<div className="stack p-main">
|
||||||
<div className="stack-sm">
|
{access.ok ? <VideoPanel key={lesson.id} c={c} lesson={lesson} next={next} head={head} /> : <>
|
||||||
<span className="small muted">{tr(chapter?.translations, locale)?.title}</span>
|
|
||||||
<h1 style={{ fontSize: 'var(--fs-xl)' }}>{idx + 1}. {lessonTitle(lesson, locale)}</h1>
|
|
||||||
</div>
|
|
||||||
{access.ok ? <VideoPanel key={lesson.id} c={c} lesson={lesson} next={next} /> : (
|
|
||||||
<div className="screen"><div className="sim">
|
<div className="screen"><div className="sim">
|
||||||
<Icon name="lock" size={36} />
|
<Icon name="lock" size={36} />
|
||||||
<p>{t(`player.${access.reason}`)}</p>
|
<p>{t(`player.${access.reason}`)}</p>
|
||||||
|
|
@ -823,47 +889,77 @@ function Player({ slug, lessonId }: { slug?: string; lessonId?: string }) {
|
||||||
{access.reason === 'PREREQUISITE_REQUIRED' && <button className="btn btn-accent" onClick={() => { const pre = courses.find((x) => x.id === c.prerequisiteCourseId); if (pre) nav(`/${locale}/course/${pre.slug}`); }}>{t('course.prereqLink', { title: ct(courses.find((x) => x.id === c.prerequisiteCourseId) ?? c, locale).title })}</button>}
|
{access.reason === 'PREREQUISITE_REQUIRED' && <button className="btn btn-accent" onClick={() => { const pre = courses.find((x) => x.id === c.prerequisiteCourseId); if (pre) nav(`/${locale}/course/${pre.slug}`); }}>{t('course.prereqLink', { title: ct(courses.find((x) => x.id === c.prerequisiteCourseId) ?? c, locale).title })}</button>}
|
||||||
{access.reason === 'ACCOUNT_DEACTIVATED' && <button className="btn btn-accent" onClick={() => nav(`/${locale}/help`)}>{t('nav.help')}</button>}
|
{access.reason === 'ACCOUNT_DEACTIVATED' && <button className="btn btn-accent" onClick={() => nav(`/${locale}/help`)}>{t('nav.help')}</button>}
|
||||||
</div></div>
|
</div></div>
|
||||||
)}
|
{head}
|
||||||
<div className="card stack-sm">
|
</>}
|
||||||
|
{/* L5: only real lesson notes; no card standing in with the course blurb */}
|
||||||
|
{notes && <div className="card stack-sm">
|
||||||
<h2 style={{ fontSize: 'var(--fs-lg)' }}>{t('player.notes')}</h2>
|
<h2 style={{ fontSize: 'var(--fs-lg)' }}>{t('player.notes')}</h2>
|
||||||
<p style={{ whiteSpace: 'pre-line', color: 'var(--ink-2)' }}>{notes || ct(c, locale).subtitle || ct(c, locale).description}</p>
|
<p style={{ whiteSpace: 'pre-line', color: 'var(--ink-2)' }}>{notes}</p>
|
||||||
</div>
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
<aside className="card p-side p-side-order" aria-label={t('player.contents')}>
|
<aside className="card p-side p-side-order" aria-label={t('player.contents')}><CourseContents c={c} lesson={lesson} /></aside>
|
||||||
<div className="ps-head">
|
|
||||||
{owns(me, c.id) && <Ring pct={p.pct} size={52} />}
|
|
||||||
<div className="ps-head-txt"><span className="ps-kicker">{t('course.content')}</span><strong>{ct(c, locale).title}</strong>
|
|
||||||
{owns(me, c.id) && <span className="small muted num">{t('player.progress', { done: p.done, total: p.total })}</span>}</div>
|
|
||||||
</div>
|
|
||||||
{[...c.chapters].sort((a, b) => a.sortOrder - b.sortOrder).map((ch, ci) => {
|
|
||||||
const ls = [...ch.lessons].sort((a, b) => a.sortOrder - b.sortOrder).filter((l) => l.isPublished);
|
|
||||||
if (!ls.length) return null;
|
|
||||||
const doneN = ls.filter((l) => isCompleted(me, l.id)).length;
|
|
||||||
return <details key={ch.id} className={`ps-ch${doneN === ls.length ? ' is-done' : ''}`} open={ls.some((l) => l.id === lesson.id) || undefined}>
|
|
||||||
<summary>
|
|
||||||
<span className="ps-ch-n num">{doneN === ls.length ? <Icon name="check" size={14} /> : String(ci + 1).padStart(2, '0')}</span>
|
|
||||||
<span className="ps-ch-txt"><strong>{tr(ch.translations, locale)?.title}</strong><span className="small muted num">{doneN}/{ls.length} · {clock(ls.reduce((a, l) => a + l.durationSec, 0))}</span></span>
|
|
||||||
<Icon name="down" size={16} />
|
|
||||||
</summary>
|
|
||||||
<div className="ps-ch-list">{ls.map((l) => <LessonRow key={l.id} c={c} l={l} current={l.id === lesson.id} />)}</div>
|
|
||||||
</details>;
|
|
||||||
})}
|
|
||||||
</aside>
|
|
||||||
</div>
|
</div>
|
||||||
{viewer && !viewer.id && <p className="small muted">{t('auth.noIdentity')}</p>}
|
{viewer && !viewer.id && <p className="small muted">{t('auth.noIdentity')}</p>}
|
||||||
<nav className="l-bar" aria-label={t('player.contents')}>
|
<nav className="l-bar" aria-label={t('player.contents')}>
|
||||||
<button disabled={idx === 0} onClick={() => nav(`/${locale}/learn/${c.slug}/${lessons[idx - 1].id}`)}><Icon name="back" size={18} />{t('player.prev')}</button>
|
<button disabled={idx === 0} onClick={() => nav(`/${locale}/learn/${c.slug}/${lessons[idx - 1].id}`)}><Icon name="back" size={18} />{t('player.prev')}</button>
|
||||||
<button onClick={() => document.querySelector('.p-side')?.scrollIntoView({ behavior: 'smooth' })}><Icon name="list" size={18} /><span className="num">{idx + 1} / {lessons.length}</span></button>
|
<button aria-haspopup="dialog" onClick={() => sheet.current?.showModal()}><Icon name="list" size={18} /><span className="num">{idx + 1} / {lessons.length}</span></button>
|
||||||
<button className="l-next" disabled={!next} onClick={() => nav(`/${locale}/learn/${c.slug}/${next.id}`)}>{t('player.next')}<Icon name="chevron" size={18} /></button>
|
<button className="l-next" disabled={!next} onClick={() => nav(`/${locale}/learn/${c.slug}/${next.id}`)}>{t('player.nextShort')}<Icon name="chevron" size={18} /></button>
|
||||||
</nav>
|
</nav>
|
||||||
|
{/* L6: on phones and tablets the lesson list slides up over the video instead of scrolling the page away from it */}
|
||||||
|
<dialog ref={sheet} className="lsheet" aria-label={t('player.contents')} onClick={(e) => { if (e.target === sheet.current) sheet.current?.close(); }}>
|
||||||
|
<div className="lsheet-in">
|
||||||
|
<div className="lsheet-top"><span className="lsheet-grip" aria-hidden /><button className="icon-btn" aria-label={t('common.close')} onClick={() => sheet.current?.close()}><Icon name="x" size={20} /></button></div>
|
||||||
|
<CourseContents c={c} lesson={lesson} />
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Lesson }) {
|
// The course's chapters and lessons with progress: the player's sidebar on desktop and its lesson sheet on phones.
|
||||||
|
function CourseContents({ c, lesson }: { c: Course; lesson: Lesson }) {
|
||||||
|
const t = useTranslations();
|
||||||
|
const { me, locale } = useApp();
|
||||||
|
const p = courseProgress(c, me);
|
||||||
|
return <>
|
||||||
|
<div className="ps-head">
|
||||||
|
{owns(me, c.id) && <Ring pct={p.pct} size={52} />}
|
||||||
|
<div className="ps-head-txt"><span className="ps-kicker">{t('course.content')}</span><strong>{ct(c, locale).title}</strong>
|
||||||
|
{owns(me, c.id) && <span className="small muted num">{t('player.progress', { done: p.done, total: p.total })}</span>}</div>
|
||||||
|
</div>
|
||||||
|
{[...c.chapters].sort((a, b) => a.sortOrder - b.sortOrder).map((ch, ci) => {
|
||||||
|
const ls = [...ch.lessons].sort((a, b) => a.sortOrder - b.sortOrder).filter((l) => l.isPublished);
|
||||||
|
if (!ls.length) return null;
|
||||||
|
const doneN = ls.filter((l) => isCompleted(me, l.id)).length;
|
||||||
|
return <details key={ch.id} className={`ps-ch${doneN === ls.length ? ' is-done' : ''}`} open={ls.some((l) => l.id === lesson.id) || undefined}>
|
||||||
|
<summary>
|
||||||
|
<span className="ps-ch-n num">{doneN === ls.length ? <Icon name="check" size={14} /> : String(ci + 1).padStart(2, '0')}</span>
|
||||||
|
<span className="ps-ch-txt"><strong>{tr(ch.translations, locale)?.title}</strong><span className="small muted num">{doneN}/{ls.length}{ls.some((l) => l.durationSec) ? ` · ${clock(ls.reduce((a, l) => a + l.durationSec, 0))}` : ''}</span></span>
|
||||||
|
<Icon name="down" size={16} />
|
||||||
|
</summary>
|
||||||
|
<div className="ps-ch-list">{ls.map((l) => <LessonRow key={l.id} c={c} l={l} current={l.id === lesson.id} />)}</div>
|
||||||
|
</details>;
|
||||||
|
})}
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AUTO_NEXT_SEC = 5;
|
||||||
|
|
||||||
|
/** vimeo.com/123, vimeo.com/123/abcdef (unlisted) or player.vimeo.com/video/123 → embeddable player URL; null otherwise. */
|
||||||
|
export function vimeoPlayerUrl(url: string): string | null {
|
||||||
|
const m = /vimeo\.com\/(?:video\/)?(\d+)(?:\/([0-9a-f]+))?/.exec(url);
|
||||||
|
if (!m) return null;
|
||||||
|
const hash = m[2] ?? new URL(url, 'https://x').searchParams.get('h');
|
||||||
|
return `${VIMEO_ORIGIN}/video/${m[1]}?${hash ? `h=${hash}&` : ''}dnt=1&title=0&byline=0&portrait=0`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function VideoPanel({ c, lesson, next, head }: { c: Course; lesson: Lesson; next?: Lesson; head?: ReactNode }) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { me, locale, nav, ds, write, signedIn, viewer } = useApp();
|
const { me, locale, nav, ds, write, signedIn, viewer } = useApp();
|
||||||
const vimeo = !lesson.videoAssetId; // no upload yet: play the Vimeo placeholder instead
|
// A Vimeo link (what the API's lessons carry) plays in Vimeo's player; no video yet plays the sample clip.
|
||||||
|
const placeholder = !lesson.videoAssetId;
|
||||||
|
const vimeoSrc = placeholder ? VIMEO_PLACEHOLDER : vimeoPlayerUrl(lesson.videoAssetId!);
|
||||||
|
const vimeo = !!vimeoSrc;
|
||||||
const [vdur, setVdur] = useState(0);
|
const [vdur, setVdur] = useState(0);
|
||||||
const dur = (vimeo && vdur) || lesson.durationSec || 1;
|
const dur = (vimeo && vdur) || lesson.durationSec || 1;
|
||||||
const saved = me?.progress?.[lesson.id];
|
const saved = me?.progress?.[lesson.id];
|
||||||
|
|
@ -874,6 +970,9 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
|
||||||
const [saver, setSaver] = useState<boolean>(() => !!conn && (conn.saveData || /2g|3g/.test(conn.effectiveType ?? '')));
|
const [saver, setSaver] = useState<boolean>(() => !!conn && (conn.saveData || /2g|3g/.test(conn.effectiveType ?? '')));
|
||||||
const [quality, setQuality] = useState('auto');
|
const [quality, setQuality] = useState('auto');
|
||||||
const [justDone, setJustDone] = useState(false);
|
const [justDone, setJustDone] = useState(false);
|
||||||
|
// L4: when a lesson ends, "up next" appears over the video and plays it after a short count the student can cancel
|
||||||
|
const [ended, setEnded] = useState(false);
|
||||||
|
const [auto, setAuto] = useState<number | null>(null);
|
||||||
const videoRef = useRef<HTMLVideoElement>(null);
|
const videoRef = useRef<HTMLVideoElement>(null);
|
||||||
const frameRef = useRef<HTMLIFrameElement>(null);
|
const frameRef = useRef<HTMLIFrameElement>(null);
|
||||||
const screenRef = useRef<HTMLDivElement>(null);
|
const screenRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
@ -907,8 +1006,9 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
|
||||||
let m: any; try { m = typeof e.data === 'string' ? JSON.parse(e.data) : e.data; } catch { return; }
|
let m: any; try { m = typeof e.data === 'string' ? JSON.parse(e.data) : e.data; } catch { return; }
|
||||||
if (m.event === 'ready') vlisten();
|
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 === 'timeupdate') { setPos(m.data.seconds); if (m.data.duration) setVdur(m.data.duration); }
|
||||||
else if (m.event === 'play') setPlaying(true);
|
else if (m.event === 'play') { setPlaying(true); setEnded(false); setAuto(null); }
|
||||||
else if (m.event === 'pause' || m.event === 'ended') setPlaying(false);
|
else if (m.event === 'pause') setPlaying(false);
|
||||||
|
else if (m.event === 'ended') { setPlaying(false); setEnded(true); }
|
||||||
else if (m.method === 'getDuration' && m.value) setVdur(m.value);
|
else if (m.method === 'getDuration' && m.value) setVdur(m.value);
|
||||||
};
|
};
|
||||||
addEventListener('message', on);
|
addEventListener('message', on);
|
||||||
|
|
@ -923,6 +1023,14 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
|
||||||
}, [heartbeat]);
|
}, [heartbeat]);
|
||||||
useEffect(() => { const v = videoRef.current; if (v) v.playbackRate = rate; }, [rate]);
|
useEffect(() => { const v = videoRef.current; if (v) v.playbackRate = rate; }, [rate]);
|
||||||
useEffect(() => { if (vimeo && rate !== 1) vcall('setPlaybackRate', rate); }, [rate]);
|
useEffect(() => { if (vimeo && rate !== 1) vcall('setPlaybackRate', rate); }, [rate]);
|
||||||
|
const goNext = () => { if (next) nav(`/${locale}/learn/${c.slug}/${next.id}`); };
|
||||||
|
useEffect(() => { if (ended && next) setAuto(AUTO_NEXT_SEC); }, [ended, next]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (auto == null) return;
|
||||||
|
if (auto <= 0) { goNext(); return; }
|
||||||
|
const id = setTimeout(() => setAuto((a) => (a == null ? null : a - 1)), 1000);
|
||||||
|
return () => clearTimeout(id);
|
||||||
|
}, [auto]);
|
||||||
|
|
||||||
const toggle = () => {
|
const toggle = () => {
|
||||||
const v = videoRef.current;
|
const v = videoRef.current;
|
||||||
|
|
@ -933,6 +1041,7 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
|
||||||
const full = () => { screenRef.current?.requestFullscreen?.().catch(() => { /* not allowed in this frame */ }); };
|
const full = () => { screenRef.current?.requestFullscreen?.().catch(() => { /* not allowed in this frame */ }); };
|
||||||
const onKey = (e: React.KeyboardEvent) => {
|
const onKey = (e: React.KeyboardEvent) => {
|
||||||
if ((e.target as HTMLElement).tagName === 'SELECT' || (e.target as HTMLElement).tagName === 'INPUT') return;
|
if ((e.target as HTMLElement).tagName === 'SELECT' || (e.target as HTMLElement).tagName === 'INPUT') return;
|
||||||
|
if (e.key === 'Escape' && auto != null) { setAuto(null); return; }
|
||||||
if (e.key === ' ') { e.preventDefault(); toggle(); } else if (e.key === 'ArrowLeft') seek(pos - 10); else if (e.key === 'ArrowRight') seek(pos + 10); else if (e.key === 'f') full(); else if (e.key === 'm' && videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
if (e.key === ' ') { e.preventDefault(); toggle(); } else if (e.key === 'ArrowLeft') seek(pos - 10); else if (e.key === 'ArrowRight') seek(pos + 10); else if (e.key === 'f') full(); else if (e.key === 'm' && videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
||||||
};
|
};
|
||||||
const mark = (me?.phone || me?.email || viewer?.name || 'student').replace(/^(.{3}).*(.{2})$/, '$1•••$2');
|
const mark = (me?.phone || me?.email || viewer?.name || 'student').replace(/^(.{3}).*(.{2})$/, '$1•••$2');
|
||||||
|
|
@ -944,11 +1053,20 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
|
||||||
{lesson.videoAssetId ? (
|
{lesson.videoAssetId ? (
|
||||||
<video ref={videoRef} src={ds.assetUrl(lesson.videoAssetId)} playsInline preload="metadata"
|
<video ref={videoRef} src={ds.assetUrl(lesson.videoAssetId)} playsInline preload="metadata"
|
||||||
onLoadedMetadata={(e) => { if (pos) e.currentTarget.currentTime = pos; }}
|
onLoadedMetadata={(e) => { if (pos) e.currentTarget.currentTime = pos; }}
|
||||||
onTimeUpdate={(e) => setPos(e.currentTarget.currentTime)} onPlay={() => setPlaying(true)} onPause={() => setPlaying(false)} onEnded={() => setPlaying(false)} />
|
onTimeUpdate={(e) => setPos(e.currentTarget.currentTime)} onPlay={() => { setPlaying(true); setEnded(false); setAuto(null); }} onPause={() => setPlaying(false)} onEnded={() => { setPlaying(false); setEnded(true); }} />
|
||||||
) : (
|
) : (
|
||||||
<iframe ref={frameRef} src={VIMEO_PLACEHOLDER} onLoad={vlisten} title={lessonTitle(lesson, locale)} allow="autoplay; fullscreen; picture-in-picture" allowFullScreen />
|
<iframe ref={frameRef} src={vimeoSrc!} onLoad={vlisten} title={lessonTitle(lesson, locale)} allow="autoplay; fullscreen; picture-in-picture" allowFullScreen />
|
||||||
)}
|
)}
|
||||||
{canSave && <span className="wm" aria-hidden>{mark}</span>}
|
{canSave && <span className="wm" aria-hidden>{mark}</span>}
|
||||||
|
{auto != null && next && <div className="p-upnext" role="status">
|
||||||
|
<span className="p-upnext-k">{t('player.upNext')}</span>
|
||||||
|
<strong>{lessonNumber(c, next.id)}. {lessonTitle(next, locale)}</strong>
|
||||||
|
<span className="p-upnext-n num" aria-hidden><svg viewBox="0 0 24 24" width="18" height="18"><circle cx="12" cy="12" r="10" /></svg>{t('player.autoNext', { n: auto })}</span>
|
||||||
|
<div className="p-upnext-go">
|
||||||
|
<button className="btn btn-accent" onClick={goNext}><Icon name="play" size={14} />{t('player.playNow')}</button>
|
||||||
|
<button className="btn btn-quiet" onClick={() => setAuto(null)}>{t('common.cancel')}</button>
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
{!vimeo && <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)}`} />
|
<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">
|
<div className="row">
|
||||||
|
|
@ -968,7 +1086,8 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
{vimeo && <p className="small muted">{t('player.demoVideo')}{canSave && !done && <> · <button className="link" onClick={() => { setPos(dur); posRef.current = dur; heartbeat(); }}>{t('player.markWatched')}</button></>}</p>}
|
{head}
|
||||||
|
{placeholder && <p className="small muted">{t('player.demoVideo')}{canSave && !done && <> · <button className="link" onClick={() => { setPos(dur); posRef.current = dur; heartbeat(); setEnded(true); }}>{t('player.markWatched')}</button></>}</p>}
|
||||||
{done && pct === 100 && (
|
{done && pct === 100 && (
|
||||||
<div className="course-done" role="status">
|
<div className="course-done" role="status">
|
||||||
<div className="confetti" aria-hidden>{Array.from({ length: 18 }, (_, k) => <i key={k} style={{ '--k': k } as React.CSSProperties} />)}</div>
|
<div className="confetti" aria-hidden>{Array.from({ length: 18 }, (_, k) => <i key={k} style={{ '--k': k } as React.CSSProperties} />)}</div>
|
||||||
|
|
@ -981,7 +1100,7 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{done && pct < 100 && (
|
{done && pct < 100 && auto == null && (
|
||||||
<div className="lesson-done" role="status">
|
<div className="lesson-done" role="status">
|
||||||
<span className="ld-check" aria-hidden><svg viewBox="0 0 24 24" width="22" height="22"><path d="M5 12.5l4.5 4.5L19 7" /></svg></span>
|
<span className="ld-check" aria-hidden><svg viewBox="0 0 24 24" width="22" height="22"><path d="M5 12.5l4.5 4.5L19 7" /></svg></span>
|
||||||
<span className="ld-txt"><strong>{t('player.completed')}</strong><span className="small muted num">{t('player.courseProgress', { pct })}</span></span>
|
<span className="ld-txt"><strong>{t('player.completed')}</strong><span className="small muted num">{t('player.courseProgress', { pct })}</span></span>
|
||||||
|
|
@ -1032,7 +1151,7 @@ function Checkout({ slug }: { slug?: string }) {
|
||||||
<aside className="cd-side">
|
<aside className="cd-side">
|
||||||
<div className="cd-buy">
|
<div className="cd-buy">
|
||||||
<div className="cd-preview" aria-hidden><img src={c.coverAssetId ? ds.assetUrl(c.coverAssetId) : coursePhoto(c, categories.map((k) => k.id))} alt="" /></div>
|
<div className="cd-preview" aria-hidden><img src={c.coverAssetId ? ds.assetUrl(c.coverAssetId) : coursePhoto(c, categories.map((k) => k.id))} alt="" /></div>
|
||||||
<div className="stack-sm"><strong className="co-title">{ct(c, locale).title}</strong><span className="small muted">{t('course.by', { name: c.instructorName })}</span></div>
|
<div className="stack-sm"><strong className="co-title">{ct(c, locale).title}</strong>{c.instructorName && <span className="small muted">{t('course.by', { name: c.instructorName })}</span>}</div>
|
||||||
<div className="row-between co-total"><span>{t('checkout.total')}</span><strong className="num">{formatMoney(c.prices.ETB ?? 0, 'ETB')}</strong></div>
|
<div className="row-between co-total"><span>{t('checkout.total')}</span><strong className="num">{formatMoney(c.prices.ETB ?? 0, 'ETB')}</strong></div>
|
||||||
{err && <p className="err" role="alert">{err}</p>}
|
{err && <p className="err" role="alert">{err}</p>}
|
||||||
<div className="cd-cta"><button className="btn btn-accent btn-lg" disabled={busy} onClick={start}>{t('checkout.pay', { method: methodName(method) })}</button></div>
|
<div className="cd-cta"><button className="btn btn-accent btn-lg" disabled={busy} onClick={start}>{t('checkout.pay', { method: methodName(method) })}</button></div>
|
||||||
|
|
@ -1271,7 +1390,9 @@ function Help() {
|
||||||
|
|
||||||
function SignIn() {
|
function SignIn() {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { viewer, account: me, ready, signIn, nav, locale } = useApp();
|
const { viewer, account: me, ready, signIn, nav, locale, ds, reloadViewer } = useApp();
|
||||||
|
const auth = ds.auth; // real sign-in (API); without it the code is simulated and shown on screen
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
const [mode, setMode] = useState<'phone' | 'email'>('phone');
|
const [mode, setMode] = useState<'phone' | 'email'>('phone');
|
||||||
const [phone, setPhone] = useState('');
|
const [phone, setPhone] = useState('');
|
||||||
const [dial, setDial] = useState(() => { const r = (typeof navigator !== 'undefined' ? navigator.language : '').split('-')[1]?.toUpperCase(); return r && DIALS[r] ? r : 'ET'; });
|
const [dial, setDial] = useState(() => { const r = (typeof navigator !== 'undefined' ? navigator.language : '').split('-')[1]?.toUpperCase(); return r && DIALS[r] ? r : 'ET'; });
|
||||||
|
|
@ -1293,10 +1414,35 @@ function SignIn() {
|
||||||
if (mode === 'phone' && !(dial === 'ET' ? /^[79]\d{8}$/.test(local) : local.length >= 4 && e164.length <= 16)) { setErr(t('auth.phoneInvalid')); return; }
|
if (mode === 'phone' && !(dial === 'ET' ? /^[79]\d{8}$/.test(local) : local.length >= 4 && e164.length <= 16)) { setErr(t('auth.phoneInvalid')); return; }
|
||||||
if (mode === 'email' && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) { setErr(t('auth.emailInvalid')); return; }
|
if (mode === 'email' && !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) { setErr(t('auth.emailInvalid')); return; }
|
||||||
if (mode === 'email' && !validPassword(pw)) { setErr(t('auth.passwordShort')); return; }
|
if (mode === 'email' && !validPassword(pw)) { setErr(t('auth.passwordShort')); return; }
|
||||||
|
if (auth) { void startReal(); return; }
|
||||||
setCode(String(Math.floor(100000 + Math.random() * 900000))); setTries(5); setEntered(''); setWait(60); setStep('code');
|
setCode(String(Math.floor(100000 + Math.random() * 900000))); setTries(5); setEntered(''); setWait(60); setStep('code');
|
||||||
};
|
};
|
||||||
const verify = (e: React.FormEvent) => {
|
const contact = () => (mode === 'phone' ? { phone: e164 } : { email, password: pw });
|
||||||
|
// The server's own message when it gave one; a plain "couldn't reach the server" when it never answered.
|
||||||
|
const apiErr = (e: unknown) => ((e as { code?: string })?.code === 'network' ? t('auth.networkError') : (e as Error)?.message || t('auth.networkError'));
|
||||||
|
// After a real sign-in: a learner without a name yet goes to profile setup, everyone else home.
|
||||||
|
const finish = async () => {
|
||||||
|
await reloadViewer(); signIn();
|
||||||
|
const v = await ds.viewer();
|
||||||
|
if (v.name.trim()) nav(`/${locale}`); else setStep('setup');
|
||||||
|
};
|
||||||
|
const startReal = async () => {
|
||||||
|
setBusy(true);
|
||||||
|
try {
|
||||||
|
const next = await auth!.start(contact());
|
||||||
|
if (next === 'done') await finish(); else { setEntered(''); setWait(60); setStep('code'); }
|
||||||
|
} catch (e) { setErr(apiErr(e)); }
|
||||||
|
setBusy(false);
|
||||||
|
};
|
||||||
|
const verify = async (e: React.FormEvent) => {
|
||||||
e.preventDefault(); setErr('');
|
e.preventDefault(); setErr('');
|
||||||
|
if (auth) {
|
||||||
|
setBusy(true);
|
||||||
|
try { await auth.verify(contact(), entered); await finish(); }
|
||||||
|
catch (x) { setErr(apiErr(x)); }
|
||||||
|
setBusy(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (tries <= 0) { setErr(t('auth.locked')); return; }
|
if (tries <= 0) { setErr(t('auth.locked')); return; }
|
||||||
if (entered !== code) { const left = tries - 1; setTries(left); setErr(left ? t('auth.wrongCode', { n: left }) : t('auth.locked')); return; }
|
if (entered !== code) { const left = tries - 1; setTries(left); setErr(left ? t('auth.wrongCode', { n: left }) : t('auth.locked')); return; }
|
||||||
if (me && !me.deletedAt) { signIn(); nav(`/${locale}`); } else setStep('setup');
|
if (me && !me.deletedAt) { signIn(); nav(`/${locale}`); } else setStep('setup');
|
||||||
|
|
@ -1312,11 +1458,12 @@ function SignIn() {
|
||||||
<ul className="facts">{['fact2', 'fact3'].map((k) => <li key={k}><Icon name="check" size={16} />{t(`landing.${k}`)}</li>)}</ul>
|
<ul className="facts">{['fact2', 'fact3'].map((k) => <li key={k}><Icon name="check" size={16} />{t(`landing.${k}`)}</li>)}</ul>
|
||||||
</div>
|
</div>
|
||||||
<div className="auth-main">
|
<div className="auth-main">
|
||||||
{!viewer?.id ? <Empty>{t('auth.noIdentity')}</Empty> : step === 'start' ? <form className="stack" onSubmit={(e) => { e.preventDefault(); send(); }}>
|
{!auth && !viewer?.id ? <Empty>{t('auth.noIdentity')}</Empty> : step === 'start' ? <form className="stack" onSubmit={(e) => { e.preventDefault(); send(); }}>
|
||||||
<div className="stack-sm"><h1>{t('auth.welcome')}</h1><p className="muted">{t('auth.welcomeLead')}</p></div>
|
<div className="stack-sm"><h1>{t('auth.welcome')}</h1><p className="muted">{t('auth.welcomeLead')}</p></div>
|
||||||
{me && !me.deletedAt && <button type="button" className="btn btn-accent btn-block btn-lg" onClick={() => { signIn(); nav(`/${locale}`); }}>{t('auth.continueAs', { name: me.name.split(' ')[0] })}</button>}
|
{me && !me.deletedAt && <button type="button" className="btn btn-accent btn-block btn-lg" onClick={() => { signIn(); nav(`/${locale}`); }}>{t('auth.continueAs', { name: me.name.split(' ')[0] })}</button>}
|
||||||
<SocialLogins onPick={() => { if (me && !me.deletedAt) { signIn(); nav(`/${locale}`); } else setStep('setup'); }} />
|
{/* Google / Apple need the providers' own sign-in SDKs before they can run against the API */}
|
||||||
<div className="or"><span>{t('auth.or')}</span></div>
|
{!auth && <><SocialLogins onPick={() => { if (me && !me.deletedAt) { signIn(); nav(`/${locale}`); } else setStep('setup'); }} />
|
||||||
|
<div className="or"><span>{t('auth.or')}</span></div></>}
|
||||||
<h2 className="auth-h2">{mode === 'phone' ? t('auth.phoneTitle') : t('auth.emailTitle')}</h2>
|
<h2 className="auth-h2">{mode === 'phone' ? t('auth.phoneTitle') : t('auth.emailTitle')}</h2>
|
||||||
{mode === 'phone' ? (
|
{mode === 'phone' ? (
|
||||||
<label className="field"><span>{t('auth.phoneLabel')}</span>
|
<label className="field"><span>{t('auth.phoneLabel')}</span>
|
||||||
|
|
@ -1327,15 +1474,15 @@ function SignIn() {
|
||||||
<label className="field"><span>{t('auth.passwordLabel')}</span><input id="pw" className="input" type="password" autoComplete="new-password" value={pw} onChange={(e) => setPw(e.target.value)} /><span className="hint">{t('auth.passwordHint')}</span></label>
|
<label className="field"><span>{t('auth.passwordLabel')}</span><input id="pw" className="input" type="password" autoComplete="new-password" value={pw} onChange={(e) => setPw(e.target.value)} /><span className="hint">{t('auth.passwordHint')}</span></label>
|
||||||
</>}
|
</>}
|
||||||
{err && <p className="err" role="alert">{err}</p>}
|
{err && <p className="err" role="alert">{err}</p>}
|
||||||
<button className="btn btn-block">{t('auth.sendCode')}</button>
|
<button className="btn btn-block" disabled={busy}>{t('auth.sendCode')}</button>
|
||||||
<button type="button" className="link" onClick={() => { setMode(mode === 'phone' ? 'email' : 'phone'); setErr(''); }}>{mode === 'phone' ? t('auth.useEmail') : t('auth.usePhone')}</button>
|
<button type="button" className="link" onClick={() => { setMode(mode === 'phone' ? 'email' : 'phone'); setErr(''); }}>{mode === 'phone' ? t('auth.useEmail') : t('auth.usePhone')}</button>
|
||||||
</form> : <form className="stack" onSubmit={verify}>
|
</form> : <form className="stack" onSubmit={verify}>
|
||||||
<h1>{t('auth.codeTitle')}</h1>
|
<h1>{t('auth.codeTitle')}</h1>
|
||||||
<p>{t('auth.codeSent', { target })}</p>
|
<p>{t('auth.codeSent', { target })}</p>
|
||||||
<p className="banner"><strong>{t('auth.demoCode', { code })}</strong></p>
|
{!auth && <p className="banner"><strong>{t('auth.demoCode', { code })}</strong></p>}
|
||||||
<label className="field"><span className="sr-only">{t('auth.codeTitle')}</span><input id="otp" className="input otp" inputMode="numeric" autoComplete="one-time-code" maxLength={6} value={entered} onChange={(e) => setEntered(e.target.value.replace(/\D/g, ''))} /></label>
|
<label className="field"><span className="sr-only">{t('auth.codeTitle')}</span><input id="otp" className="input otp" inputMode="numeric" autoComplete="one-time-code" maxLength={6} value={entered} onChange={(e) => setEntered(e.target.value.replace(/\D/g, ''))} /></label>
|
||||||
{err && <p className="err" role="alert">{err}</p>}
|
{err && <p className="err" role="alert">{err}</p>}
|
||||||
<button className="btn btn-accent btn-block" disabled={entered.length !== 6 || tries <= 0}>{t('auth.verify')}</button>
|
<button className="btn btn-accent btn-block" disabled={busy || entered.length < 4 || (!auth && (entered.length !== 6 || tries <= 0))}>{t('auth.verify')}</button>
|
||||||
<button type="button" className="btn btn-ghost btn-block" disabled={wait > 0} onClick={send}>{wait > 0 ? t('auth.resendIn', { s: wait }) : t('auth.resend')}</button>
|
<button type="button" className="btn btn-ghost btn-block" disabled={wait > 0} onClick={send}>{wait > 0 ? t('auth.resendIn', { s: wait }) : t('auth.resend')}</button>
|
||||||
<button type="button" className="link" onClick={() => setStep('start')}>{t('common.back')}</button>
|
<button type="button" className="link" onClick={() => setStep('start')}>{t('common.back')}</button>
|
||||||
</form>}
|
</form>}
|
||||||
|
|
|
||||||
|
|
@ -167,14 +167,44 @@ textarea.input { min-height: 110px; resize: vertical; }
|
||||||
.tone-sand { background: var(--tone-sand); } .tone-sage { background: var(--tone-sage); } .tone-ink { background: var(--tone-ink); }
|
.tone-sand { background: var(--tone-sand); } .tone-sage { background: var(--tone-sage); } .tone-ink { background: var(--tone-ink); }
|
||||||
.grid-cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
|
.grid-cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
|
||||||
.grid-cards > * { max-width: 440px; }
|
.grid-cards > * { max-width: 440px; }
|
||||||
.ccard { display: flex; flex-direction: column; gap: 10px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; min-width: 0; }
|
/* home: greeting + continue card (H1–H3). The card is a dark photo surface in both themes. */
|
||||||
.ccard h3 { font-size: var(--fs-lg); }
|
.home-top { display: flex; flex-direction: column; gap: 16px; }
|
||||||
.ccard:hover h3 { text-decoration: underline; text-underline-offset: 4px; }
|
.continue { display: grid; grid-template-columns: 1fr; border-radius: 22px; overflow: hidden; background: #111; color: #F5F5F5; }
|
||||||
.ccard .meta { font-size: var(--fs-sm); color: var(--ink-3); }
|
.continue-media { position: relative; isolation: isolate; aspect-ratio: 16 / 9; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 16px 18px 22px; }
|
||||||
.continue { display: grid; gap: 20px; grid-template-columns: 1fr; padding: 20px; border-radius: var(--r-lg); background: var(--ink); color: var(--on-ink); }
|
.continue-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; z-index: -2; }
|
||||||
.continue .bar { background: rgba(255, 255, 255, .18); }
|
.continue-media::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 10, 10, 0) 30%, rgba(10, 10, 10, .82)); }
|
||||||
@media (min-width: 720px) { .continue { grid-template-columns: 260px 1fr; align-items: center; } }
|
.continue-kicker, .continue-next > span:first-child { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(245, 245, 245, .75); }
|
||||||
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
|
.continue-media h2 { font-size: var(--fs-xl); line-height: 1.15; letter-spacing: -.02em; color: #fff; }
|
||||||
|
.continue-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .2); }
|
||||||
|
.continue-bar > i { display: block; height: 100%; background: #fff; }
|
||||||
|
.continue-body { display: flex; flex-direction: column; gap: 16px; padding: 16px 18px 18px; }
|
||||||
|
.continue-next { margin: 0; display: flex; flex-direction: column; gap: 2px; }
|
||||||
|
.continue-next strong { font-size: var(--fs-lg); line-height: 1.3; }
|
||||||
|
.continue-next > .num { font-size: var(--fs-sm); color: #A3A3A3; }
|
||||||
|
.continue-body .btn { width: 100%; border-radius: 999px; }
|
||||||
|
.continue .btn-accent { background: #F5F5F5; color: #0A0A0A; }
|
||||||
|
@media (min-width: 720px) {
|
||||||
|
.continue { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
|
||||||
|
.continue-media { aspect-ratio: auto; min-height: 260px; padding: 20px 24px 26px; }
|
||||||
|
.continue-body { justify-content: center; padding: 24px 28px; }
|
||||||
|
.continue-body .btn { align-self: flex-start; width: auto; }
|
||||||
|
}
|
||||||
|
/* CT1: chip rows scroll without a visible scrollbar; the faded edge says there's more */
|
||||||
|
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
|
||||||
|
.chips::-webkit-scrollbar { display: none; }
|
||||||
|
@media (max-width: 599px) { .chips { margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 32px), transparent); } }
|
||||||
|
/* CT2: search with an icon and a clear button (the browser's own cancel glyph is hidden so there's only one) */
|
||||||
|
.search { position: relative; display: block; }
|
||||||
|
.search > svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
|
||||||
|
.search .input { min-height: 48px; padding-inline: 42px 46px; border-radius: 14px; }
|
||||||
|
.search .input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
|
||||||
|
.search-clear { position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink-3); cursor: pointer; }
|
||||||
|
@media (hover: hover) and (pointer: fine) { .search-clear:hover { color: var(--ink); background: var(--mist); } }
|
||||||
|
/* CT3: result count with the "taught in" filter beside it */
|
||||||
|
.catalog-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
|
||||||
|
.catalog-lang { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--ink-3); }
|
||||||
|
.catalog-lang select { min-height: 40px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
|
||||||
|
@media (pointer: coarse) { .catalog-lang select { font-size: 16px; } } /* iOS zooms into anything smaller */
|
||||||
.chip { flex: none; border: 1px solid var(--line); background: var(--paper); padding: 8px 14px; border-radius: var(--r-pill); cursor: pointer; font-weight: 700; color: var(--ink-2); }
|
.chip { flex: none; border: 1px solid var(--line); background: var(--paper); padding: 8px 14px; border-radius: var(--r-pill); cursor: pointer; font-weight: 700; color: var(--ink-2); }
|
||||||
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
|
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
|
||||||
|
|
||||||
|
|
@ -261,11 +291,6 @@ table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
|
||||||
/* compact course rows on phones (§11.2: catalog cards are compact; the Continue card stays wide) */
|
/* compact course rows on phones (§11.2: catalog cards are compact; the Continue card stays wide) */
|
||||||
@media (max-width: 599px) {
|
@media (max-width: 599px) {
|
||||||
.grid-cards { grid-template-columns: 1fr; gap: 14px; }
|
.grid-cards { grid-template-columns: 1fr; gap: 14px; }
|
||||||
.ccard { display: grid; grid-template-columns: 104px 1fr; gap: 2px 14px; align-items: start; }
|
|
||||||
.ccard .cover { grid-row: 1 / span 4; aspect-ratio: 1; padding: 8px; }
|
|
||||||
.ccard .cover .ttl { font-size: 13px; -webkit-line-clamp: 4; }
|
|
||||||
.ccard .cover .pill { display: none; }
|
|
||||||
.ccard h3 { font-size: var(--fs-base); }
|
|
||||||
}
|
}
|
||||||
/* audit fixes: no sideways scroll at 360–400px */
|
/* audit fixes: no sideways scroll at 360–400px */
|
||||||
@media (max-width: 600px) { .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .stat { min-width: 0; } .stat .lbl { flex-wrap: wrap; letter-spacing: .03em; } .stat .lbl span { overflow-wrap: anywhere; } }
|
@media (max-width: 600px) { .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .stat { min-width: 0; } .stat .lbl { flex-wrap: wrap; letter-spacing: .03em; } .stat .lbl span { overflow-wrap: anywhere; } }
|
||||||
|
|
@ -273,7 +298,6 @@ table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
|
||||||
.cover .ttl { margin-top: auto; }
|
.cover .ttl { margin-top: auto; }
|
||||||
.hero-card .cover { aspect-ratio: 16 / 10; }
|
.hero-card .cover { aspect-ratio: 16 / 10; }
|
||||||
.hero-card .cover .ttl { font-size: clamp(24px, 3.2vw, 36px); }
|
.hero-card .cover .ttl { font-size: clamp(24px, 3.2vw, 36px); }
|
||||||
.ccard .cover { aspect-ratio: 16 / 9; }
|
|
||||||
/* touch targets: 40px minimum everywhere, 44px on touch screens */
|
/* touch targets: 40px minimum everywhere, 44px on touch screens */
|
||||||
.btn-sm { min-height: 40px; }
|
.btn-sm { min-height: 40px; }
|
||||||
@media (pointer: coarse) { .btn-sm, .controls button, .controls select { min-height: 44px; min-width: 44px; } .lesson-row { min-height: 56px; } }
|
@media (pointer: coarse) { .btn-sm, .controls button, .controls select { min-height: 44px; min-width: 44px; } .lesson-row { min-height: 56px; } }
|
||||||
|
|
@ -363,22 +387,6 @@ h1:lang(en), h2:lang(en), h3:lang(en), h1:lang(om), h2:lang(om), h3:lang(om), .b
|
||||||
.cta-band { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; padding: 36px; border-radius: 24px; background: var(--ink); color: var(--on-ink); }
|
.cta-band { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; padding: 36px; border-radius: 24px; background: var(--ink); color: var(--on-ink); }
|
||||||
.cta-band h2 { font-size: var(--fs-xl); } .cta-band p { opacity: .8; }
|
.cta-band h2 { font-size: var(--fs-xl); } .cta-band p { opacity: .8; }
|
||||||
|
|
||||||
/* course cards */
|
|
||||||
.ccard { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; gap: 0; transition: box-shadow .2s, transform .2s; }
|
|
||||||
.ccard:hover { box-shadow: var(--shadow-soft); transform: translateY(-2px); border-color: transparent; }
|
|
||||||
.ccard:hover h3 { text-decoration: none; }
|
|
||||||
.ccard-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 8px 6px; min-width: 0; }
|
|
||||||
.ccard .meta { display: flex; gap: 14px; flex-wrap: wrap; }
|
|
||||||
.ccard .meta > span { display: inline-flex; align-items: center; gap: 5px; }
|
|
||||||
.ccard-by { font-size: var(--fs-sm); color: var(--ink-2); }
|
|
||||||
.ccard-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); }
|
|
||||||
.ccard-cta { font-size: var(--fs-sm); font-weight: 700; padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid var(--line); }
|
|
||||||
.ccard:hover .ccard-cta { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
|
|
||||||
@media (max-width: 599px) {
|
|
||||||
.ccard { padding: 8px; grid-template-columns: 96px 1fr; gap: 0 12px; }
|
|
||||||
.ccard .cover { grid-row: auto; }
|
|
||||||
.ccard-body { padding: 2px 0; gap: 4px; } .ccard-by { display: none; } .ccard-foot { padding-top: 8px; } .ccard-cta { display: none; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* course page */
|
/* course page */
|
||||||
.c-page { display: flex; flex-direction: column; gap: 20px; }
|
.c-page { display: flex; flex-direction: column; gap: 20px; }
|
||||||
|
|
@ -467,8 +475,6 @@ h1:lang(en), h2:lang(en), h3:lang(en), h1:lang(om), h2:lang(om), h3:lang(om), .b
|
||||||
.cta-band { position: relative; overflow: hidden; background: #111; color: #fff; }
|
.cta-band { position: relative; overflow: hidden; background: #111; color: #fff; }
|
||||||
.cta-band::after { content: ''; position: absolute; right: -60px; bottom: -120px; width: 280px; height: 280px; border-radius: 50%; background: #fff; opacity: .12; pointer-events: none; }
|
.cta-band::after { content: ''; position: absolute; right: -60px; bottom: -120px; width: 280px; height: 280px; border-radius: 50%; background: #fff; opacity: .12; pointer-events: none; }
|
||||||
.cta-band > * { position: relative; z-index: 1; }
|
.cta-band > * { position: relative; z-index: 1; }
|
||||||
.continue { background: #111; color: #fff; }
|
|
||||||
.continue .bar > i { background: #fff; }
|
|
||||||
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
|
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
|
||||||
.pay-mark { width: 48px; height: 28px; flex: none; display: grid; place-items: center; }
|
.pay-mark { width: 48px; height: 28px; flex: none; display: grid; place-items: center; }
|
||||||
.pay-mark img { width: 48px; height: 28px; object-fit: contain; }
|
.pay-mark img { width: 48px; height: 28px; object-fit: contain; }
|
||||||
|
|
@ -546,8 +552,6 @@ fieldset[disabled] .quiz-opt { cursor: default; }
|
||||||
.thumb .cover .ttl { font-size: 15px; line-height: 1.3; -webkit-line-clamp: 2; }
|
.thumb .cover .ttl { font-size: 15px; line-height: 1.3; -webkit-line-clamp: 2; }
|
||||||
/* phone course rows: square thumbnail that shows the title instead of an empty swatch */
|
/* phone course rows: square thumbnail that shows the title instead of an empty swatch */
|
||||||
@media (max-width: 599px) {
|
@media (max-width: 599px) {
|
||||||
.ccard .cover { aspect-ratio: 1; padding: 8px; }
|
|
||||||
.ccard .cover .ttl { font-size: 13px; line-height: 1.3; -webkit-line-clamp: 3; max-width: 100%; }
|
|
||||||
.my-row .btn { flex: 1 1 100%; }
|
.my-row .btn { flex: 1 1 100%; }
|
||||||
}
|
}
|
||||||
.prog-head .grow { flex: 1 1 160px; }
|
.prog-head .grow { flex: 1 1 160px; }
|
||||||
|
|
@ -798,8 +802,6 @@ fieldset[disabled] .quiz-opt { cursor: default; }
|
||||||
.cd-price > span:last-child { font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); }
|
.cd-price > span:last-child { font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); }
|
||||||
.cd-cta { display: flex; gap: 10px; }
|
.cd-cta { display: flex; gap: 10px; }
|
||||||
.cd-cta .btn { flex: 1; border-radius: 999px; min-height: 54px; }
|
.cd-cta .btn { flex: 1; border-radius: 999px; min-height: 54px; }
|
||||||
.cd-round { flex: none; width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: background 160ms; }
|
|
||||||
.cd-round:hover { background: var(--mist); }
|
|
||||||
.cd-buy .btn-ghost.btn-block { border-radius: 999px; }
|
.cd-buy .btn-ghost.btn-block { border-radius: 999px; }
|
||||||
.cd-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); padding: 0 4px; }
|
.cd-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); padding: 0 4px; }
|
||||||
.cd-includes { padding: 6px 4px 4px; display: flex; flex-direction: column; gap: 10px; }
|
.cd-includes { padding: 6px 4px 4px; display: flex; flex-direction: column; gap: 10px; }
|
||||||
|
|
@ -905,6 +907,45 @@ fieldset[disabled] .quiz-opt { cursor: default; }
|
||||||
.cd-bar .btn { border-radius: 999px; min-height: 48px; padding-inline: 22px; }
|
.cd-bar .btn { border-radius: 999px; min-height: 48px; padding-inline: 22px; }
|
||||||
@media (min-width: 1024px) { .cd-bar { display: none; } }
|
@media (min-width: 1024px) { .cd-bar { display: none; } }
|
||||||
|
|
||||||
|
/* ---------- course page polish 2026-10-26 (P1–P5) ---------- */
|
||||||
|
/* P1: the bar repeats the buy card's button, so it steps aside while that button is on screen */
|
||||||
|
.cd-bar { transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out); }
|
||||||
|
.cd-bar[data-hidden="true"] { transform: translateY(100%); opacity: 0; pointer-events: none; }
|
||||||
|
/* P2: price once, with its terms underneath */
|
||||||
|
.cd-price { flex-direction: column; align-items: flex-start; gap: 2px; }
|
||||||
|
.cd-price > span:last-child { font-weight: 600; color: var(--ink-3); }
|
||||||
|
/* P4: owners see the next lesson instead of the sales list */
|
||||||
|
.cd-next { margin: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--mist); }
|
||||||
|
.cd-next > span:first-child { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
|
||||||
|
.cd-next > .num { font-size: var(--fs-sm); color: var(--ink-3); }
|
||||||
|
/* P5: what the instructor tab said, in the creator row */
|
||||||
|
.cd-by-n { font-size: 12px; color: var(--ink-3); }
|
||||||
|
/* P3: desktop keeps tabs (one section at a time); phones drop them and stack every section in one scroll */
|
||||||
|
.cd-pane-h { margin-bottom: 4px; }
|
||||||
|
@media (min-width: 1024px) { .cd-pane[data-active="false"], .cd-pane-h { display: none; } }
|
||||||
|
@media (max-width: 1023px) {
|
||||||
|
.cd-tabs { display: none; }
|
||||||
|
.cd-body { gap: 0; }
|
||||||
|
.cd-body.is-owner > .cd-content { order: -1; } /* P4: owners land on the curriculum */
|
||||||
|
}
|
||||||
|
/* P8: share is a quiet glass button in the hero corner, matching the preview pill */
|
||||||
|
.cd-top { flex-wrap: nowrap; align-items: flex-start; }
|
||||||
|
.cd-top > .crumbs { flex: 1; min-width: 0; }
|
||||||
|
.cd-top > .row { margin-left: auto; flex-wrap: nowrap; }
|
||||||
|
.cd-share { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); background: rgba(10, 10, 10, .45); backdrop-filter: blur(8px); color: #fff; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease-out); }
|
||||||
|
.cd-share:active { transform: scale(.96); }
|
||||||
|
.cd-head .cd-pill-own { background: rgba(245, 245, 245, .92); border-color: transparent; color: #0A0A0A; }
|
||||||
|
.cd-head .cd-pill-own svg, .cd-head .cd-pill-own strong { color: #0A0A0A; }
|
||||||
|
@media (hover: hover) and (pointer: fine) { .cd-share:hover { background: rgba(30, 30, 30, .7); } }
|
||||||
|
/* P9: the prerequisite, said where the buying decision happens */
|
||||||
|
.cd-prereq { margin: 0; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--mist); font-size: var(--fs-sm); color: var(--ink-2); }
|
||||||
|
.cd-prereq > svg { flex: none; margin-top: 3px; color: var(--ink-3); }
|
||||||
|
.cd-prereq .link { font-weight: 700; }
|
||||||
|
/* P6: "last updated" closes the About section */
|
||||||
|
.cd-pane .cd-updated { margin: 0; }
|
||||||
|
/* P7: quiz rows inside chapters reuse the lesson row; their result is a tag, not a block line */
|
||||||
|
.lesson-row .lr-tag.quiz-ok, .lesson-row .lr-tag.quiz-todo { display: inline-block; font-weight: 600; }
|
||||||
|
|
||||||
/* help: big ask, three contact doors, FAQ beside the report form */
|
/* help: big ask, three contact doors, FAQ beside the report form */
|
||||||
.help { display: flex; flex-direction: column; gap: clamp(28px, 4vw, 48px); }
|
.help { display: flex; flex-direction: column; gap: clamp(28px, 4vw, 48px); }
|
||||||
.help-hero { display: flex; flex-direction: column; gap: 10px; padding-top: clamp(8px, 3vw, 32px); }
|
.help-hero { display: flex; flex-direction: column; gap: 10px; padding-top: clamp(8px, 3vw, 32px); }
|
||||||
|
|
@ -1026,18 +1067,42 @@ fieldset[disabled] .quiz-opt { cursor: default; }
|
||||||
@media (min-width: 900px) { .tour-card.at-bottom { bottom: 32px; } }
|
@media (min-width: 900px) { .tour-card.at-bottom { bottom: 32px; } }
|
||||||
@media (prefers-reduced-motion: reduce) { .tour-ring, .tour-card, .tour-dim { transition: none; animation: none; } }
|
@media (prefers-reduced-motion: reduce) { .tour-ring, .tour-card, .tour-dim { transition: none; animation: none; } }
|
||||||
|
|
||||||
/* ---------- course cards 2026-10-20: edge-to-edge photo, enrolled count, arrow that inverts on hover ---------- */
|
/* ---------- course card (C1–C4, 2026-10-27): the one place card styles live ----------
|
||||||
.ccard { padding: 0; overflow: hidden; border-radius: 22px; }
|
Photo on top with the category and a "new course" / students tag on it; one quiet info line; the footer is the
|
||||||
.ccard .cover { border-radius: 0; overflow: hidden; }
|
price, or progress plus the next lesson once owned. Phones show a compact row unless the card is .ccard-tall. */
|
||||||
|
.ccard { display: flex; flex-direction: column; min-width: 0; padding: 0; text-align: start; cursor: pointer; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
|
||||||
|
.ccard .cover { aspect-ratio: 16 / 9; border-radius: 0; overflow: hidden; }
|
||||||
.ccard .cover img { transition: transform 700ms var(--ease-out); }
|
.ccard .cover img { transition: transform 700ms var(--ease-out); }
|
||||||
.ccard:hover .cover img { transform: scale(1.05); }
|
.ccard-tag { position: absolute; z-index: 1; left: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(10, 10, 10, .62); backdrop-filter: blur(8px); color: #F5F5F5; font-size: 12px; font-weight: 600; white-space: nowrap; }
|
||||||
.ccard-body { padding: 16px 16px 14px; }
|
.ccard-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 14px; min-width: 0; flex: 1; }
|
||||||
.ccard h3 { letter-spacing: -.02em; line-height: 1.25; }
|
.ccard h3 { font-size: var(--fs-lg); line-height: 1.25; letter-spacing: -.02em; }
|
||||||
.ccard .meta { gap: 6px 12px; }
|
.ccard .meta { font-size: var(--fs-sm); color: var(--ink-3); }
|
||||||
.ccard-go { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--ink); transition: background 200ms, color 200ms, border-color 200ms, transform 240ms var(--ease-out); }
|
.ccard-by { font-size: var(--fs-sm); color: var(--ink-2); }
|
||||||
.ccard:hover .ccard-go, .ccard:focus-visible .ccard-go { background: var(--ink); color: var(--paper); border-color: var(--ink); transform: translateX(2px); }
|
.ccard-foot { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
|
||||||
@media (max-width: 600px) { .ccard { padding: 8px; border-radius: 18px; } .ccard .cover { border-radius: 12px; } .ccard-body { padding: 2px 0; } .ccard-go { width: 32px; height: 32px; } }
|
.ccard-foot > strong { font-size: var(--fs-lg); }
|
||||||
@media (hover: none) { .ccard:hover .cover img { transform: none; } }
|
.ccard-next { font-size: var(--fs-sm); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.ccard-next b { color: var(--ink); font-weight: 700; }
|
||||||
|
.ccard-prog { display: flex; align-items: center; gap: 10px; }
|
||||||
|
@media (hover: hover) and (pointer: fine) {
|
||||||
|
.ccard:hover { box-shadow: var(--shadow-soft); transform: translateY(-2px); border-color: transparent; }
|
||||||
|
.ccard:hover .cover img { transform: scale(1.05); }
|
||||||
|
}
|
||||||
|
/* phones: compact row (square thumbnail beside the text), except tall cards in a rail */
|
||||||
|
@media (max-width: 599px) {
|
||||||
|
.ccard:not(.ccard-tall) { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0 12px; align-items: start; padding: 8px; border-radius: 18px; }
|
||||||
|
.ccard:not(.ccard-tall) .cover { aspect-ratio: 1; border-radius: 12px; padding: 8px; }
|
||||||
|
.ccard:not(.ccard-tall) .cover .pill { display: none; }
|
||||||
|
.ccard:not(.ccard-tall) .ccard-tag { left: 6px; right: 6px; bottom: 6px; padding: 2px 6px; font-size: 11px; text-align: center; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.ccard:not(.ccard-tall) .ccard-body { padding: 2px 0; gap: 4px; }
|
||||||
|
.ccard:not(.ccard-tall) h3 { font-size: var(--fs-base); }
|
||||||
|
.ccard:not(.ccard-tall) .ccard-by { display: none; }
|
||||||
|
.ccard:not(.ccard-tall) .ccard-foot { padding-top: 8px; gap: 6px; }
|
||||||
|
}
|
||||||
|
/* C4: home Featured is a swipe rail of tall cards; the next card peeks past the edge */
|
||||||
|
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 4px; }
|
||||||
|
.rail::-webkit-scrollbar { display: none; }
|
||||||
|
.rail > * { scroll-snap-align: start; }
|
||||||
|
@media (max-width: 599px) { .rail { grid-auto-columns: 78%; gap: 12px; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; } }
|
||||||
|
|
||||||
/* ---------- how it works: abstract art instead of portraits ---------- */
|
/* ---------- how it works: abstract art instead of portraits ---------- */
|
||||||
.step { background: var(--paper); border: 1px solid var(--line); color: var(--ink); justify-content: flex-end; min-height: 300px; }
|
.step { background: var(--paper); border: 1px solid var(--line); color: var(--ink); justify-content: flex-end; min-height: 300px; }
|
||||||
|
|
@ -1100,7 +1165,7 @@ fieldset[disabled] .quiz-opt { cursor: default; }
|
||||||
.ps-ch summary:hover { background: var(--mist); }
|
.ps-ch summary:hover { background: var(--mist); }
|
||||||
.ps-ch summary > svg { flex: none; color: var(--ink-3); transition: transform 200ms var(--ease-out); }
|
.ps-ch summary > svg { flex: none; color: var(--ink-3); transition: transform 200ms var(--ease-out); }
|
||||||
.ps-ch[open] summary > svg { transform: rotate(180deg); }
|
.ps-ch[open] summary > svg { transform: rotate(180deg); }
|
||||||
.ps-ch-n { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--mist); font-size: 12px; font-weight: 700; color: var(--ink-2); }
|
.ps-ch-n { flex: none; width: 28px; height: 28px; border-radius: 50%; /* L7: same round marker as lesson rows */ display: grid; place-items: center; background: var(--mist); font-size: 12px; font-weight: 700; color: var(--ink-2); }
|
||||||
.ps-ch.is-done .ps-ch-n { background: var(--ink); color: var(--paper); }
|
.ps-ch.is-done .ps-ch-n { background: var(--ink); color: var(--paper); }
|
||||||
.ps-ch-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
.ps-ch-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
||||||
.ps-ch-list { padding: 2px 0 8px 18px; margin-left: 13px; border-left: 1px solid var(--line); }
|
.ps-ch-list { padding: 2px 0 8px 18px; margin-left: 13px; border-left: 1px solid var(--line); }
|
||||||
|
|
@ -1151,3 +1216,38 @@ fieldset[disabled] .quiz-opt { cursor: default; }
|
||||||
/* the full footer is always on its dark frame, so its powered-by line keeps light text in both themes */
|
/* the full footer is always on its dark frame, so its powered-by line keeps light text in both themes */
|
||||||
.foot-full .powered { color: #8A8A8A; }
|
.foot-full .powered { color: #8A8A8A; }
|
||||||
.foot-full .shine, :root:not([data-theme="dark"]) .foot-full .shine { background-image: linear-gradient(110deg, #C9C9C9 40%, #fff 50%, #C9C9C9 60%); }
|
.foot-full .shine, :root:not([data-theme="dark"]) .foot-full .shine { background-image: linear-gradient(110deg, #C9C9C9 40%, #fff 50%, #C9C9C9 60%); }
|
||||||
|
|
||||||
|
/* ---------- lesson player polish (L1–L6, 2026-10-27) ---------- */
|
||||||
|
/* L1: focus mode while watching: the logo and account stay, the site links and footer go */
|
||||||
|
.s-focus .s-nav { display: none; }
|
||||||
|
/* L2: the video comes first (edge to edge on phones, right under the header); course, chapter and title sit under it */
|
||||||
|
.p-head { display: flex; flex-direction: column; gap: 6px; }
|
||||||
|
.p-head h1 { font-size: var(--fs-xl); line-height: 1.2; letter-spacing: -.02em; }
|
||||||
|
.p-crumb { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: var(--fs-sm); color: var(--ink-3); }
|
||||||
|
.p-crumb button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0; border: 0; background: none; color: var(--ink-2); font-weight: 600; cursor: pointer; }
|
||||||
|
.p-crumb > span::before { content: '·'; margin-inline-end: 8px; }
|
||||||
|
@media (hover: hover) and (pointer: fine) { .p-crumb button:hover { color: var(--ink); } }
|
||||||
|
@media (max-width: 599px) { .s-focus .s-main { padding-top: 0; } .s-focus .screen { margin-inline: calc(50% - 50vw); width: 100vw; max-width: 100vw; border-radius: 0; } /* full bleed whatever the page padding is */ }
|
||||||
|
/* L4: "up next" over the finished video; the ring empties over the countdown (linear: it's a timer) */
|
||||||
|
.p-upnext { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; padding: clamp(16px, 4vw, 32px); background: rgba(10, 10, 10, .84); backdrop-filter: blur(6px); color: #F5F5F5; animation: upnext-in 240ms var(--ease-out); }
|
||||||
|
.p-upnext-k { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(245, 245, 245, .7); }
|
||||||
|
.p-upnext strong { font-size: clamp(18px, 3vw, 24px); line-height: 1.25; max-width: 32ch; }
|
||||||
|
.p-upnext-n { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: rgba(245, 245, 245, .75); }
|
||||||
|
.p-upnext-n svg { rotate: -90deg; }
|
||||||
|
.p-upnext-n circle { fill: none; stroke: #F5F5F5; stroke-width: 2.5; stroke-dasharray: 63; animation: upnext-count 5s linear forwards; }
|
||||||
|
.p-upnext-go { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
|
||||||
|
.p-upnext .btn-accent { background: #F5F5F5; color: #0A0A0A; }
|
||||||
|
.p-upnext .btn-quiet { color: #F5F5F5; }
|
||||||
|
@keyframes upnext-in { from { opacity: 0; } }
|
||||||
|
@keyframes upnext-count { to { stroke-dashoffset: 63; } }
|
||||||
|
/* L6: lesson list as a bottom sheet (phones and tablets; the sidebar covers desktop) */
|
||||||
|
.lsheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 80dvh; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-pop); }
|
||||||
|
.lsheet::backdrop { background: rgba(0, 0, 0, .5); }
|
||||||
|
.lsheet[open] { animation: lsheet-up 300ms cubic-bezier(0.32, 0.72, 0, 1); }
|
||||||
|
.lsheet[open]::backdrop { animation: fade-in 300ms ease; }
|
||||||
|
@keyframes lsheet-up { from { transform: translateY(100%); } }
|
||||||
|
.lsheet-in { max-height: 80dvh; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
|
||||||
|
.lsheet-top { position: sticky; top: 0; z-index: 1; display: flex; justify-content: center; align-items: center; min-height: 48px; background: var(--paper); }
|
||||||
|
.lsheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
|
||||||
|
.lsheet-top .icon-btn { position: absolute; inset-inline-end: 0; }
|
||||||
|
@media (min-width: 640px) { .lsheet { max-width: 560px; margin-inline: auto; } }
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@
|
||||||
"resend": "አዲስ ኮድ ላክ",
|
"resend": "አዲስ ኮድ ላክ",
|
||||||
"resendIn": "በ{s} ሰከንድ ውስጥ አዲስ ኮድ መላክ ይችላሉ",
|
"resendIn": "በ{s} ሰከንድ ውስጥ አዲስ ኮድ መላክ ይችላሉ",
|
||||||
"wrongCode": "ኮዱ ትክክል አይደለም። {n} ሙከራ ቀርቷል።",
|
"wrongCode": "ኮዱ ትክክል አይደለም። {n} ሙከራ ቀርቷል።",
|
||||||
|
"networkError": "ከአገልጋዩ ጋር መገናኘት አልተቻለም። ግንኙነትዎን ያረጋግጡና እንደገና ይሞክሩ።",
|
||||||
"locked": "ብዙ የተሳሳቱ ሙከራዎች። አዲስ ኮድ ይላኩ።",
|
"locked": "ብዙ የተሳሳቱ ሙከራዎች። አዲስ ኮድ ይላኩ።",
|
||||||
"noIdentity": "የተማሪ መለያ ለመፍጠር ወደ Claude ገብተው ይህን ማሳያ ይክፈቱ።",
|
"noIdentity": "የተማሪ መለያ ለመፍጠር ወደ Claude ገብተው ይህን ማሳያ ይክፈቱ።",
|
||||||
"welcome": "እንኳን ደህና መጡ",
|
"welcome": "እንኳን ደህና መጡ",
|
||||||
|
|
@ -124,7 +125,12 @@
|
||||||
"all": "ሁሉም",
|
"all": "ሁሉም",
|
||||||
"count": "{n} ኮርሶች",
|
"count": "{n} ኮርሶች",
|
||||||
"empty": "ከ«{q}» ጋር የሚዛመድ ኮርስ የለም። አጠር ያለ ቃል ይሞክሩ።",
|
"empty": "ከ«{q}» ጋር የሚዛመድ ኮርስ የለም። አጠር ያለ ቃል ይሞክሩ።",
|
||||||
"emptyCategory": "በዚህ ምድብ እስካሁን ኮርስ የለም።"
|
"emptyCategory": "በዚህ ምድብ እስካሁን ኮርስ የለም።",
|
||||||
|
"clearSearch": "ፍለጋውን አጽዳ",
|
||||||
|
"taughtIn": "የማስተማሪያ ቋንቋ",
|
||||||
|
"anyLanguage": "ማንኛውም ቋንቋ",
|
||||||
|
"clearFilters": "ማጣሪያዎችን አጽዳ",
|
||||||
|
"emptyLanguage": "በዚህ ቋንቋ እስካሁን ኮርስ የለም።"
|
||||||
},
|
},
|
||||||
"course": {
|
"course": {
|
||||||
"buyShort": "ኮርሱን ይግዙ",
|
"buyShort": "ኮርሱን ይግዙ",
|
||||||
|
|
@ -151,6 +157,7 @@
|
||||||
"watchAgain": "እንደገና ይመልከቱ",
|
"watchAgain": "እንደገና ይመልከቱ",
|
||||||
"tabOverview": "አጠቃላይ እይታ",
|
"tabOverview": "አጠቃላይ እይታ",
|
||||||
"tabInstructor": "አሠልጣኝ",
|
"tabInstructor": "አሠልጣኝ",
|
||||||
|
"about": "ስለ ኮርሱ",
|
||||||
"summary": "ማጠቃለያ",
|
"summary": "ማጠቃለያ",
|
||||||
"duration": "ጠቅላላ ርዝመት",
|
"duration": "ጠቅላላ ርዝመት",
|
||||||
"language": "ቋንቋ",
|
"language": "ቋንቋ",
|
||||||
|
|
@ -217,6 +224,9 @@
|
||||||
"progress": "ከ{total} ትምህርቶች {done} ተጠናቀዋል",
|
"progress": "ከ{total} ትምህርቶች {done} ተጠናቀዋል",
|
||||||
"nowPlaying": "አሁን እየታየ",
|
"nowPlaying": "አሁን እየታየ",
|
||||||
"upNext": "ቀጣይ",
|
"upNext": "ቀጣይ",
|
||||||
|
"nextShort": "ቀጣይ",
|
||||||
|
"playNow": "አሁን አጫውት",
|
||||||
|
"autoNext": "በ{n} ሰከንድ ይጀምራል",
|
||||||
"courseProgress": "ኮርሱ {pct}% ተጠናቋል",
|
"courseProgress": "ኮርሱ {pct}% ተጠናቋል",
|
||||||
"courseDoneT": "ኮርሱ ተጠናቋል",
|
"courseDoneT": "ኮርሱ ተጠናቋል",
|
||||||
"courseDone": "{course}ን ጨርሰዋል። ለዘላለም የእርስዎ ነው፤ በፈለጉ ጊዜ ወደ ማንኛውም ትምህርት ይመለሱ።",
|
"courseDone": "{course}ን ጨርሰዋል። ለዘላለም የእርስዎ ነው፤ በፈለጉ ጊዜ ወደ ማንኛውም ትምህርት ይመለሱ።",
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@
|
||||||
"resend": "Send a new code",
|
"resend": "Send a new code",
|
||||||
"resendIn": "Send a new code in {s} s",
|
"resendIn": "Send a new code in {s} s",
|
||||||
"wrongCode": "That code is wrong. {n, plural, one {# try} other {# tries}} left.",
|
"wrongCode": "That code is wrong. {n, plural, one {# try} other {# tries}} left.",
|
||||||
|
"networkError": "Couldn't reach the server. Check your connection and try again.",
|
||||||
"locked": "Too many wrong tries. Send a new code.",
|
"locked": "Too many wrong tries. Send a new code.",
|
||||||
"noIdentity": "Open this demo while signed in to Claude to create a student account.",
|
"noIdentity": "Open this demo while signed in to Claude to create a student account.",
|
||||||
"welcome": "Welcome back",
|
"welcome": "Welcome back",
|
||||||
|
|
@ -124,7 +125,12 @@
|
||||||
"all": "All",
|
"all": "All",
|
||||||
"count": "{n, plural, one {# course} other {# courses}}",
|
"count": "{n, plural, one {# course} other {# courses}}",
|
||||||
"empty": "No courses match “{q}”. Try a shorter word.",
|
"empty": "No courses match “{q}”. Try a shorter word.",
|
||||||
"emptyCategory": "No courses in this category yet."
|
"emptyCategory": "No courses in this category yet.",
|
||||||
|
"clearSearch": "Clear search",
|
||||||
|
"taughtIn": "Taught in",
|
||||||
|
"anyLanguage": "Any language",
|
||||||
|
"clearFilters": "Clear filters",
|
||||||
|
"emptyLanguage": "No courses in this language here yet."
|
||||||
},
|
},
|
||||||
"course": {
|
"course": {
|
||||||
"buyShort": "Buy course",
|
"buyShort": "Buy course",
|
||||||
|
|
@ -151,6 +157,7 @@
|
||||||
"watchAgain": "Watch again",
|
"watchAgain": "Watch again",
|
||||||
"tabOverview": "Overview",
|
"tabOverview": "Overview",
|
||||||
"tabInstructor": "Instructor",
|
"tabInstructor": "Instructor",
|
||||||
|
"about": "About this course",
|
||||||
"summary": "Summary",
|
"summary": "Summary",
|
||||||
"duration": "Total duration",
|
"duration": "Total duration",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
|
|
@ -217,6 +224,9 @@
|
||||||
"progress": "{done} of {total} lessons completed",
|
"progress": "{done} of {total} lessons completed",
|
||||||
"nowPlaying": "Now playing",
|
"nowPlaying": "Now playing",
|
||||||
"upNext": "Up next",
|
"upNext": "Up next",
|
||||||
|
"nextShort": "Next",
|
||||||
|
"playNow": "Play now",
|
||||||
|
"autoNext": "Starting in {n}",
|
||||||
"courseProgress": "Course {pct}% complete",
|
"courseProgress": "Course {pct}% complete",
|
||||||
"courseDoneT": "Course complete",
|
"courseDoneT": "Course complete",
|
||||||
"courseDone": "You finished {course}. It stays yours for life, so come back to any lesson whenever you need it.",
|
"courseDone": "You finished {course}. It stays yours for life, so come back to any lesson whenever you need it.",
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@
|
||||||
"resend": "Koodii haaraa ergi",
|
"resend": "Koodii haaraa ergi",
|
||||||
"resendIn": "Sekondii {s} booda koodii haaraa erguu dandeessa",
|
"resendIn": "Sekondii {s} booda koodii haaraa erguu dandeessa",
|
||||||
"wrongCode": "Koodiin sun dogoggora. Yaaliin {n} hafeera.",
|
"wrongCode": "Koodiin sun dogoggora. Yaaliin {n} hafeera.",
|
||||||
|
"networkError": "Sarvarii qaqqabuu hin dandeenye. Walqunnamtii kee mirkaneessiitii irra deebi'ii yaali.",
|
||||||
"locked": "Yaaliin dogoggoraa baay'ateera. Koodii haaraa ergi.",
|
"locked": "Yaaliin dogoggoraa baay'ateera. Koodii haaraa ergi.",
|
||||||
"noIdentity": "Herrega barataa uumuuf Claude'tti seenii agarsiisa kana bani.",
|
"noIdentity": "Herrega barataa uumuuf Claude'tti seenii agarsiisa kana bani.",
|
||||||
"welcome": "Welcome back",
|
"welcome": "Welcome back",
|
||||||
|
|
@ -124,7 +125,12 @@
|
||||||
"all": "Hunda",
|
"all": "Hunda",
|
||||||
"count": "Koorsii {n}",
|
"count": "Koorsii {n}",
|
||||||
"empty": "Koorsiin “{q}” wajjin walsimu hin jiru. Jecha gabaabaa yaali.",
|
"empty": "Koorsiin “{q}” wajjin walsimu hin jiru. Jecha gabaabaa yaali.",
|
||||||
"emptyCategory": "Ramaddii kana keessa ammatti koorsiin hin jiru."
|
"emptyCategory": "Ramaddii kana keessa ammatti koorsiin hin jiru.",
|
||||||
|
"clearSearch": "Barbaacha haqi",
|
||||||
|
"taughtIn": "Afaan barsiisaa",
|
||||||
|
"anyLanguage": "Afaan kamiyyuu",
|
||||||
|
"clearFilters": "Calaltuu haqi",
|
||||||
|
"emptyLanguage": "Afaan kanaan koorsiin ammaaf hin jiru."
|
||||||
},
|
},
|
||||||
"course": {
|
"course": {
|
||||||
"buyShort": "Koorsii bitadhu",
|
"buyShort": "Koorsii bitadhu",
|
||||||
|
|
@ -151,6 +157,7 @@
|
||||||
"watchAgain": "Irra deebi'ii ilaali",
|
"watchAgain": "Irra deebi'ii ilaali",
|
||||||
"tabOverview": "Overview",
|
"tabOverview": "Overview",
|
||||||
"tabInstructor": "Instructor",
|
"tabInstructor": "Instructor",
|
||||||
|
"about": "Waa'ee koorsii kanaa",
|
||||||
"summary": "Summary",
|
"summary": "Summary",
|
||||||
"duration": "Total duration",
|
"duration": "Total duration",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
|
|
@ -217,6 +224,9 @@
|
||||||
"progress": "Barnoota {total} keessaa {done} xumurameera",
|
"progress": "Barnoota {total} keessaa {done} xumurameera",
|
||||||
"nowPlaying": "Amma taphachaa jira",
|
"nowPlaying": "Amma taphachaa jira",
|
||||||
"upNext": "Kan itti aanu",
|
"upNext": "Kan itti aanu",
|
||||||
|
"nextShort": "Itti aanu",
|
||||||
|
"playNow": "Amma taphachiisi",
|
||||||
|
"autoNext": "Sekondii {n} keessatti jalqaba",
|
||||||
"courseProgress": "Koorsiin {pct}% xumurameera",
|
"courseProgress": "Koorsiin {pct}% xumurameera",
|
||||||
"courseDoneT": "Koorsiin xumurameera",
|
"courseDoneT": "Koorsiin xumurameera",
|
||||||
"courseDone": "{course} xumurteetta. Bara baraan kan kee ta'a; yeroo barbaadde barnoota kamittuu deebi'i.",
|
"courseDone": "{course} xumurteetta. Bara baraan kan kee ta'a; yeroo barbaadde barnoota kamittuu deebi'i.",
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@
|
||||||
"resend": "ሓድሽ ኮድ ስደድ",
|
"resend": "ሓድሽ ኮድ ስደድ",
|
||||||
"resendIn": "ድሕሪ {s} ካልኢት ሓድሽ ኮድ ክትሰድድ ትኽእል",
|
"resendIn": "ድሕሪ {s} ካልኢት ሓድሽ ኮድ ክትሰድድ ትኽእል",
|
||||||
"wrongCode": "እቲ ኮድ ጌጋ እዩ። {n} ፈተነ ተሪፉ።",
|
"wrongCode": "እቲ ኮድ ጌጋ እዩ። {n} ፈተነ ተሪፉ።",
|
||||||
|
"networkError": "ምስ ሰርቨር ክራኸብ ኣይተኻእለን። ርክብካ ኣረጋግጽን እንደገና ፈትንን።",
|
||||||
"locked": "ብዙሕ ጌጋ ፈተነታት። ሓድሽ ኮድ ስደድ።",
|
"locked": "ብዙሕ ጌጋ ፈተነታት። ሓድሽ ኮድ ስደድ።",
|
||||||
"noIdentity": "ናይ ተማሃራይ ሕሳብ ንምፍጣር ናብ Claude ኣቲኻ እዚ መርኣያ ክፈቶ።",
|
"noIdentity": "ናይ ተማሃራይ ሕሳብ ንምፍጣር ናብ Claude ኣቲኻ እዚ መርኣያ ክፈቶ።",
|
||||||
"welcome": "Welcome back",
|
"welcome": "Welcome back",
|
||||||
|
|
@ -124,7 +125,12 @@
|
||||||
"all": "ኩሉ",
|
"all": "ኩሉ",
|
||||||
"count": "{n} ኮርሳት",
|
"count": "{n} ኮርሳት",
|
||||||
"empty": "ምስ «{q}» ዝሰማማዕ ኮርስ የለን። ሓጺር ቃል ፈትን።",
|
"empty": "ምስ «{q}» ዝሰማማዕ ኮርስ የለን። ሓጺር ቃል ፈትን።",
|
||||||
"emptyCategory": "ኣብዚ ምድብ ክሳብ ሕጂ ኮርስ የለን።"
|
"emptyCategory": "ኣብዚ ምድብ ክሳብ ሕጂ ኮርስ የለን።",
|
||||||
|
"clearSearch": "ምድላይ ኣጽሪ",
|
||||||
|
"taughtIn": "ቋንቋ ምምሃር",
|
||||||
|
"anyLanguage": "ዝኾነ ቋንቋ",
|
||||||
|
"clearFilters": "መጻረዪታት ኣጽሪ",
|
||||||
|
"emptyLanguage": "ብዚ ቋንቋ ክሳብ ሕጂ ኮርስ የለን።"
|
||||||
},
|
},
|
||||||
"course": {
|
"course": {
|
||||||
"buyShort": "ኮርስ ግዝእ",
|
"buyShort": "ኮርስ ግዝእ",
|
||||||
|
|
@ -151,6 +157,7 @@
|
||||||
"watchAgain": "እንደገና ርአ",
|
"watchAgain": "እንደገና ርአ",
|
||||||
"tabOverview": "Overview",
|
"tabOverview": "Overview",
|
||||||
"tabInstructor": "Instructor",
|
"tabInstructor": "Instructor",
|
||||||
|
"about": "ብዛዕባ እዚ ኮርስ",
|
||||||
"summary": "Summary",
|
"summary": "Summary",
|
||||||
"duration": "Total duration",
|
"duration": "Total duration",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
|
|
@ -217,6 +224,9 @@
|
||||||
"progress": "ካብ {total} ትምህርትታት {done} ተወዲኦም",
|
"progress": "ካብ {total} ትምህርትታት {done} ተወዲኦም",
|
||||||
"nowPlaying": "ሕጂ ይርአ ኣሎ",
|
"nowPlaying": "ሕጂ ይርአ ኣሎ",
|
||||||
"upNext": "ቀጻሊ",
|
"upNext": "ቀጻሊ",
|
||||||
|
"nextShort": "ቀጻሊ",
|
||||||
|
"playNow": "ሕጂ ኣጻውት",
|
||||||
|
"autoNext": "ኣብ {n} ካልኢት ይጅምር",
|
||||||
"courseProgress": "ኮርስ {pct}% ተወዲኡ",
|
"courseProgress": "ኮርስ {pct}% ተወዲኡ",
|
||||||
"courseDoneT": "ኮርስ ተወዲኡ",
|
"courseDoneT": "ኮርስ ተወዲኡ",
|
||||||
"courseDone": "{course} ወዲእኪ። ንሓዋሩ ናትኪ እዩ፣ ኣብ ዝደለኽዮ ግዜ ናብ ዝኾነ ትምህርቲ ተመለሲ።",
|
"courseDone": "{course} ወዲእኪ። ንሓዋሩ ናትኪ እዩ፣ ኣብ ዝደለኽዮ ግዜ ናብ ዝኾነ ትምህርቲ ተመለሲ።",
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ importers:
|
||||||
|
|
||||||
packages/data:
|
packages/data:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@types/node':
|
||||||
|
specifier: ^22
|
||||||
|
version: 22.20.5
|
||||||
'@types/react':
|
'@types/react':
|
||||||
specifier: ^19
|
specifier: ^19
|
||||||
version: 19.3.0
|
version: 19.3.0
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
{
|
{
|
||||||
"installCommand": "npx -y pnpm@9 install --frozen-lockfile",
|
"installCommand": "npx -y pnpm@9 install --frozen-lockfile",
|
||||||
"buildCommand": "npx -y pnpm@9 --filter demo build && node tools/vercel-build.mjs",
|
"buildCommand": "npx -y pnpm@9 run app:build",
|
||||||
"outputDirectory": "apps/demo/out",
|
"outputDirectory": "apps/demo/out",
|
||||||
"framework": null,
|
"framework": null,
|
||||||
"rewrites": [{ "source": "/waitlist", "destination": "/waitlist/index.html" }]
|
"rewrites": [
|
||||||
|
{
|
||||||
|
"source": "/waitlist",
|
||||||
|
"destination": "/waitlist/index.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user