1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Better button for opensubtitles

This commit is contained in:
TPN 2024-07-05 11:19:59 +00:00
parent b378f0533a
commit 0ce757f1f4
3 changed files with 38 additions and 17 deletions

View file

@ -90,6 +90,17 @@ function SettingsOverlay({ id }: { id: string }) {
<CaptionSettingsView id={id} /> <CaptionSettingsView id={id} />
</Menu.Card> </Menu.Card>
</OverlayPage> </OverlayPage>
{/* This is used by the captions shortcut in bottomControls of player */}
<OverlayPage
id={id}
path="/captions/settingsOverlay"
width={343}
height={450}
>
<Menu.Card>
<CaptionSettingsView id={id} overlayBackLink />
</Menu.Card>
</OverlayPage>
<OverlayPage id={id} path="/source" width={343} height={431}> <OverlayPage id={id} path="/source" width={343} height={431}>
<Menu.CardWithScrollable> <Menu.CardWithScrollable>
<SourceSelectionView id={id} onChoose={setChosenSourceId} /> <SourceSelectionView id={id} onChoose={setChosenSourceId} />

View file

@ -216,7 +216,13 @@ export function CaptionSetting(props: {
export const colors = ["#ffffff", "#b0b0b0", "#80b1fa", "#e2e535"]; 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 { t } = useTranslation();
const router = useOverlayRouter(id); const router = useOverlayRouter(id);
const styling = useSubtitleStore((s) => s.styling); const styling = useSubtitleStore((s) => s.styling);
@ -228,7 +234,11 @@ export function CaptionSettingsView({ id }: { id: string }) {
return ( return (
<> <>
<Menu.BackLink onClick={() => router.navigate("/captions")}> <Menu.BackLink
onClick={() =>
router.navigate(overlayBackLink ? "/captionsOverlay" : "/captions")
}
>
{t("player.menus.subtitles.settings.backlink")} {t("player.menus.subtitles.settings.backlink")}
</Menu.BackLink> </Menu.BackLink>
<Menu.Section className="space-y-6 pb-5"> <Menu.Section className="space-y-6 pb-5">

View file

@ -239,7 +239,7 @@ export function CaptionsView({
rightSide={ rightSide={
<button <button
type="button" type="button"
onClick={() => router.navigate("/captions/settings")} onClick={() => router.navigate("/captions/settingsOverlay")}
className="-mr-2 -my-1 px-2 p-[0.4em] rounded tabbable hover:bg-video-context-light hover:bg-opacity-10" 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.customizeLabel")}
@ -257,21 +257,8 @@ export function CaptionsView({
}} }}
onDrop={(event) => onDrop(event)} onDrop={(event) => onDrop(event)}
> >
<div className="mt-3 flex flex-row gap-2"> <div className="mt-3">
<Input value={searchQuery} onInput={setSearchQuery} /> <Input value={searchQuery} onInput={setSearchQuery} />
<button
type="button"
onClick={() =>
router.navigate(
backLink
? "/captions/opensubtitles"
: "/captions/opensubtitlesOverlay",
)
}
className="p-[0.5em] rounded tabbable hover:bg-video-context-hoverColor hover:bg-opacity-50"
>
<Icon icon={Icons.WEB} />
</button>
</div> </div>
<Menu.ScrollToActiveSection className="!pt-1 mt-2 pb-3"> <Menu.ScrollToActiveSection className="!pt-1 mt-2 pb-3">
<CaptionOption <CaptionOption
@ -281,6 +268,19 @@ export function CaptionsView({
{t("player.menus.subtitles.offChoice")} {t("player.menus.subtitles.offChoice")}
</CaptionOption> </CaptionOption>
<CustomCaptionOption /> <CustomCaptionOption />
<CaptionOption
onClick={() =>
router.navigate(
backLink
? "/captions/opensubtitles"
: "/captions/opensubtitlesOverlay",
)
}
selected={useSubtitleStore((s) => s.isOpenSubtitles)}
chevron
>
{t("player.menus.subtitles.OpenSubtitlesChoice")}
</CaptionOption>
{content.length === 0 ? ( {content.length === 0 ? (
<div className="p-4 rounded-xl bg-video-context-light bg-opacity-10 font-medium text-center"> <div className="p-4 rounded-xl bg-video-context-light bg-opacity-10 font-medium text-center">
<div className="flex flex-col items-center justify-center gap-3"> <div className="flex flex-col items-center justify-center gap-3">