Kursansicht: Player über die volle Breite, Titel und Knöpfe darunter, Einheiten als klebende Seitenspalte

- Seite war im Flex-Body auf Inhaltsbreite geschrumpft (Player nur ~160 px); jetzt bis 1400 px breit
- Desktop: Player 16:9 über die Hauptspalte, Hochformat-Videos 9:16 mittig und höchstens 80 % der Bildschirmhöhe
- Seitenspalte (360 px) klebt beim Scrollen und scrollt bei vielen Einheiten selbst; unter 1024 px untereinander
- Wasserzeichen skaliert mit der Playergröße

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-10-20 22:35:31 +02:00
parent 2fcbe88304
commit 4eee36329a
4 changed files with 23 additions and 9 deletions

View file

@ -55,7 +55,6 @@ export default async function CoursePage({ params, searchParams }: { params: Pro
done={done.has(lesson.id)} done={done.has(lesson.id)}
nextHref={next ? `/konto/kurse/${slug}?einheit=${next.id}` : null} nextHref={next ? `/konto/kurse/${slug}?einheit=${next.id}` : null}
/> />
<h1 className="display-md" style={{ margin: "var(--space-5) 0 var(--space-2)" }}>{lesson.title}</h1>
{lesson.description && <p className="body" style={{ whiteSpace: "pre-line", color: "var(--ink-muted)" }}>{lesson.description}</p>} {lesson.description && <p className="body" style={{ whiteSpace: "pre-line", color: "var(--ink-muted)" }}>{lesson.description}</p>}
</> </>
)} )}

View file

@ -21,6 +21,7 @@ export function CoursePlayer({ src, title, watermark, startAt = 0, onProgress }:
const [pos, setPos] = useState({ x: 8, y: 10 }); const [pos, setPos] = useState({ x: 8, y: 10 });
const [full, setFull] = useState(false); const [full, setFull] = useState(false);
const [error, setError] = useState(""); const [error, setError] = useState("");
const [portrait, setPortrait] = useState(false);
const lastSaved = useRef(0); const lastSaved = useRef(0);
const report = useRef(onProgress); const report = useRef(onProgress);
report.current = onProgress; report.current = onProgress;
@ -96,7 +97,7 @@ export function CoursePlayer({ src, title, watermark, startAt = 0, onProgress }:
}; };
return ( return (
<div className={`sm-player${full ? " is-full" : ""}`} ref={box} onContextMenu={(e) => e.preventDefault()}> <div className={`sm-player${full ? " is-full" : ""}${portrait ? " is-portrait" : ""}`} ref={box} onContextMenu={(e) => e.preventDefault()}>
<video <video
ref={video} ref={video}
title={title} title={title}
@ -108,6 +109,7 @@ export function CoursePlayer({ src, title, watermark, startAt = 0, onProgress }:
disablePictureInPicture disablePictureInPicture
disableRemotePlayback disableRemotePlayback
onTimeUpdate={onTime} onTimeUpdate={onTime}
onLoadedMetadata={(e) => setPortrait(e.currentTarget.videoHeight > e.currentTarget.videoWidth)}
onEnded={() => report.current?.(0, 0, true)} onEnded={() => report.current?.(0, 0, true)}
/> />
{watermark && ( {watermark && (

View file

@ -32,11 +32,14 @@ export function LessonPlayer({ lessonId, src, title, email, startAt, done, nextH
}); });
}} }}
/> />
<div className="sm-lesson__bar"> <div className="sm-lesson__head">
<h1 className="display-md">{title}</h1>
<div className="sm-lesson__bar">
<button type="button" className={`sm-btn sm-btn--sm ${isDone ? "sm-btn--secondary" : "sm-btn--ghost"}`} onClick={toggle} disabled={pending} aria-pressed={isDone}> <button type="button" className={`sm-btn sm-btn--sm ${isDone ? "sm-btn--secondary" : "sm-btn--ghost"}`} onClick={toggle} disabled={pending} aria-pressed={isDone}>
{isDone ? "✓ Erledigt" : "Als erledigt markieren"} {isDone ? "✓ Erledigt" : "Als erledigt markieren"}
</button> </button>
{nextHref && <a className="sm-btn sm-btn--primary sm-btn--sm" href={nextHref}>Nächste Einheit</a>} {nextHref && <a className="sm-btn sm-btn--primary sm-btn--sm" href={nextHref}>Nächste Einheit</a>}
</div>
</div> </div>
</> </>
); );

View file

@ -279,8 +279,11 @@ button.sm-pdp__main { display: block; width: 100%; padding: 0; border: 0; cursor
.sm-player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; } .sm-player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.sm-player__error { position: absolute; inset: auto 0 0; z-index: 4; margin: 0; padding: var(--space-3) var(--space-4); background: rgb(0 0 0 / 0.75); color: #fff; font-size: 14px; } .sm-player__error { position: absolute; inset: auto 0 0; z-index: 4; margin: 0; padding: var(--space-3) var(--space-4); background: rgb(0 0 0 / 0.75); color: #fff; font-size: 14px; }
.sm-player.is-full { border-radius: 0; aspect-ratio: auto; } .sm-player.is-full { border-radius: 0; aspect-ratio: auto; }
.sm-player__mark { position: absolute; z-index: 2; pointer-events: none; font-size: 13px; line-height: 18px; color: rgb(255 255 255 / 0.42); text-shadow: 0 0 2px rgb(0 0 0 / 0.5); white-space: nowrap; transition: left 1.6s ease, top 1.6s ease; } /* Hochformat-Videos: schmal und mittig statt riesig */
.sm-player.is-full .sm-player__mark { font-size: 18px; } .sm-player.is-portrait:not(.is-full) { aspect-ratio: 9 / 16; width: min(100%, calc(80vh * 9 / 16)); margin-inline: auto; }
.sm-player { container-type: inline-size; }
.sm-player__mark { position: absolute; z-index: 2; pointer-events: none; font-size: clamp(12px, 1.8cqi, 20px); line-height: 1.4; color: rgb(255 255 255 / 0.42); text-shadow: 0 0 2px rgb(0 0 0 / 0.5); white-space: nowrap; transition: left 1.6s ease, top 1.6s ease; }
.sm-player.is-full .sm-player__mark { font-size: clamp(16px, 1.6vw, 26px); }
.sm-player video::-webkit-media-controls-fullscreen-button { display: none; } .sm-player video::-webkit-media-controls-fullscreen-button { display: none; }
.sm-player__full { position: absolute; z-index: 3; top: 10px; right: 10px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.45); color: #fff; cursor: pointer; opacity: 0.75; } .sm-player__full { position: absolute; z-index: 3; top: 10px; right: 10px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.45); color: #fff; cursor: pointer; opacity: 0.75; }
.sm-player__full:hover, .sm-player__full:focus-visible { opacity: 1; } .sm-player__full:hover, .sm-player__full:focus-visible { opacity: 1; }
@ -308,7 +311,14 @@ button.sm-pdp__main { display: block; width: 100%; padding: 0; border: 0; cursor
.sm-mycourse__bar > span { display: block; height: 100%; background: var(--gold); } .sm-mycourse__bar > span { display: block; height: 100%; background: var(--gold); }
@media (max-width: 560px) { .sm-mycourse { grid-template-columns: 72px 1fr; } .sm-mycourse img, .sm-mycourse__ph { width: 72px; } .sm-mycourse > .sm-btn { grid-column: 1 / -1; justify-self: start; } } @media (max-width: 560px) { .sm-mycourse { grid-template-columns: 72px 1fr; } .sm-mycourse img, .sm-mycourse__ph { width: 72px; } .sm-mycourse > .sm-btn { grid-column: 1 / -1; justify-self: start; } }
.sm-lesson__grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-7); margin-top: var(--space-5); align-items: start; } /* Kursansicht: breiter als normale Seiten; body ist ein Flex-Container, ohne width würde die Seite auf den Inhalt schrumpfen */
.sm-lesson__side { position: sticky; top: var(--space-5); } .sm-lesson { width: 100%; max-width: 1400px; }
.sm-lesson__bar { display: flex; gap: var(--space-3); justify-content: space-between; flex-wrap: wrap; margin-top: var(--space-3); } .sm-lesson__grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-7); margin-top: var(--space-5); align-items: start; }
@media (max-width: 900px) { .sm-lesson__grid { grid-template-columns: 1fr; gap: var(--space-5); } .sm-lesson__side { position: static; } } .sm-lesson__side { position: sticky; top: calc(var(--header-height) + var(--space-5)); max-height: calc(100vh - var(--header-height) - var(--space-7)); overflow-y: auto; padding-right: var(--space-2); }
.sm-lesson__head { display: flex; gap: var(--space-3) var(--space-5); align-items: center; justify-content: space-between; flex-wrap: wrap; margin: var(--space-5) 0 var(--space-3); }
.sm-lesson__head h1 { margin: 0; }
.sm-lesson__bar { display: flex; gap: var(--space-3); flex-wrap: wrap; }
@media (max-width: 1023px) {
.sm-lesson__grid { grid-template-columns: 1fr; gap: var(--space-6); }
.sm-lesson__side { position: static; max-height: none; overflow: visible; padding-right: 0; }
}