feat: generate Vazirmatn course summary PDFs and add Library study-guide cards

This commit is contained in:
Meghdad committed 2026-10-01 04:04:13 +03:30
1 parent 7223b25241
commit 0f000a8912
13 files changed
+394 -5

No files matched your search

+16
View File
@@ -211,6 +211,16 @@ function courseCard(course) {
link.href = `course.html?id=${encodeURIComponent(course.id)}`;
link.innerHTML = `Open course <span aria-hidden="true">→</span>`;
bottom.append(track, progress, link);
if (course.summary_pdf?.url) {
const pdf = document.createElement("a");
pdf.className = "guide-card-link";
pdf.href = course.summary_pdf.url;
pdf.target = "_blank";
pdf.rel = "noopener";
pdf.innerHTML = '<span class="guide-mini-icon" aria-hidden="true">▤</span><span><strong>Study guide</strong><small></small></span><span aria-hidden="true">↗</span>';
pdf.querySelector("small").textContent = `${course.summary_pdf.summary_count || 0} lesson summaries · PDF${course.summary_pdf.state === "stale" ? " · Outdated" : ""}`;
bottom.append(pdf);
}
card.append(top, title, meta, states, bottom);
return card;
}
@@ -536,6 +546,12 @@ function renderCourse() {
setText("generatedAt", `Updated ${new Date(state.catalog.generated_at).toLocaleString()}`);
byId("courseProgress").style.setProperty("--progress", percent);
byId("courseSource").href = course.source_url;
const pdf = byId("coursePdf");
pdf.hidden = !course.summary_pdf?.url;
if (course.summary_pdf?.url) {
pdf.href = course.summary_pdf.url;
setText("guideMeta", `${course.summary_pdf.summary_count || 0} lesson summaries · Persian · PDF${course.summary_pdf.state === "stale" ? " · Update available: regenerate your guide" : ""}`);
}
byId("resourceSearch").addEventListener("input", (event) => {
state.query = normalized(event.target.value);
renderResources();
+25
View File
@@ -168,6 +168,31 @@ main {
font-size: clamp(1rem, 2vw, 1.18rem);
}
#coursePdf[hidden] { display: none; }
.study-guide { display:flex; align-items:center; gap:28px; position:relative; overflow:hidden; margin-top:24px; padding:26px 32px; border:1px solid var(--line); border-radius:24px; background:linear-gradient(115deg, var(--surface), color-mix(in srgb, var(--accent) 13%, var(--surface))); text-decoration:none; transition:box-shadow .2s, border-color .2s; }
.study-guide:hover { border-color:var(--accent-strong); box-shadow:var(--shadow); }
.study-guide:focus-visible, .guide-card-link:focus-visible { outline:3px solid var(--blue); outline-offset:4px; }
.guide-cover { flex-shrink:0; display:flex; flex-direction:column; justify-content:space-between; width:88px; height:116px; padding:14px 12px 10px 17px; border-radius:3px 9px 9px 3px; background:#1c5166; color:#f5f3ec; box-shadow:-4px 0 0 #123a4b, 3px 3px 0 #dedfd4, 7px 10px 18px #17212620; transform:rotate(-6deg); transition:transform .2s; border-left:2px solid #ffffff25; }
.study-guide:hover .guide-cover { transform:rotate(-2deg) translateY(-2px); }
.guide-cover-label { font-size:11px; line-height:1.3; font-weight:850; letter-spacing:.08em; }
.guide-cover-lines { width:42px; height:16px; background:repeating-linear-gradient(to bottom, #d8f26a 0 2px, transparent 2px 7px); }
.guide-cover-format { align-self:flex-end; font-size:9px; font-weight:800; letter-spacing:.12em; color:#d8f26a; }
.guide-copy { display:grid; gap:6px; flex:1; min-width:0; }
.guide-eyebrow { color:var(--blue); font-size:.65rem; font-weight:850; letter-spacing:.14em; }
.guide-copy strong { font-size:clamp(1.3rem, 3vw, 1.8rem); line-height:1.25; letter-spacing:-.04em; }
.guide-description { color:var(--muted); font-size:.88rem; }
.guide-meta { color:var(--muted); font-size:.73rem; margin-top:5px; }
.guide-action { display:flex; gap:20px; align-items:center; padding:12px 18px; border-radius:12px; background:var(--ink); color:var(--paper); font-size:.8rem; font-weight:750; white-space:nowrap; }
.guide-card-link { display:flex; align-items:center; gap:12px; margin-top:18px; padding:12px; border:1px solid var(--line); border-radius:12px; text-decoration:none; background:color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.guide-card-link > span:nth-child(2) { flex:1; display:grid; gap:2px; }
.guide-card-link strong { font-size:.8rem; }
.guide-card-link small { font-size:.68rem; color:var(--muted); }
.guide-mini-icon { display:grid; place-items:center; width:32px; height:38px; border-radius:5px; background:var(--blue-soft); color:var(--blue); font-size:22px; }
@media(max-width:700px) { .study-guide { gap:20px; padding:22px; flex-wrap:wrap; } .guide-action { margin-left:108px; } }
@media(max-width:420px) { .guide-cover { width:64px; height:94px; padding:10px; } .guide-cover-label { font-size:9px; } .guide-description { font-size:.78rem; } .guide-action { margin-left:84px; padding:10px 12px; } }
@media(prefers-reduced-motion:reduce) { .guide-cover, .study-guide { transition:none; } }
.hero-source {
display: inline-flex;
margin-top: 22px;