diff --git a/apps/website/src/coursebuilder/workshop-lessons.test.ts b/apps/website/src/coursebuilder/workshop-lessons.test.ts index b7aed308..0be0d117 100644 --- a/apps/website/src/coursebuilder/workshop-lessons.test.ts +++ b/apps/website/src/coursebuilder/workshop-lessons.test.ts @@ -54,11 +54,23 @@ it('releases signed playback to buyers at the stored instant, never public playb null, ); assert.equal( - chapterUnlockLabel('2026-11-10T08:00:00Z'), + chapterUnlockLabel('2026-11-10T08:00:00Z', input.now), 'Unlocks Tue, Nov 10 at 12:00 AM PT', ); }); +it('labels released chapters as unlocked at and after their release time', () => { + for (const now of [ + new Date('2026-11-10T08:00:00Z'), + new Date('2026-11-11T08:00:00Z'), + ]) { + assert.equal( + chapterUnlockLabel('2026-11-10T08:00:00Z', now), + 'Unlocked Tue, Nov 10 at 12:00 AM PT', + ); + } +}); + it('public content projections remove playback and exercises through nested resource/edge API shapes', () => { const video = { id: 'video', diff --git a/apps/website/src/coursebuilder/workshop-lessons.ts b/apps/website/src/coursebuilder/workshop-lessons.ts index 37dc4cee..99559f48 100644 --- a/apps/website/src/coursebuilder/workshop-lessons.ts +++ b/apps/website/src/coursebuilder/workshop-lessons.ts @@ -14,10 +14,11 @@ export function isChapterUnlocked(startsAt: string | null, now = new Date()) { ); } -export function chapterUnlockLabel(startsAt: string | null) { +export function chapterUnlockLabel(startsAt: string | null, now = new Date()) { if (!startsAt || !Number.isFinite(Date.parse(startsAt))) return 'Release date to be announced'; - return `Unlocks ${new Intl.DateTimeFormat('en-US', { + const label = isChapterUnlocked(startsAt, now) ? 'Unlocked' : 'Unlocks'; + return `${label} ${new Intl.DateTimeFormat('en-US', { timeZone: 'America/Los_Angeles', weekday: 'short', month: 'short', diff --git a/apps/website/src/pages/workshops/[slug].astro b/apps/website/src/pages/workshops/[slug].astro index 740f01f5..2288cf1e 100644 --- a/apps/website/src/pages/workshops/[slug].astro +++ b/apps/website/src/pages/workshops/[slug].astro @@ -1,4 +1,5 @@ --- +import '../../styles/workshop-body.css'; import WorkshopTicket from '../../components/workshops/workshop-ticket.astro'; import WorkshopChapters from '../../components/workshops/workshop-chapters.astro'; import { chapterUnlockLabel } from '../../coursebuilder/workshop-lessons'; @@ -376,96 +377,6 @@ const included = [ } } - .workshop-body { - color: var(--text); - font-family: var(--font-family); - font-size: 1.0625rem; - line-height: 1.6; - max-inline-size: 68ch; - min-inline-size: 0; - overflow-wrap: anywhere; - - :global(> :first-child) { - margin-block-start: 0; - } - - :global(> * + *) { - margin-block-start: 1.25rem; - } - - :global(:is(h2, h3, h4)) { - color: var(--text-emphasized); - font-family: var(--font-family-heading); - line-height: 1.2; - } - - :global(:is(h2, h3, h4):not(:first-child)) { - margin-block-start: 2.5rem; - } - - :global(:is(h2, h3, h4) + *) { - margin-block-start: 0.75rem; - } - - :global(h3) { - font-size: 1.25em; - } - - :global(:is(ul, ol)) { - padding-inline-start: 1.5em; - } - - :global(li) { - padding-inline-start: 0.25em; - } - - :global(li + li) { - margin-block-start: 0.5rem; - } - - :global(li::marker) { - color: var(--orange); - } - - :global(li > :is(ul, ol, p) + *) { - margin-block-start: 0.75rem; - } - - :global(blockquote) { - background: var(--bg); - border-inline-start: 0.25rem solid var(--orange); - color: var(--text-emphasized); - font-style: italic; - padding: 1rem 1.25rem; - } - - :global(blockquote > * + *) { - margin-block-start: 1rem; - } - - :global(blockquote + p) { - color: var(--text-muted); - font-size: 1rem; - margin-block-start: 0.5rem; - } - - :global(blockquote + p + *) { - margin-block-start: 1rem; - } - - :global(a) { - color: var(--text-link); - text-decoration: underline; - text-decoration-thickness: 0.08em; - text-underline-offset: 0.15em; - } - - :global(pre) { - max-inline-size: 100%; - overflow-x: auto; - } - } - .workshop-faq { :global(p:has(> strong:first-child):not(:first-child)) { margin-block-start: 2rem; @@ -494,7 +405,6 @@ const included = [ text-align: center; } - .workshop-body :global(a:focus-visible), .workshop-hero-cta:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; @@ -506,7 +416,6 @@ const included = [ } .workshop-body { - font-size: 1.125rem; grid-column: 2; } } diff --git a/apps/website/src/pages/workshops/[slug]/[lesson].astro b/apps/website/src/pages/workshops/[slug]/[lesson].astro index f19052d0..16ab4f3a 100644 --- a/apps/website/src/pages/workshops/[slug]/[lesson].astro +++ b/apps/website/src/pages/workshops/[slug]/[lesson].astro @@ -1,6 +1,8 @@ --- +import '../../../styles/workshop-body.css'; import { and, eq, isNull } from 'drizzle-orm'; import Layout from '../../../layouts/default.astro'; +import Block from '../../../components/design-system/block.astro'; import MuxVideoPlayer from '../../../components/mux-video-player.astro'; import { getWorkshopForSale, @@ -86,75 +88,182 @@ const path = `/workshops/${workshop.slug}`; --- -
- {workshop.title} -

{chapter.title}

- { - !hasTicket && !preview ? ( -

- {chapterUnlockLabel(chapter.startsAt)}{' '} - Get a ticket to watch this workshop.{' '} - {!clerkUser && ( - - Sign in - - )} -

- ) : !unlocked && !preview ? ( -

{chapterUnlockLabel(chapter.startsAt)}

- ) : ( - <> - {preview && !unlocked && ( -

- - Preview:{' '} - {chapterUnlockLabel(chapter.startsAt).replace( - 'Unlocks', - 'unlocks for buyers', - )} - -

- )} - {playback ? ( - - ) : ( -

The video is not available yet.

- )} -
- {sections.map((section) => ( -
- {section.headingHtml &&

} -
-

- ))} -
- - ) - } - + + + +
+ + diff --git a/apps/website/src/styles/workshop-body.css b/apps/website/src/styles/workshop-body.css new file mode 100644 index 00000000..31f8e183 --- /dev/null +++ b/apps/website/src/styles/workshop-body.css @@ -0,0 +1,124 @@ +.workshop-body { + color: var(--text); + font-family: var(--font-family); + font-size: 1.0625rem; + line-height: 1.6; + max-inline-size: 68ch; + min-inline-size: 0; + overflow-wrap: anywhere; + + > :first-child { + margin-block-start: 0; + } + + > * + * { + margin-block-start: 1.25rem; + } + + :is(h2, h3, h4) { + color: var(--text-emphasized); + font-family: var(--font-family-heading); + line-height: 1.2; + } + + :is(h2, h3, h4):not(:first-child) { + margin-block-start: 2.5rem; + } + + :is(h2, h3, h4) + * { + margin-block-start: 0.75rem; + } + + h3 { + font-size: 1.25em; + } + + :is(ul, ol) { + padding-inline-start: 1.5em; + } + + li { + padding-inline-start: 0.25em; + } + + li + li { + margin-block-start: 0.5rem; + } + + li::marker { + color: var(--orange); + } + + li > :is(ul, ol, p) + * { + margin-block-start: 0.75rem; + } + + blockquote { + background: var(--bg); + border-inline-start: 0.25rem solid var(--orange); + color: var(--text-emphasized); + font-style: italic; + padding: 1rem 1.25rem; + } + + blockquote > * + * { + margin-block-start: 1rem; + } + + blockquote + p { + color: var(--text-muted); + font-size: 1rem; + margin-block-start: 0.5rem; + } + + blockquote + p + * { + margin-block-start: 1rem; + } + + a { + color: var(--text-link); + text-decoration: underline; + text-decoration-thickness: 0.08em; + text-underline-offset: 0.15em; + } + + a:focus-visible { + outline: 3px solid var(--orange); + outline-offset: 4px; + } + + code, + pre { + font-family: + 'monaspace-argon', 'Operator Mono', Consolas, Monaco, 'Andale Mono', + 'Ubuntu Mono', monospace; + } + + code:not(pre code) { + background: var(--bg); + border-radius: 2.5px; + color: var(--text-emphasized); + font-size: 0.875em; + padding: 0.125em 0.25em; + } + + blockquote code:not(pre code) { + background: var(--gray-200); + } + + pre { + background: var(--gray-200); + border-radius: 2.5px; + color: var(--white); + font-size: 0.8em; + max-inline-size: 100%; + overflow-x: auto; + padding: 20px; + } +} + +@media (min-width: 800px) { + .workshop-body { + font-size: 1.125rem; + } +}