From a25c02365f844f017e6883028076dcd2f48132ef Mon Sep 17 00:00:00 2001 From: n3p-tun3 Date: Mon, 26 Oct 2026 17:53:35 +0300 Subject: [PATCH] =?UTF-8?q?feat(course):=20course=20page=20polish=20P6?= =?UTF-8?q?=E2=80=93P10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - P6: "last updated" moves from the hero to the end of About - P7: quizzes sit inside their chapter; only chapterless quizzes keep a final group, and quiz rows share the lesson row's look - P8: share becomes a glass button in the hero corner; the owned chip joins the stat pills - P9: prerequisite shown in the buy card before purchase instead of a banner below it - P10: lesson rows always number in the title; the circle shows state (play, check, lock, now playing) --- packages/features/src/student.tsx | 41 ++++++++++++++++++------------- packages/features/src/styles.css | 20 ++++++++++++--- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/packages/features/src/student.tsx b/packages/features/src/student.tsx index dac8841..0c06fca 100644 --- a/packages/features/src/student.tsx +++ b/packages/features/src/student.tsx @@ -570,6 +570,8 @@ function CoursePage({ slug }: { slug?: string }) { // 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][] = [ ['globe', LOCALE_NAMES[c.instructionLocale]], @@ -592,20 +594,20 @@ function CoursePage({ slug }: { slug?: string }) { {c.status === 'ARCHIVED' && } - {mine && {done ? t('course.completed') : t('course.owned')}} +

{text.title}

{lessons.length}{t('course.lessonsLabel')} {formatDuration(courseDuration(c))} + {mine && {done ? t('course.completed') : t('course.owned')}}
{(text.subtitle || text.description) &&

{text.subtitle || text.description}

} {play && }
{initials(c.instructorName)} {t('course.createdBy')}{c.instructorName}{t('course.teaches', { n: teaches })} - {t('course.lastUpdated')} {fmtDate(c.updatedAt)}
@@ -615,13 +617,14 @@ function CoursePage({ slug }: { slug?: string }) {
{done ? t('course.completed') : t('course.owned')}{p.pct}%
{t('my.lessonsDone', { done: p.done, total: p.total })} + {pre && !preDone &&

{t('course.prereq', { title: ct(pre, locale).title })}

} {r && !done &&

{t('player.upNext')}{r.index + 1}. {lessonTitle(r.lesson, locale)}{clock(r.lesson.durationSec)}

} - {r &&
} + {r &&
} : <> {c.prices.ETB != null &&
{formatMoney(c.prices.ETB, 'ETB')}{t('checkout.lifetime')}
} + {pre && !preDone &&

{t('course.prereq', { title: ct(pre, locale).title })}

}
-

{t('course.includes')}

@@ -643,7 +646,6 @@ function CoursePage({ slug }: { slug?: string }) {
}
- {pre && !preDone &&
{t('course.prereq', { title: ct(pre, locale).title })}
}
{tabs.map(([k, label]) => )}
{!!text.outcomes?.length &&

{t('course.outcomes')}

@@ -660,18 +662,20 @@ function CoursePage({ slug }: { slug?: string }) {
{tr(ch.translations, locale)?.title}{d}/{ls.length} · {formatDuration(ls.reduce((s, l) => s + l.durationSec, 0))} {ls.map((l) => )} + {quizzes.filter((a) => a.chapterId === ch.id).map((a) => )}
); })} - {!!c.assessments?.length &&
- {t('assess.title')}{c.assessments.filter((a) => me?.assessments?.[a.id]?.passed).length}/{c.assessments.length} - {c.assessments.map((a) => )} + {!!finalQuizzes.length &&
+ {t('assess.title')}{finalQuizzes.filter((a) => me?.assessments?.[a.id]?.passed).length}/{finalQuizzes.length} + {finalQuizzes.map((a) => )}
}
{(text.description || text.audience) &&

{t('course.about')}

{text.description &&

{text.description}

} {text.audience &&

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

} +

{t('course.lastUpdated')} {fmtDate(c.updatedAt)}

}
@@ -687,9 +691,9 @@ 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; return ( ); diff --git a/packages/features/src/styles.css b/packages/features/src/styles.css index 1248b1a..f693336 100644 --- a/packages/features/src/styles.css +++ b/packages/features/src/styles.css @@ -798,8 +798,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-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; } @@ -924,9 +922,25 @@ fieldset[disabled] .quiz-opt { cursor: default; } @media (max-width: 1023px) { .cd-tabs { display: none; } .cd-body { gap: 0; } - .cd-body > .banner { order: -2; } .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 { display: flex; flex-direction: column; gap: clamp(28px, 4vw, 48px); }