diff --git a/packages/features/src/student.tsx b/packages/features/src/student.tsx index b39dd38..8001045 100644 --- a/packages/features/src/student.tsx +++ b/packages/features/src/student.tsx @@ -9,7 +9,7 @@ import { applyHeartbeat, applyPaymentEvent, clock, COUNTRIES, courseDuration, courseProgress, createOrder, DomainError, effectiveStatus, ET_CITIES, formatDuration, formatMoney, gradeAssessment, isCompleted, isStudentVisible, lessonAccess, owns, publishedLessons, resumePoint, tr, validateLocation, validPassword, } from './domain'; -import { CopyText, Cover, Empty, FeedbackButton, fmtDate, Icon, KitIcon, Logo, Modal, VIMEO_ORIGIN, VIMEO_PLACEHOLDER, Ring, Skeleton, StatusPill } from './ui'; +import { CAT_PHOTOS, CopyText, Cover, coursePhoto, Empty, FeedbackButton, fmtDate, Icon, KitIcon, Logo, Modal, VIMEO_ORIGIN, VIMEO_PLACEHOLDER, Ring, Skeleton, StatusPill } from './ui'; import { PAY_LOGOS } from './payLogos'; const ISSUE_TYPES: IssueType[] = ['BUG', 'PAYMENT', 'VIDEO', 'ACCOUNT', 'CONTENT', 'OTHER']; @@ -253,7 +253,6 @@ function StudentRoutes() { // Hero collage and category photos (apps/demo/public/photos; credits in PHOTO_CREDITS). Decorative, so they don't wait on the catalog. const HERO_PHOTOS = ['habesha-bride.jpg', 'habesha-harari.jpg', 'habesha-trad.jpg', 'habesha-eritrean.jpg', 'hero.jpg', 'habesha-tigray.jpg']; -const CAT_PHOTOS = ['habesha-harari.jpg', 'hero.jpg', 'habesha-trad.jpg', 'habesha-eritrean.jpg']; // The live pill: faces take turns lighting up and it points people to the waitlist (apps/demo/public/waitlist). const FACES = ['habesha-tigray.jpg', 'habesha-harari.jpg', 'habesha-bride.jpg', 'hero.jpg']; const PHOTO_CREDITS: [string, string, string][] = [ @@ -441,7 +440,7 @@ function Catalog({ categorySlug }: { categorySlug?: string }) { function CoursePage({ slug }: { slug?: string }) { const t = useTranslations(); - const { courses, categories, me, locale, nav, catalogLoaded, toast } = useApp(); + const { courses, categories, me, locale, nav, catalogLoaded, toast, ds } = useApp(); const { catName } = useCatalog(); const [tab, setTab] = useState('overview'); const c = courses.find((x) => x.slug === slug); @@ -456,97 +455,111 @@ function CoursePage({ slug }: { slug?: string }) { const pre = c.prerequisiteCourseId ? courses.find((x) => x.id === c.prerequisiteCourseId) : undefined; const preDone = !pre || courseProgress(pre, me).pct === 100; const preview = lessons.find((l) => l.isPreview); + const previews = lessons.filter((l) => l.isPreview).length; const cat = categories.find((k) => k.id === c.categoryId); 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; 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 teaches = courses.filter((x) => x.instructorName === c.instructorName && isStudentVisible(x, me)).length; - const tabs: [string, string][] = [['overview', t('course.tabOverview')], ...(text.outcomes?.length ? [['outcomes', t('course.outcomes')] as [string, string]] : []), ['instructor', t('course.tabInstructor')]]; + // 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 tabs: [string, string][] = [['overview', t('course.tabOverview')], ['content', t('course.content')], ['instructor', t('course.tabInstructor')]]; + const includes: [string, ReactNode][] = [ + ['globe', LOCALE_NAMES[c.instructionLocale]], + ['video', t('course.lessons', { n: lessons.length })], + ['clock', formatDuration(courseDuration(c))], + ...(previews ? [['play', t('course.previewLessons', { n: previews })] as [string, ReactNode]] : []), + ...(c.assessments?.length ? [['quiz', t('assess.title')] as [string, ReactNode]] : []), + ['shield', t('course.lifetimeAccess')], + ]; return ( -
- -
-
-
- {c.status === 'ARCHIVED' &&
} -

{text.title}

- {text.subtitle &&

{text.subtitle}

} -
-
    -
  • {lessons.length}{t('course.lessonsLabel')}
  • -
  • {formatDuration(courseDuration(c))}{t('course.duration')}
  • -
  • {LOCALE_NAMES[c.instructionLocale]}{t('course.language')}
  • -
  • {fmtDate(c.updatedAt)}{t('course.lastUpdated')}
  • -
-
- -
- {play && } - - -
-
- {pre && !preDone &&
{t('course.prereq', { title: ct(pre, locale).title })}
} -
{tabs.map(([k, label]) => )}
- {tab === 'overview' &&
-
- {text.description &&

{text.description}

} - {text.audience &&

{t('course.audience')}: {text.audience}

} -
-
-
{t('course.instructor')}
{c.instructorName}
-
{t('course.lessonsLabel')}
{lessons.length}
-
{t('course.duration')}
{formatDuration(courseDuration(c))}
-
{t('course.language')}
{LOCALE_NAMES[c.instructionLocale]}
-
{t('course.access')}
{t('course.lifetime')}
-
-
} - {tab === 'outcomes' &&
    {text.outcomes?.map((o, i) =>
  1. {o}
  2. )}
} - {tab === 'instructor' &&
{initials(c.instructorName)}
{c.instructorName}

{t('course.teaches', { n: teaches })}

} +
+
+
+ + + {c.status === 'ARCHIVED' && } + {mine && {done ? t('course.completed') : t('course.owned')}} +
+

{text.title}

+
+ {lessons.length}{t('course.lessonsLabel')} + {formatDuration(courseDuration(c))} + {previews > 0 && {t('course.previewLessons', { n: previews })}} +
+ {(text.subtitle || text.description) &&

{text.subtitle || text.description}

} +
+ {initials(c.instructorName)} + {t('course.createdBy')}{c.instructorName} + {t('course.lastUpdated')} {fmtDate(c.updatedAt)} +
+
-
+ + +
+ {pre && !preDone &&
{t('course.prereq', { title: ct(pre, locale).title })}
} +
{tabs.map(([k, label]) => )}
+ {tab === 'overview' &&
+ {!!text.outcomes?.length && <> +

{t('course.outcomes')}

+
    {text.outcomes.map((o, k) =>
  • {o}
  • )}
+ } + {text.description &&

{text.description}

} + {text.audience &&

{t('course.audience')}: {text.audience}

} +
} + {tab === 'content' &&
+

{t('course.lessons', { n: lessons.length })} · {formatDuration(courseDuration(c))}

+ {chapters.map((ch, i) => { + const ls = [...ch.lessons].sort((a, b) => a.sortOrder - b.sortOrder).filter((l) => l.isPublished); + if (!ls.length) return null; + const d = ls.filter((l) => isCompleted(me, l.id)).length; + return ( +
+ {tr(ch.translations, locale)?.title}{d}/{ls.length} · {formatDuration(ls.reduce((s, l) => s + l.durationSec, 0))} + {ls.map((l) => )} +
+ ); + })} + {!!c.assessments?.length &&
+ {t('assess.title')}{c.assessments.filter((a) => me?.assessments?.[a.id]?.passed).length}/{c.assessments.length} + {c.assessments.map((a) => )} +
} +
} + {tab === 'instructor' &&
{initials(c.instructorName)}
{c.instructorName}

{t('course.teaches', { n: teaches })}

} +
); } @@ -853,7 +866,7 @@ function VideoPanel({ c, lesson, next }: { c: Course; lesson: Lesson; next?: Les function Checkout({ slug }: { slug?: string }) { const t = useTranslations(); - const { courses, me, locale, nav, ds, write } = useApp(); + const { courses, categories, me, locale, nav, ds, write } = useApp(); const c = courses.find((x) => x.slug === slug); const [method, setMethod] = useState('TELEBIRR'); const key = useRef(newId('idem_')); // one key per checkout screen: double clicks reuse it (PAY-09) @@ -871,29 +884,34 @@ function Checkout({ slug }: { slug?: string }) { setBusy(false); }; return ( -
-

{t('checkout.title')}

-
-
-
{ct(c, locale).title}{t('checkout.lifetime')}
-
-
- {t('landing.payTitle')} - {METHODS.map((m) => ( - - ))} -
-
{t('checkout.total')}{formatMoney(c.prices.ETB ?? 0, 'ETB')}
- {err &&

{err}

} - -

{t('checkout.simulated')}

-
- ); -} +
+
+

{t('checkout.title')}

+
+ {t('landing.payTitle')} + {METHODS.map((m) => ( + + ))} +
+

{t('landing.payNote')}

+
+ +
+ );} /** Stands in for ArifPay's hosted page. The unlock still goes through applyPaymentEvent — the same rule the webhook uses — never the return URL. */ function ProviderSim({ orderId }: { orderId?: string }) { @@ -1126,10 +1144,11 @@ function SignIn() { return (
+

{t('auth.sideTitle')}

-

{t('auth.sideBody')}

-
    {['fact1', 'fact2', 'fact3'].map((k) =>
  • {t(`landing.${k}`)}
  • )}
+

{t('landing.lead')}

+
    {['fact2', 'fact3'].map((k) =>
  • {t(`landing.${k}`)}
  • )}
{!viewer?.id ? {t('auth.noIdentity')} : step === 'start' ?
{ e.preventDefault(); send(); }}> diff --git a/packages/features/src/styles.css b/packages/features/src/styles.css index 429ddb4..f0c713b 100644 --- a/packages/features/src/styles.css +++ b/packages/features/src/styles.css @@ -768,3 +768,93 @@ fieldset[disabled] .quiz-opt { cursor: default; } .look-go { display: none; } .look-copy { right: 14px; left: 14px; bottom: 14px; } } + +/* ---------- course detail 2026-10-20 (user reference): info card + segmented tabs left, sticky purchase card right ---------- */ +.cd { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "head side" "body side"; align-items: start; } +@media (max-width: 1023px) { .cd { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "side" "body"; } } +.cd-head, .cd-buy, .cd-body { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; } +:root[data-theme="dark"] .cd-head, :root[data-theme="dark"] .cd-buy, :root[data-theme="dark"] .cd-body { background: #111; } +.cd-head { grid-area: head; padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 28px) 0; display: flex; flex-direction: column; gap: 16px; } +.cd-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; } +.cd .crumbs { gap: 8px; font-size: 13px; } +.cd .crumbs button { padding: 0; font-weight: 500; } +.cd .crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.cd-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px; background: var(--mist); font-size: 12px; font-weight: 700; } +.cd-head h1 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -.03em; max-width: 22ch; } +.cd-head h1:lang(am), .cd-head h1:lang(ti) { line-height: 1.35; letter-spacing: 0; } +.cd-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; } +.cd-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: var(--fs-sm); color: var(--ink-2); } +.cd-pill svg { color: var(--ink-3); } .cd-pill strong { color: var(--ink); } +.cd-lead { color: var(--ink-2); max-width: 70ch; } +.cd-by { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px calc(-1 * clamp(20px, 3vw, 28px)) 0; padding: 16px clamp(20px, 3vw, 28px); border-top: 1px solid var(--line); } +.cd-by-txt { display: flex; flex-direction: column; line-height: 1.3; } +.cd-by-txt em { font-size: 12px; color: var(--ink-3); } +.cd-updated { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); } + +.cd-side { grid-area: side; position: sticky; top: 84px; } +@media (max-width: 1023px) { .cd-side { position: static; } } +.cd-buy { padding: 16px; display: flex; flex-direction: column; gap: 14px; } +.cd-preview { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; border: 0; padding: 0; border-radius: 16px; overflow: hidden; background: var(--mist); cursor: pointer; } +.cd-preview[disabled] { cursor: default; } +.cd-preview img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; transition: transform 600ms var(--ease-out); } +.cd-preview:hover img { transform: scale(1.03); } +.cd-preview-pill { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 12px; border-radius: 999px; background: rgba(20, 20, 20, .55); backdrop-filter: blur(10px); color: #fff; font-size: 13px; font-weight: 600; } +.cd-preview-pill i { width: 1px; height: 14px; background: rgba(255, 255, 255, .4); } +.cd-price { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 4px 0; } +.cd-price .num { font-size: 30px; font-weight: 800; letter-spacing: -.02em; } +.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 .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-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 h2 { font-size: var(--fs-base); } +.cd-includes ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; } +.cd-includes li { display: flex; align-items: center; gap: 12px; color: var(--ink-2); } +.cd-includes li svg { color: var(--ink-3); flex: none; } + +.cd-body { grid-area: body; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; } +.cd-body > .banner { margin: 8px 8px 0; } +.cd-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--mist); } +.cd-tabs button { border: 0; background: none; padding: 12px 10px; border-radius: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: background 160ms, color 160ms, box-shadow 160ms; } +.cd-tabs button:hover { color: var(--ink); } +.cd-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 12px rgba(0, 0, 0, .06); } +:root[data-theme="dark"] .cd-tabs button[aria-selected="true"] { background: #262626; } +.cd-pane { padding: 20px clamp(12px, 2vw, 20px) 20px; display: flex; flex-direction: column; gap: 16px; } +.cd-pane h2 { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xl); letter-spacing: -.02em; } +.cd-learn { list-style: none; margin: 0; padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; background: var(--mist); border-radius: 16px; } +@media (max-width: 640px) { .cd-learn { grid-template-columns: 1fr; } } +.cd-learn li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); } +.cd-learn li svg { flex: none; margin-top: 3px; color: var(--ink); } +.cd-content { padding-top: 12px; gap: 0; } +.cd-content > p { padding: 0 4px 10px; } +.cd-content .ch { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 8px; } +.cd-content .ch:last-child { border-bottom: 1px solid var(--line); } + +/* covers: a category photo until courses have uploaded art */ +.cover.has-img { background: var(--mist); } +.cover.has-img img { object-position: center 25%; } +.cover.has-img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, .18), transparent 40%); pointer-events: none; } +.cover .pill { z-index: 1; } + +/* checkout: same two cards as the course page */ +.co { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "head side"; align-items: start; } +@media (max-width: 1023px) { .co { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "side"; } } +.co-main { padding-bottom: clamp(20px, 3vw, 28px); } +.co-main h1 { font-size: clamp(26px, 3vw, 34px); } +.co-title { font-size: var(--fs-lg); line-height: 1.25; } +.co-total { padding-top: 12px; border-top: 1px solid var(--line); } +.co-total strong { font-size: 26px; font-weight: 800; } +.co .cd-preview { aspect-ratio: 16 / 9; cursor: default; } + +/* sign-in: a portrait behind the side panel */ +.auth-side { position: relative; overflow: hidden; isolation: isolate; } +.auth-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; z-index: -2; } +.auth-side::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .15) 30%, rgba(0, 0, 0, .85) 72%); } +@media (max-width: 480px) { + .cd-tabs button { padding: 10px 4px; font-size: 14px; } + .cd-pane h2 { font-size: var(--fs-lg); } + .co .cd-preview { display: none; } +} diff --git a/packages/features/src/ui.tsx b/packages/features/src/ui.tsx index 6d410f5..a654e4d 100644 --- a/packages/features/src/ui.tsx +++ b/packages/features/src/ui.tsx @@ -84,16 +84,22 @@ export function KitIcon({ name, size = 24 }: { name: keyof typeof KIT | string; const TONES = ['rose', 'clay', 'plum', 'sand', 'sage', 'ink']; +// Stand-in photos (apps/demo/public/photos) until courses get uploaded covers: one per category, in category order. +export const CAT_PHOTOS = ['habesha-harari.jpg', 'hero.jpg', 'habesha-trad.jpg', 'habesha-eritrean.jpg']; +export function coursePhoto(course: Course, categoryIds: string[]) { + return `/photos/${CAT_PHOTOS[Math.max(0, categoryIds.indexOf(course.categoryId)) % CAT_PHOTOS.length]}`; +} + export function Cover({ course, locale, badge }: { course: Course; locale: Locale; badge?: ReactNode }) { - const { ds } = useApp(); + const { ds, categories } = useApp(); // No image → the title itself, set in Ge'ez serif, is the cover (§11.2: the script is the visual identity). // Shows the title in the other script from the page's language, so the cover adds a second language instead of repeating the card title. const other = locale === 'am' || locale === 'ti' ? 'en' : 'am'; const title = course.translations[other]?.title ?? tr(course.translations, locale)?.title ?? ''; const tone = course.coverTone && TONES.includes(course.coverTone) ? course.coverTone : 'ink'; return ( -
- {course.coverAssetId && } +
+ k.id))} alt="" loading="lazy" /> {badge} {title}
diff --git a/packages/i18n/messages/am.json b/packages/i18n/messages/am.json index 6d1b795..9429f10 100644 --- a/packages/i18n/messages/am.json +++ b/packages/i18n/messages/am.json @@ -156,7 +156,11 @@ "share": "አጋራ", "linkCopied": "ሊንኩ ተቀድቷል", "teaches": "በSirkul Makeup {n, plural, one {# ኮርስ} other {# ኮርሶች}}", - "viewDetails": "ዝርዝር ይመልከቱ" + "viewDetails": "ዝርዝር ይመልከቱ", + "includes": "ይህ ኮርስ የሚያካትተው", + "previewLessons": "{n, plural, one {# ነጻ የቅድመ እይታ ትምህርት} other {# ነጻ የቅድመ እይታ ትምህርቶች}}", + "createdBy": "ያዘጋጀው", + "lifetimeAccess": "የዕድሜ ልክ መዳረሻ" }, "checkout": { "title": "የመክፈያ መንገድ ይምረጡ", diff --git a/packages/i18n/messages/en.json b/packages/i18n/messages/en.json index dd00080..eb22f83 100644 --- a/packages/i18n/messages/en.json +++ b/packages/i18n/messages/en.json @@ -156,7 +156,11 @@ "share": "Share", "linkCopied": "Link copied", "teaches": "{n, plural, one {# course} other {# courses}} on Sirkul Makeup", - "viewDetails": "View details" + "viewDetails": "View details", + "includes": "This course includes", + "previewLessons": "{n, plural, one {# free preview lesson} other {# free preview lessons}}", + "createdBy": "Created by", + "lifetimeAccess": "Lifetime access" }, "checkout": { "title": "Choose how to pay", diff --git a/packages/i18n/messages/om.json b/packages/i18n/messages/om.json index f14ff33..94b5574 100644 --- a/packages/i18n/messages/om.json +++ b/packages/i18n/messages/om.json @@ -156,7 +156,11 @@ "share": "Share", "linkCopied": "Link copied", "teaches": "{n, plural, one {# course} other {# courses}} on Sirkul Makeup", - "viewDetails": "View details" + "viewDetails": "View details", + "includes": "Koorsiin kun kan of keessaa qabu", + "previewLessons": "{n, plural, one {Barnoota bilisaa # ilaaluu} other {Barnoota bilisaa # ilaaluu}}", + "createdBy": "Kan qopheesse", + "lifetimeAccess": "Dhaqqabummaa umurii guutuu" }, "checkout": { "title": "Akkaataa kaffaltii filadhu", diff --git a/packages/i18n/messages/ti.json b/packages/i18n/messages/ti.json index 767bd1e..72d887f 100644 --- a/packages/i18n/messages/ti.json +++ b/packages/i18n/messages/ti.json @@ -156,7 +156,11 @@ "share": "Share", "linkCopied": "Link copied", "teaches": "{n, plural, one {# course} other {# courses}} on Sirkul Makeup", - "viewDetails": "View details" + "viewDetails": "View details", + "includes": "እዚ ኮርስ ዝሓዞ", + "previewLessons": "{n, plural, one {# ነጻ ቅድመ ርእይቶ ትምህርቲ} other {# ነጻ ቅድመ ርእይቶ ትምህርትታት}}", + "createdBy": "ዘዳለዎ", + "lifetimeAccess": "ንዘለኣለም ምርካብ" }, "checkout": { "title": "መንገዲ ክፍሊት ምረጽ",