diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-28 11:09:12 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-28 11:09:12 +0200 |
| commit | 694a3832f4b57d007b79b3b21dd47b55e6ef3c42 (patch) | |
| tree | 3213225f5a26ce0014735536b9ff575f2f87e96f /packages/meshbay-hub/src/meshbay_hub/static/video-app.js | |
| parent | 19c1e280cbbfc83f0c2cbadadc8e0fb692d8dd70 (diff) | |
| download | meshbay-694a3832f4b57d007b79b3b21dd47b55e6ef3c42.tar.gz | |
feat(hub): keep a show's detail modal open under the player
Closing the player lands back on the season being watched, with the
episode just started marked. A film's modal still closes on Play.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/video-app.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/video-app.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/video-app.js b/packages/meshbay-hub/src/meshbay_hub/static/video-app.js index 4c9f90c..9e2db1c 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/video-app.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/video-app.js @@ -619,6 +619,13 @@ function VideoDetailModal({ const [selectedSeason, setSelectedSeason] = useState(null); useEffect(() => { setSelectedSeason(defaultSeason(show)); }, [show]); + // A show's modal stays open under the player (PosterGrid's onPlay), so + // closing the player lands back here. Marking the episode just started is + // what makes "the next one" the row under the mark, rather than a row the + // reader has to find again by its number. + const [lastPlayedId, setLastPlayedId] = useState(null); + useEffect(() => { setLastPlayedId(null); }, [show]); + const showMultiSeason = Boolean(show && show.seasons.length > 1); const seasonMeta = useSeasonMeta( transportRef, confident ? meta.tmdb_id : null, selectedSeason, @@ -708,7 +715,10 @@ function VideoDetailModal({ </div> `} ${s.episodes.map((ep) => html` - <button class="video-episode-row" key=${ep.id} onClick=${() => onPlay(ep)}> + <button key=${ep.id} + class="video-episode-row ${ep.id === lastPlayedId ? 'last-played' : ''}" + aria-current=${ep.id === lastPlayedId ? 'true' : undefined} + onClick=${() => { setLastPlayedId(ep.id); onPlay(ep); }}> <${LazyTile} cls="video-episode-thumb-slot"> <${MediaThumb} thumbHash=${ep.thumb_hash} alt=${ep.display_title || ep.name} cls="video-episode-thumb" transportRef=${ep._tRef || transportRef} gekRef=${ep._gRef || gekRef} @@ -857,13 +867,18 @@ function PosterGrid({ </${LazyTile}> `; })} </div> + ${/* A show's modal is left open under the player: watching episode after + episode used to mean reopening the show and picking the season again + every time. A film has nothing left to pick, so its modal still + closes. The player stacks above it by its own z-index (style.css, + .video-player-overlay), not by DOM order. */''} ${detail && html` <${VideoDetailModal} title=${detail.title} meta=${detailMeta} repEntry=${detail.repEntry} show=${detail.show} transportRef=${detailTRef} gekRef=${detailGRef} isNodeAdmin=${isNodeAdmin} tmdbEnabled=${tmdbEnabled} onClose=${() => setDetail(null)} - onPlay=${(entry) => { setDetail(null); onPreview(entry); }} /> + onPlay=${(entry) => { if (!detail.show) setDetail(null); onPreview(entry); }} /> `} `; } |