diff --git a/src/components/player/atoms/Captions.tsx b/src/components/player/atoms/Captions.tsx new file mode 100644 index 00000000..89e419e0 --- /dev/null +++ b/src/components/player/atoms/Captions.tsx @@ -0,0 +1,28 @@ +import { useEffect } from "react"; + +import { Icons } from "@/components/Icon"; +import { OverlayAnchor } from "@/components/overlays/OverlayAnchor"; +import { VideoPlayerButton } from "@/components/player/internals/Button"; +import { useOverlayRouter } from "@/hooks/useOverlayRouter"; +import { usePlayerStore } from "@/stores/player/store"; + +export function Captions() { + const router = useOverlayRouter("settings"); + const setHasOpenOverlay = usePlayerStore((s) => s.setHasOpenOverlay); + + useEffect(() => { + setHasOpenOverlay(router.isRouterActive); + }, [setHasOpenOverlay, router.isRouterActive]); + + return ( + + { + router.open(); + router.navigate("/captionsOverlay"); + }} + icon={Icons.CAPTIONS} + /> + + ); +} diff --git a/src/components/player/atoms/Settings.tsx b/src/components/player/atoms/Settings.tsx index b3eb2a59..a4059f1e 100644 --- a/src/components/player/atoms/Settings.tsx +++ b/src/components/player/atoms/Settings.tsx @@ -54,6 +54,12 @@ function SettingsOverlay({ id }: { id: string }) { + + + + + {/* This is used by the captions shortcut in bottomControls of player */} + @@ -68,6 +74,17 @@ function SettingsOverlay({ id }: { id: string }) { + {/* This is used by the captions shortcut in bottomControls of player */} + + + + + diff --git a/src/components/player/atoms/index.ts b/src/components/player/atoms/index.ts index 3caf8154..6be88fd6 100644 --- a/src/components/player/atoms/index.ts +++ b/src/components/player/atoms/index.ts @@ -16,3 +16,4 @@ export * from "./VolumeChangedPopout"; export * from "./NextEpisodeButton"; export * from "./Chromecast"; export * from "./CastingNotification"; +export * from "./Captions"; diff --git a/src/components/player/atoms/settings/CaptionsView.tsx b/src/components/player/atoms/settings/CaptionsView.tsx index 709ad067..fd8b3ce8 100644 --- a/src/components/player/atoms/settings/CaptionsView.tsx +++ b/src/components/player/atoms/settings/CaptionsView.tsx @@ -120,7 +120,13 @@ function useSubtitleList(subs: CaptionListItem[], searchQuery: string) { }, [subs, searchQuery, unknownChoice]); } -export function CaptionsView({ id }: { id: string }) { +export function CaptionsView({ + id, + backLink, +}: { + id: string; + backLink?: true; +}) { const { t } = useTranslation(); const router = useOverlayRouter(id); const selectedCaptionId = usePlayerStore((s) => s.caption.selected?.id); @@ -213,20 +219,36 @@ export function CaptionsView({ id }: { id: string }) { - router.navigate("/")} - rightSide={ - - } - > - {t("player.menus.subtitles.title")} - + {backLink ? ( + router.navigate("/")} + rightSide={ + + } + > + {t("player.menus.subtitles.title")} + + ) : ( + router.navigate("/captions/settings")} + className="-mr-2 -my-1 px-2 p-[0.4em] rounded tabbable hover:bg-video-context-light hover:bg-opacity-10" + > + {t("player.menus.subtitles.customizeLabel")} + + } + > + {t("player.menus.subtitles.title")} + + )}