From 6ca1f63877e0ec3f9285e1864c38754b6d1a7540 Mon Sep 17 00:00:00 2001 From: Uruk Date: Fri, 22 May 2026 02:22:03 +0200 Subject: [PATCH] feat(casting): hide episode buttons when no adjacent episode --- .../player/CastPlayerEpisodeControls.tsx | 91 +++++++++---------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/components/casting/player/CastPlayerEpisodeControls.tsx b/components/casting/player/CastPlayerEpisodeControls.tsx index 3ddebbc66..69e1b08ae 100644 --- a/components/casting/player/CastPlayerEpisodeControls.tsx +++ b/components/casting/player/CastPlayerEpisodeControls.tsx @@ -68,53 +68,52 @@ export function CastPlayerEpisodeControls({ - {/* Previous episode button */} - { - const currentIndex = episodes.findIndex( - (ep) => ep.Id === currentItemId, - ); - if (currentIndex > 0) { - await loadEpisode(episodes[currentIndex - 1]); - } - }} - disabled={episodes.findIndex((ep) => ep.Id === currentItemId) <= 0} - style={{ - flex: 1, - backgroundColor: "#1a1a1a", - padding: 12, - borderRadius: 12, - flexDirection: "row", - justifyContent: "center", - alignItems: "center", - opacity: - episodes.findIndex((ep) => ep.Id === currentItemId) <= 0 ? 0.4 : 1, - }} - > - - + {/* Previous episode button - only rendered when a previous episode exists */} + {episodes.findIndex((ep) => ep.Id === currentItemId) > 0 && ( + { + const currentIndex = episodes.findIndex( + (ep) => ep.Id === currentItemId, + ); + if (currentIndex > 0) { + await loadEpisode(episodes[currentIndex - 1]); + } + }} + style={{ + flex: 1, + backgroundColor: "#1a1a1a", + padding: 12, + borderRadius: 12, + flexDirection: "row", + justifyContent: "center", + alignItems: "center", + }} + > + + + )} - {/* Next episode button */} - { - if (nextEpisode) { - await loadEpisode(nextEpisode); - } - }} - disabled={!nextEpisode} - style={{ - flex: 1, - backgroundColor: "#1a1a1a", - padding: 12, - borderRadius: 12, - flexDirection: "row", - justifyContent: "center", - alignItems: "center", - opacity: nextEpisode ? 1 : 0.4, - }} - > - - + {/* Next episode button - only rendered when a next episode exists */} + {nextEpisode && ( + { + if (nextEpisode) { + await loadEpisode(nextEpisode); + } + }} + style={{ + flex: 1, + backgroundColor: "#1a1a1a", + padding: 12, + borderRadius: 12, + flexDirection: "row", + justifyContent: "center", + alignItems: "center", + }} + > + + + )} {/* Stop playback button - stops media but stays connected to Chromecast */}