Redesign study Notes, Reflection questions and Community pages; v2.12.0
Publish Container / build (push) Successful in 15m20s

- Notes: two-pane reader with searchable lesson list and snippets, track chips, friendlier empty states
- Reflection questions: numbered question cards, answered progress bar, unsaved-changes status, sticky save bar, share-to-discussion only when discussion is open
- Community: compact header, lesson browser sidebar with post counts (select on mobile), guidelines card, card-style posts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-09 12:00:09 -04:00
1 parent 0ab94bfcd4
commit eff119e7f0
4 files changed
+803 -175

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "siteforge",
"version": "2.11.2",
"version": "2.12.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "siteforge",
"version": "2.11.2",
"version": "2.12.0",
"dependencies": {
"@aws-sdk/client-s3": "^3.1135.0",
"@dnd-kit/core": "^6.3.1",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "siteforge",
"private": true,
"version": "2.11.2",
"version": "2.12.0",
"type": "module",
"scripts": {
"dev": "vite",
+502
View File
@@ -4156,6 +4156,346 @@
border-left: 3px solid rgba(111, 207, 151, 0.7);
}
/* ── Reflection questions ── */
.quiz-page {
padding: clamp(1.5rem, 4vw, 2.5rem) 1.25rem 5rem;
background:
radial-gradient(ellipse at top, rgba(201, 168, 76, 0.09) 0%, transparent 55%),
var(--brand-black);
}
.quiz-shell { max-width: 780px; margin: 0 auto; }
.quiz-header { margin: 1rem 0 1.5rem; }
.quiz-header .eyebrow { margin: 0; }
.quiz-header h1 {
margin: 0.15rem 0 0.2rem;
font-family: var(--brand-font-heading);
font-size: clamp(1.9rem, 4.5vw, 2.6rem);
color: var(--brand-warm-white);
}
.quiz-reference {
margin: 0 0 0.75rem;
color: var(--brand-gold);
font-size: 0.82rem;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.quiz-intro { margin: 0 0 1.25rem; color: var(--brand-muted); line-height: 1.6; max-width: 600px; }
.quiz-progress-label {
display: flex;
justify-content: space-between;
gap: 1rem;
margin-bottom: 0.4rem;
font-size: 0.85rem;
color: var(--brand-muted);
}
.quiz-progress-label a { color: var(--brand-gold); text-decoration: none; }
.quiz-progress-label a:hover { text-decoration: underline; }
.quiz-form { display: flex; flex-direction: column; gap: 1rem; }
.quiz-card {
padding: 1.25rem 1.35rem;
border: 1px solid rgba(201, 168, 76, 0.2);
border-radius: 16px;
background: rgba(17, 17, 15, 0.84);
transition: border-color 0.2s ease;
}
.quiz-card:focus-within { border-color: rgba(201, 168, 76, 0.55); }
.quiz-card--answered { border-left: 3px solid rgba(111, 207, 151, 0.7); }
.quiz-card-head { display: flex; gap: 0.85rem; align-items: flex-start; margin-bottom: 0.85rem; }
.quiz-card-number {
flex-shrink: 0;
width: 2rem;
height: 2rem;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
border: 1px solid rgba(201, 168, 76, 0.55);
background: rgba(201, 168, 76, 0.12);
color: var(--brand-gold);
font-family: var(--brand-font-heading);
font-weight: 700;
}
.quiz-card-question {
font-family: var(--brand-font-heading);
font-size: 1.25rem;
line-height: 1.35;
color: var(--brand-warm-white);
padding-top: 0.1rem;
}
.quiz-card-textarea {
width: 100%;
min-height: 110px;
box-sizing: border-box;
resize: vertical;
padding: 0.8rem 1rem;
border: 1px solid rgba(201, 168, 76, 0.22);
border-radius: 12px;
background: rgba(255, 255, 255, 0.04);
color: var(--brand-warm-white);
font-family: var(--brand-font-body);
font-size: 1rem;
line-height: 1.6;
}
.quiz-card-textarea:focus { outline: none; border-color: rgba(201, 168, 76, 0.6); }
.quiz-card-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
margin-top: 0.6rem;
flex-wrap: wrap;
}
.quiz-card-count { font-size: 0.78rem; color: var(--brand-muted); }
.quiz-savebar {
position: sticky;
bottom: 0.75rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
flex-wrap: wrap;
padding: 0.85rem 1.1rem;
border: 1px solid rgba(201, 168, 76, 0.35);
border-radius: 14px;
background: rgba(14, 14, 12, 0.96);
backdrop-filter: blur(6px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.quiz-savebar-status { margin: 0; font-size: 0.9rem; color: var(--brand-muted); }
.quiz-savebar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
@media (max-width: 560px) {
.quiz-savebar { padding: 0.6rem 0.75rem; gap: 0.5rem; }
.quiz-savebar-status { width: 100%; font-size: 0.8rem; }
.quiz-savebar-actions { width: 100%; flex-wrap: nowrap; }
.quiz-savebar-actions .btn-primary,
.quiz-savebar-actions .btn-secondary { flex: 1; justify-content: center; padding: 0.55rem 0.5rem; font-size: 0.8rem; letter-spacing: 0.04em; }
}
/* ── My Notes ── */
.notes-page {
padding: clamp(1.5rem, 4vw, 2.5rem) 1.25rem 4rem;
background:
radial-gradient(ellipse at top, rgba(201, 168, 76, 0.09) 0%, transparent 55%),
var(--brand-black);
}
.notes-shell { max-width: 1040px; margin: 0 auto; }
.notes-header {
display: flex;
align-items: flex-end;
justify-content: space-between;
flex-wrap: wrap;
gap: 1rem;
margin: 1rem 0 1.25rem;
}
.notes-header .eyebrow { margin: 0; }
.notes-header h1 {
margin: 0.15rem 0 0.2rem;
font-family: var(--brand-font-heading);
font-size: clamp(1.9rem, 4.5vw, 2.6rem);
color: var(--brand-warm-white);
}
.notes-subtitle { margin: 0; color: var(--brand-muted); }
.notes-header-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.notes-tracks {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
margin-bottom: 1.25rem;
}
.notes-track {
padding: 0.4rem 1rem;
border: 1px solid rgba(201, 168, 76, 0.3);
border-radius: 999px;
color: var(--brand-muted);
text-decoration: none;
font-size: 0.88rem;
}
.notes-track:hover { color: var(--brand-warm-white); border-color: rgba(201, 168, 76, 0.6); }
.notes-track--active {
background: var(--brand-gold);
border-color: var(--brand-gold);
color: var(--brand-black);
font-weight: 600;
}
.notes-layout {
display: grid;
grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
gap: 1.25rem;
align-items: start;
}
.notes-list-pane {
position: sticky;
top: 5.5rem;
max-height: calc(100vh - 7rem);
overflow-y: auto;
padding: 0.9rem;
border: 1px solid rgba(201, 168, 76, 0.2);
border-radius: 16px;
background: rgba(17, 17, 15, 0.84);
}
.notes-search {
width: 100%;
margin-bottom: 0.75rem;
padding: 0.6rem 0.9rem;
border: 1px solid rgba(201, 168, 76, 0.25);
border-radius: 999px;
background: rgba(255, 255, 255, 0.04);
color: var(--brand-warm-white);
font-family: var(--brand-font-body);
font-size: 0.9rem;
}
.notes-search:focus { outline: none; border-color: rgba(201, 168, 76, 0.6); }
.notes-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.notes-item {
width: 100%;
display: flex;
gap: 0.75rem;
align-items: flex-start;
padding: 0.7rem 0.7rem;
border: 1px solid transparent;
border-radius: 12px;
background: none;
color: inherit;
text-align: left;
cursor: pointer;
font-family: var(--brand-font-body);
}
.notes-item:hover { background: rgba(201, 168, 76, 0.07); }
.notes-item--active {
background: rgba(201, 168, 76, 0.12);
border-color: rgba(201, 168, 76, 0.45);
}
.notes-item-number {
flex-shrink: 0;
width: 1.9rem;
height: 1.9rem;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
border: 1px solid rgba(201, 168, 76, 0.5);
color: var(--brand-gold);
font-family: var(--brand-font-heading);
font-weight: 700;
font-size: 0.95rem;
}
.notes-item-body { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.notes-item-body strong { color: var(--brand-warm-white); font-weight: 600; font-size: 0.95rem; }
.notes-item-body small { color: var(--brand-gold); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.notes-item-snippet {
color: var(--brand-muted);
font-size: 0.82rem;
line-height: 1.4;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.notes-reader {
padding: clamp(1.25rem, 3vw, 2rem);
border: 1px solid rgba(201, 168, 76, 0.22);
border-radius: 18px;
background: linear-gradient(180deg, rgba(26, 26, 22, 0.95), rgba(16, 16, 14, 0.95));
}
.notes-reader-label {
margin: 0 0 0.3rem;
font-size: 0.75rem;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--brand-gold);
}
.notes-reader h2 {
margin: 0 0 1.25rem;
font-family: var(--brand-font-heading);
font-size: clamp(1.5rem, 3vw, 2rem);
color: var(--brand-warm-white);
}
.notes-block + .notes-block { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid rgba(201, 168, 76, 0.14); }
.notes-block h3 {
margin: 0 0 0.5rem;
font-size: 0.78rem;
letter-spacing: 0.12em;
text-transform: uppercase;
font-family: var(--brand-font-body);
font-weight: 600;
color: var(--brand-muted);
}
.notes-reader-actions { margin-top: 1.75rem; }
.notes-empty {
max-width: 520px;
margin: 2rem auto;
padding: 2rem;
text-align: center;
border: 1px solid rgba(201, 168, 76, 0.22);
border-radius: 18px;
background: rgba(17, 17, 15, 0.84);
}
.notes-empty-icon { font-size: 2.2rem; margin-bottom: 0.5rem; }
.notes-empty h2 {
margin: 0 0 0.5rem;
font-family: var(--brand-font-heading);
color: var(--brand-warm-white);
}
.notes-empty p { margin: 0 0 1.25rem; color: var(--brand-muted); line-height: 1.6; }
.notes-empty-text { color: var(--brand-muted); font-size: 0.92rem; }
@media (max-width: 820px) {
.notes-layout { grid-template-columns: 1fr; }
.notes-list-pane { position: static; max-height: 18rem; }
}
/* ── My Account ── */
.account-page {
padding: clamp(1.5rem, 5vw, 3rem) 1.25rem 4rem;
@@ -14338,3 +14678,165 @@ a.study-track-card:hover {
.admin-tabs--page { margin: 0 0 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #2a2518; }
.admin-tabs--page .admin-tab { font-size: 0.8rem; padding: 0.45rem 0.9rem; }
/* ── Study community (redesign) ── */
.community-page {
padding: clamp(1.5rem, 4vw, 2.5rem) 1.25rem 4rem;
background:
radial-gradient(ellipse at top, rgba(201, 168, 76, 0.09) 0%, transparent 55%),
var(--brand-black);
}
.community-shell { max-width: 1040px; margin: 0 auto; }
.community-header {
display: flex;
align-items: flex-end;
justify-content: space-between;
flex-wrap: wrap;
gap: 1rem;
margin: 1rem 0 1.5rem;
}
.community-header .eyebrow { margin: 0; }
.community-header h1 {
margin: 0.15rem 0 0.2rem;
font-family: var(--brand-font-heading);
font-size: clamp(1.9rem, 4.5vw, 2.6rem);
color: var(--brand-warm-white);
}
.community-subtitle { margin: 0; color: var(--brand-muted); }
.community-header-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.community-layout {
display: grid;
grid-template-columns: minmax(0, 1fr) 300px;
gap: 1.5rem;
align-items: start;
}
.community-layout > .community-feed { min-width: 0; }
.community-layout .community-post-card {
padding: 1.1rem 1.25rem;
margin-bottom: 0.85rem;
border: 1px solid rgba(201, 168, 76, 0.18);
border-radius: 14px;
background: rgba(17, 17, 15, 0.84);
}
.community-layout .community-post-card:last-child { border-bottom: 1px solid rgba(201, 168, 76, 0.18); }
.community-layout .community-compose-card {
border-color: rgba(201, 168, 76, 0.3);
background: linear-gradient(180deg, rgba(26, 26, 22, 0.95), rgba(16, 16, 14, 0.95));
}
.community-aside {
position: sticky;
top: 5.5rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
.community-aside-card {
padding: 1.1rem 1.15rem;
border: 1px solid rgba(201, 168, 76, 0.2);
border-radius: 16px;
background: rgba(17, 17, 15, 0.84);
}
.community-aside-card h2 {
margin: 0 0 0.7rem;
font-family: var(--brand-font-heading);
font-size: 1.1rem;
color: #e8d9b5;
}
.community-lesson-list {
list-style: none;
margin: 0;
padding: 0;
max-height: 22rem;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.community-lesson-item {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.75rem;
padding: 0.5rem 0.7rem;
border: 1px solid transparent;
border-radius: 10px;
background: none;
color: var(--brand-muted);
text-align: left;
font-family: var(--brand-font-body);
font-size: 0.9rem;
cursor: pointer;
}
.community-lesson-item:hover { background: rgba(201, 168, 76, 0.07); color: var(--brand-warm-white); }
.community-lesson-item--active {
background: rgba(201, 168, 76, 0.12);
border-color: rgba(201, 168, 76, 0.4);
color: var(--brand-warm-white);
}
.community-lesson-item small {
flex-shrink: 0;
min-width: 1.5rem;
padding: 0.05rem 0.45rem;
border-radius: 999px;
background: rgba(201, 168, 76, 0.14);
color: var(--brand-gold);
text-align: center;
font-size: 0.75rem;
}
.community-aside-note { margin: 0.75rem 0 0; font-size: 0.85rem; color: var(--brand-muted); }
.community-guidelines {
margin: 0;
padding-left: 1.1rem;
color: #b9aa86;
font-size: 0.88rem;
line-height: 1.6;
}
.community-filter-select { display: none; margin-bottom: 1rem; }
.community-filter-select label {
display: block;
margin-bottom: 0.3rem;
font-size: 0.75rem;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--brand-muted);
}
.community-filter-select select {
width: 100%;
padding: 0.6rem 0.8rem;
border: 1px solid rgba(201, 168, 76, 0.3);
border-radius: 10px;
background: rgba(255, 255, 255, 0.04);
color: var(--brand-warm-white);
font-family: var(--brand-font-body);
}
@media (max-width: 860px) {
.community-layout { grid-template-columns: 1fr; }
.community-aside { position: static; order: 2; }
.community-aside .community-aside-card:first-child { display: none; }
.community-filter-select { display: block; }
}
+298 -172
View File
@@ -418,15 +418,23 @@ function CommunityBoard({
}
}
const postCountFor = (sectionId: string) => posts.filter(p => p.sectionId === sectionId).length
const lessonsForFilter = releasedSections.filter(item => postCountFor(item.id) > 0 || item.id === activeSection)
const activeSectionTitle = releasedSections.find(item => item.id === activeSection)?.title
return (
<div className="community-layout">
<div className="community-feed">
{/* Section filter tabs */}
{/* Mobile lesson filter */}
{releasedSections.length > 1 && canParticipate && (
<div className="community-filter-bar">
<button type="button" className={`community-filter-chip${activeSection === '' ? ' community-filter-chip--active' : ''}`} onClick={() => setActiveSection('')}>All</button>
{releasedSections.map(s => (
<button key={s.id} type="button" className={`community-filter-chip${activeSection === s.id ? ' community-filter-chip--active' : ''}`} onClick={() => setActiveSection(s.id)}>{s.title}</button>
))}
<div className="community-filter-select">
<label htmlFor="community-lesson-select">Lesson</label>
<select id="community-lesson-select" value={activeSection} onChange={e => setActiveSection(e.target.value)}>
<option value="">All discussion ({posts.length})</option>
{releasedSections.map(item => (
<option key={item.id} value={item.id}>{item.title}{postCountFor(item.id) > 0 ? ` (${postCountFor(item.id)})` : ''}</option>
))}
</select>
</div>
)}
@@ -580,6 +588,40 @@ function CommunityBoard({
</div>
)}
</div>
{canParticipate && (
<aside className="community-aside" aria-label="Browse by lesson">
<section className="community-aside-card">
<h2>Browse by lesson</h2>
<ul className="community-lesson-list">
<li>
<button type="button" className={`community-lesson-item${activeSection === '' ? ' community-lesson-item--active' : ''}`} onClick={() => setActiveSection('')}>
<span>All discussion</span><small>{posts.length}</small>
</button>
</li>
{lessonsForFilter.map(item => (
<li key={item.id}>
<button type="button" className={`community-lesson-item${activeSection === item.id ? ' community-lesson-item--active' : ''}`} onClick={() => setActiveSection(item.id)}>
<span>{item.title}</span><small>{postCountFor(item.id)}</small>
</button>
</li>
))}
</ul>
{activeSection && activeSectionTitle && postCountFor(activeSection) === 0 && (
<p className="community-aside-note">No posts on “{activeSectionTitle}” yet — yours can be the first.</p>
)}
</section>
<section className="community-aside-card">
<h2>Community guidelines</h2>
<ul className="community-guidelines">
<li>Be gracious — assume the best of others.</li>
<li>Stay on topic and close to the text.</li>
<li>Ask honest questions; share what you're learning.</li>
</ul>
</section>
</aside>
)}
</div>
)
}
@@ -2659,6 +2701,7 @@ export function ColossiansStudyNotesPage({ content }: Props) {
const [loading, setLoading] = useState(true)
const [message, setMessage] = useState('')
const [activeNoteTab, setActiveNoteTab] = useState('')
const [noteQuery, setNoteQuery] = useState('')
usePageMeta(
study ? `My Notes | ${study.title}` : 'My Study Notes',
@@ -2737,108 +2780,149 @@ export function ColossiansStudyNotesPage({ content }: Props) {
? getStudies(content).filter(s => (auth.enrolledStudySlugs ?? []).includes(s.slug.toLowerCase()))
: []
return (
<main className="study-section-page" aria-label="My study notes">
<section className="section-study-classroom">
<div className="section-inner">
<Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Studies', href: '/study' }, { label: study.title, href: `/study/${study.slug}` }, { label: 'My Notes' }]} />
<Link to={`/study/${study.slug}`} className="study-detail-back">Back to {study.title}</Link>
<p className="study-lesson-label">Student Workspace</p>
<h1>My Lesson Notes</h1>
{!loading && auth.authenticated && <p className="study-detail-summary">Signed in as {auth.username}</p>}
{enrolledStudies.length > 1 && (
<div className="study-track-switcher">
<p className="study-lesson-label">Switch Track</p>
<div className="study-track-switcher-tabs">
{enrolledStudies.map(s => (
<Link
key={s.slug}
to={`/study/${s.slug}/notes`}
className={`study-track-tab${s.slug === study.slug ? ' study-track-tab--active' : ''}`}
>
{s.title}
</Link>
))}
</div>
</div>
)}
{!loading && auth.authenticated && (
<div className="study-signup-actions" style={{ marginBottom: '1rem' }}>
<Link to="/study/account" className="btn-secondary">My Account</Link>
<Link to={`/study/${study.slug}`} className="btn-secondary">Back to Lessons</Link>
</div>
)}
const stripHtml = (html: string) => DOMPurify.sanitize(html, { ALLOWED_TAGS: [] }).replace(/\s+/g, ' ').trim()
const noteText = (raw: string) => Object.values(parseNoteMap(raw)).map(value => stripHtml(value ?? '')).filter(Boolean).join(' · ')
const sorted = [...entries].sort((a, b) => {
const aNum = a.section ? getLessonNumber(study.sections, a.section.id) : 0
const bNum = b.section ? getLessonNumber(study.sections, b.section.id) : 0
return aNum - bNum
})
const queryText = noteQuery.trim().toLowerCase()
const visible = queryText
? sorted.filter(item => `${item.section?.title ?? ''} ${item.section?.reference ?? ''} ${noteText(item.note)}`.toLowerCase().includes(queryText))
: sorted
const active = visible.find(item => item.sectionId === activeNoteTab) ?? visible[0]
{loading && <p className="study-detail-copy">Loading your notes...</p>}
{!loading && !auth.authenticated && (
<article className="study-class-block">
<h2>Sign In Required</h2>
<p className="study-detail-copy">Open any lesson and sign in from the Student Notes panel to see your saved notes here.</p>
<Link to="/study/signup" className="btn-primary">Create Account or Sign In</Link>
</article>
)}
{!loading && auth.authenticated && !enrolled && (
<article className="study-class-block">
<h2>Enrollment Required</h2>
<p className="study-detail-copy">You need to enroll in this study before accessing your notes.</p>
<Link to={`/study/${study.slug}`} className="btn-primary">Go to Study Enrollment</Link>
</article>
)}
{!loading && auth.authenticated && enrolled && entries.length === 0 && (
<article className="study-class-block">
<h2>No Notes Yet</h2>
<p className="study-detail-copy">You have not saved notes yet. Open a lesson and use the Student Notes area to start.</p>
{study.sections[0] && <Link to={`/study/${study.slug}/${study.sections[0].id}`} className="btn-primary">Open First Lesson</Link>}
</article>
)}
{!loading && auth.authenticated && enrolled && entries.length > 0 && (() => {
const sorted = [...entries].sort((a, b) => {
const aNum = a.section ? getLessonNumber(study.sections, a.section.id) : 0
const bNum = b.section ? getLessonNumber(study.sections, b.section.id) : 0
return aNum - bNum
})
const active = sorted.find(item => item.sectionId === activeNoteTab) ?? sorted[0]
return (
<div className="study-notebook">
<div className="study-notebook-tabs" role="tablist" aria-label="Lesson notes">
{sorted.map(({ sectionId, section }) => (
<button
key={sectionId}
type="button"
role="tab"
aria-selected={active.sectionId === sectionId}
className={`study-notebook-tab${active.sectionId === sectionId ? ' study-notebook-tab--active' : ''}`}
onClick={() => setActiveNoteTab(sectionId)}
>
{section ? `Lesson ${getLessonNumber(study.sections, section.id)}` : 'Saved Note'}
</button>
))}
</div>
<article className="study-notebook-page">
<p className="study-module-lesson">{active.section ? `Lesson ${getLessonNumber(study.sections, active.section.id)}` : 'Saved Note'}</p>
<h3>{active.section?.title ?? active.sectionId}</h3>
<p className="study-detail-reference">{active.section ? active.section.reference : 'Lesson reference unavailable'}</p>
{(() => {
const anchorMap = parseNoteMap(active.note)
const hasContent = Object.values(anchorMap).some(v => v?.trim())
if (!hasContent) return <p className="study-detail-copy">No notes saved for this lesson yet.</p>
return Object.entries(anchorMap).map(([key, html]) => (
html?.trim() ? (
<div key={key} style={{ marginBottom: '1.25rem' }}>
<p className="study-module-focus" style={{ marginBottom: '0.5rem' }}>{ANCHOR_LABELS[key] ?? key}</p>
<div className="study-note-rich-content" dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(html) }} />
</div>
) : null
))
})()}
{active.section && <Link to={`/study/${study.slug}/${active.section.id}`} className="btn-secondary">Open Lesson</Link>}
</article>
</div>
)
})()}
{message && <p className="study-note-status">{message}</p>}
</div>
</section>
return (
<main className="notes-page" aria-label="My study notes">
<div className="notes-shell">
<Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Studies', href: '/study' }, { label: study.title, href: `/study/${study.slug}` }, { label: 'My Notes' }]} />
<header className="notes-header">
<div>
<p className="eyebrow">Student Workspace</p>
<h1>My Notes</h1>
<p className="notes-subtitle">
{study.title}
{!loading && auth.authenticated && enrolled && <> · {entries.length} {entries.length === 1 ? 'lesson' : 'lessons'} with notes</>}
</p>
</div>
<div className="notes-header-actions">
<Link to={`/study/${study.slug}`} className="btn-secondary">Back to Lessons</Link>
<Link to="/study/account" className="btn-secondary">My Account</Link>
</div>
</header>
{enrolledStudies.length > 1 && (
<div className="notes-tracks" role="tablist" aria-label="Study tracks">
{enrolledStudies.map(s2 => (
<Link
key={s2.slug}
to={`/study/${s2.slug}/notes`}
className={`notes-track${s2.slug === study.slug ? ' notes-track--active' : ''}`}
aria-current={s2.slug === study.slug ? 'page' : undefined}
>
{s2.title}
</Link>
))}
</div>
)}
{loading && <p className="notes-empty-text">Loading your notes…</p>}
{!loading && !auth.authenticated && (
<div className="notes-empty">
<h2>Sign in to see your notes</h2>
<p>Open any lesson and sign in from the Student Notes panel, and your saved notes will show up here.</p>
<Link to="/study/signup" className="btn-primary">Create Account or Sign In</Link>
</div>
)}
{!loading && auth.authenticated && !enrolled && (
<div className="notes-empty">
<h2>Enroll to use notes</h2>
<p>You need to enroll in this study before you can write and read lesson notes.</p>
<Link to={`/study/${study.slug}`} className="btn-primary">Go to Study Enrollment</Link>
</div>
)}
{!loading && auth.authenticated && enrolled && entries.length === 0 && (
<div className="notes-empty">
<div className="notes-empty-icon" aria-hidden="true">📝</div>
<h2>No notes yet</h2>
<p>Open a lesson and use the Student Notes panel to jot down what stands out. Everything you save collects here, private to you.</p>
{study.sections.find(isSectionReleased) && <Link to={`/study/${study.slug}/${study.sections.find(isSectionReleased)!.id}`} className="btn-primary">Open the First Lesson</Link>}
</div>
)}
{!loading && auth.authenticated && enrolled && entries.length > 0 && (
<div className="notes-layout">
<aside className="notes-list-pane" aria-label="Lessons with notes">
<input
type="search"
className="notes-search"
placeholder="Search your notes…"
aria-label="Search your notes"
value={noteQuery}
onChange={e => setNoteQuery(e.target.value)}
/>
{visible.length === 0 ? (
<p className="notes-empty-text">No notes match “{noteQuery.trim()}”.</p>
) : (
<ul className="notes-list" role="tablist" aria-label="Lesson notes">
{visible.map(({ sectionId, section, note }) => {
const lessonNumber = section ? getLessonNumber(study.sections, section.id) : 0
const isActive = active?.sectionId === sectionId
return (
<li key={sectionId}>
<button
type="button"
role="tab"
aria-selected={isActive}
className={`notes-item${isActive ? ' notes-item--active' : ''}`}
onClick={() => setActiveNoteTab(sectionId)}
>
<span className="notes-item-number" aria-hidden="true">{lessonNumber || '•'}</span>
<span className="notes-item-body">
<strong>{section?.title ?? 'Saved note'}</strong>
<small>{section?.reference ?? ''}</small>
<span className="notes-item-snippet">{noteText(note).slice(0, 110)}</span>
</span>
</button>
</li>
)
})}
</ul>
)}
</aside>
{active && (
<article className="notes-reader" aria-label="Note">
<p className="notes-reader-label">{active.section ? `Lesson ${getLessonNumber(study.sections, active.section.id)}` : 'Saved note'}{active.section?.reference ? ` · ${active.section.reference}` : ''}</p>
<h2>{active.section?.title ?? active.sectionId}</h2>
{(() => {
const anchorMap = parseNoteMap(active.note)
const blocks = Object.entries(anchorMap).filter(([, html]) => html?.trim())
if (blocks.length === 0) return <p className="notes-empty-text">No notes saved for this lesson yet.</p>
return blocks.map(([key, html]) => (
<section className="notes-block" key={key}>
<h3>{ANCHOR_LABELS[key] ?? key}</h3>
<div className="study-note-rich-content" dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(html) }} />
</section>
))
})()}
{active.section && (
<div className="notes-reader-actions">
<Link to={`/study/${study.slug}/${active.section.id}`} className="btn-primary">Open Lesson →</Link>
</div>
)}
</article>
)}
</div>
)}
{message && <p className="study-note-status" role="alert">{message}</p>}
</div>
</main>
)
}
@@ -3942,6 +4026,7 @@ export function StudyQuizPage({ content }: Props) {
const [error, setError] = useState('')
const [shareToDiscussion, setShareToDiscussion] = useState<Record<number, boolean>>({})
const [sharedIndexes, setSharedIndexes] = useState<Set<number>>(new Set())
const [dirty, setDirty] = useState(false)
useEffect(() => {
let cancelled = false
@@ -3984,6 +4069,13 @@ export function StudyQuizPage({ content }: Props) {
}
}, [studySlug, sectionId])
useEffect(() => {
if (!dirty) return
function onBeforeUnload(e: BeforeUnloadEvent) { e.preventDefault() }
window.addEventListener('beforeunload', onBeforeUnload)
return () => window.removeEventListener('beforeunload', onBeforeUnload)
}, [dirty])
async function saveQuiz() {
if (!studySlug || !sectionId || !study || !section) return
setSaving(true)
@@ -4024,6 +4116,7 @@ export function StudyQuizPage({ content }: Props) {
})
}
setDirty(false)
setMessage(newlyShared.length > 0 ? `Answers saved and ${newlyShared.length} shared to the discussion.` : 'Answers saved.')
} catch (err) {
setError(err instanceof Error ? err.message : 'Unable to save answers.')
@@ -4083,70 +4176,102 @@ export function StudyQuizPage({ content }: Props) {
)
}
const answeredCount = sectionQuestions.filter((_, index) => (answers[index] ?? '').trim().length >= 2).length
const canShare = isDiscussionOpen(study)
return (
<main className="study-index-page" aria-label="Discussion questions">
<section className="section-study-course-hero">
<div className="section-inner study-course-hero-inner">
<main className="quiz-page" aria-label="Reflection questions">
<div className="quiz-shell">
<Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Studies', href: '/study' }, { label: study.title, href: `/study/${study.slug}` }, { label: section.title, href: `/study/${study.slug}/${section.id}` }, { label: 'Reflection' }]} />
<header className="quiz-header">
<p className="eyebrow">Reflection Questions</p>
<h1>{section.title}</h1>
<p className="study-course-hero-copy">Write out your answers below — they're saved privately. You can also choose to share individual answers to the lesson discussion.</p>
<div className="study-course-hero-actions">
<Link to={`/study/${study.slug}/${section.id}`} className="btn-secondary">Back to Lesson</Link>
</div>
</div>
</section>
{section.reference && <p className="quiz-reference">{section.reference}</p>}
<p className="quiz-intro">Take your time. Your answers are saved privately to your account{canShare ? ', and you can choose to share any of them with the lesson discussion' : ''}.</p>
{canSubmit && !loading && !error && (
<div className="quiz-progress" role="group" aria-label="Answer progress">
<div className="quiz-progress-label">
<span>{answeredCount} of {sectionQuestions.length} answered</span>
<Link to={`/study/${study.slug}/${section.id}`}>← Back to lesson</Link>
</div>
<div className="study-progress-track" role="progressbar" aria-valuemin={0} aria-valuemax={sectionQuestions.length} aria-valuenow={answeredCount}>
<div className="study-progress-fill" style={{ width: `${Math.round((answeredCount / sectionQuestions.length) * 100)}%` }} />
</div>
</div>
)}
</header>
<section className="section-study-module" style={{ paddingTop: '2rem' }}>
<div className="section-inner">
{loading ? (
<p>Loading reflection questions...</p>
) : error ? (
<p className="study-note-status">{error}</p>
) : !canSubmit ? (
<article className="study-class-block">
<h2>No Reflection Questions</h2>
<p className="study-detail-copy">This lesson does not have reflection questions configured yet.</p>
</article>
) : (
<form onSubmit={e => { e.preventDefault(); saveQuiz() }}>
{sectionQuestions.map((question, index) => (
<div key={index} className="quiz-question-block">
<p className="quiz-question-label">{`${index + 1}. ${question}`}</p>
{loading ? (
<p className="notes-empty-text">Loading reflection questions…</p>
) : error ? (
<p className="study-note-status" role="alert">{error}</p>
) : !canSubmit ? (
<div className="notes-empty">
<h2>No reflection questions</h2>
<p>This lesson doesn't have reflection questions yet.</p>
<Link to={`/study/${study.slug}/${section.id}`} className="btn-primary">Back to Lesson</Link>
</div>
) : (
<form className="quiz-form" onSubmit={e => { e.preventDefault(); void saveQuiz() }}>
{sectionQuestions.map((question, index) => {
const answer = answers[index] ?? ''
const hasAnswer = answer.trim().length >= 2
return (
<section key={index} className={`quiz-card${hasAnswer ? ' quiz-card--answered' : ''}`}>
<div className="quiz-card-head">
<span className="quiz-card-number" aria-hidden="true">{index + 1}</span>
<label className="quiz-card-question" htmlFor={`quiz-answer-${index}`}>{question}</label>
</div>
<textarea
id={`quiz-answer-${index}`}
rows={4}
className="quiz-question-textarea"
value={answers[index] ?? ''}
onChange={e => setAnswers(prev => {
const next = [...prev]
next[index] = e.target.value
return next
})}
className="quiz-card-textarea"
value={answer}
onChange={e => {
const value = e.target.value
setDirty(true)
setAnswers(prev => {
const next = [...prev]
next[index] = value
return next
})
}}
onInput={e => { const el = e.currentTarget; el.style.height = 'auto'; el.style.height = `${Math.max(el.scrollHeight, 110)}px` }}
placeholder="Write your answer here…"
/>
{(answers[index] ?? '').trim().length >= 2 && (
<label className="quiz-share-toggle">
<input
type="checkbox"
checked={shareToDiscussion[index] ?? false}
disabled={sharedIndexes.has(index)}
onChange={e => setShareToDiscussion(prev => ({ ...prev, [index]: e.target.checked }))}
/>
{sharedIndexes.has(index)
? <span className="quiz-share-label quiz-share-label--done">✓ Shared to discussion</span>
: <span className="quiz-share-label">Share this answer to the lesson discussion</span>}
</label>
)}
</div>
))}
<div style={{ display: 'flex', gap: '0.75rem', flexWrap: 'wrap', marginTop: '0.5rem' }}>
<button type="submit" className="btn-primary" disabled={saving}>{saving ? 'Saving…' : 'Save Answers'}</button>
<div className="quiz-card-foot">
{canShare && hasAnswer ? (
<label className="quiz-share-toggle">
<input
type="checkbox"
checked={shareToDiscussion[index] ?? false}
disabled={sharedIndexes.has(index)}
onChange={e => setShareToDiscussion(prev => ({ ...prev, [index]: e.target.checked }))}
/>
{sharedIndexes.has(index)
? <span className="quiz-share-label quiz-share-label--done">✓ Shared to the discussion</span>
: <span className="quiz-share-label">Share this answer with the lesson discussion</span>}
</label>
) : <span />}
<span className="quiz-card-count">{answer.length.toLocaleString()} characters</span>
</div>
</section>
)
})}
<div className="quiz-savebar">
<p className="quiz-savebar-status" role="status" aria-live="polite">
{saving ? 'Saving…' : message ? message : dirty ? 'You have unsaved changes.' : 'All answers saved.'}
</p>
<div className="quiz-savebar-actions">
<button type="button" className="btn-secondary" onClick={() => navigate(`/study/${study.slug}/${section.id}`)}>Back to Lesson</button>
<button type="submit" className="btn-primary" disabled={saving || !dirty && answeredCount === 0}>{saving ? 'Saving…' : 'Save Answers'}</button>
</div>
{message && <p className="study-note-status" style={{ marginTop: '1rem' }}>{message}</p>}
</form>
)}
</div>
</section>
</div>
</form>
)}
</div>
</main>
)
}
@@ -4311,21 +4436,22 @@ export function StudyCommunityPage({ content }: Props) {
const isEnrolled = isEnrolledInStudy(auth, study.slug)
return (
<main className="study-index-page" aria-label="Study community">
<section className="section-study-course-hero" style={{ paddingBottom: '2rem' }}>
<div className="section-inner study-course-hero-inner">
<p className="eyebrow">{study.title}</p>
<h1>Study Community</h1>
<p className="study-course-hero-copy">Talk with other enrolled students. Keep it gracious and on topic.</p>
<div className="study-course-hero-actions">
<main className="community-page" aria-label="Study community">
<div className="community-shell">
<Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Studies', href: '/study' }, { label: study.title, href: `/study/${study.slug}` }, { label: 'Community' }]} />
<header className="community-header">
<div>
<p className="eyebrow">{study.title}</p>
<h1>Study Community</h1>
<p className="community-subtitle">Talk with the other students in this study. Keep it gracious and on topic.</p>
</div>
<div className="community-header-actions">
<Link to={`/study/${study.slug}`} className="btn-secondary">Back to Study</Link>
<Link to={`/contact?source=community&study=${encodeURIComponent(study.title)}`} className="btn-primary">Ask Nate</Link>
</div>
</div>
</section>
<section className="section-inner" style={{ paddingTop: '2rem', paddingBottom: '4rem', maxWidth: '860px' }}>
</header>
<CommunityBoard study={study} auth={auth} isEnrolled={isEnrolled} sectionFilter={defaultSectionId} />
</section>
</div>
</main>
)
}