From 0ce757f1f43ecf1cda8817e9d3d6d95b2b26217f Mon Sep 17 00:00:00 2001 From: TPN Date: Fri, 5 Jul 2024 11:19:59 +0000 Subject: [PATCH] Better button for opensubtitles --- src/components/player/atoms/Settings.tsx | 11 +++++++ .../atoms/settings/CaptionSettingsView.tsx | 14 +++++++-- .../player/atoms/settings/CaptionsView.tsx | 30 +++++++++---------- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/components/player/atoms/Settings.tsx b/src/components/player/atoms/Settings.tsx index a4059f1e..b7cc8456 100644 --- a/src/components/player/atoms/Settings.tsx +++ b/src/components/player/atoms/Settings.tsx @@ -90,6 +90,17 @@ function SettingsOverlay({ id }: { id: string }) { + {/* This is used by the captions shortcut in bottomControls of player */} + + + + + diff --git a/src/components/player/atoms/settings/CaptionSettingsView.tsx b/src/components/player/atoms/settings/CaptionSettingsView.tsx index 2f942a48..884233a9 100644 --- a/src/components/player/atoms/settings/CaptionSettingsView.tsx +++ b/src/components/player/atoms/settings/CaptionSettingsView.tsx @@ -216,7 +216,13 @@ export function CaptionSetting(props: { export const colors = ["#ffffff", "#b0b0b0", "#80b1fa", "#e2e535"]; -export function CaptionSettingsView({ id }: { id: string }) { +export function CaptionSettingsView({ + id, + overlayBackLink, +}: { + id: string; + overlayBackLink?: boolean; +}) { const { t } = useTranslation(); const router = useOverlayRouter(id); const styling = useSubtitleStore((s) => s.styling); @@ -228,7 +234,11 @@ export function CaptionSettingsView({ id }: { id: string }) { return ( <> - router.navigate("/captions")}> + + router.navigate(overlayBackLink ? "/captionsOverlay" : "/captions") + } + > {t("player.menus.subtitles.settings.backlink")} diff --git a/src/components/player/atoms/settings/CaptionsView.tsx b/src/components/player/atoms/settings/CaptionsView.tsx index fd8b3ce8..a72a41df 100644 --- a/src/components/player/atoms/settings/CaptionsView.tsx +++ b/src/components/player/atoms/settings/CaptionsView.tsx @@ -239,7 +239,7 @@ export function CaptionsView({ rightSide={ + + router.navigate( + backLink + ? "/captions/opensubtitles" + : "/captions/opensubtitlesOverlay", + ) + } + selected={useSubtitleStore((s) => s.isOpenSubtitles)} + chevron + > + {t("player.menus.subtitles.OpenSubtitlesChoice")} + {content.length === 0 ? (