mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
commit
c8e7f6a02f
3 changed files with 33 additions and 14 deletions
|
@ -128,15 +128,11 @@
|
||||||
},
|
},
|
||||||
"morning": {
|
"morning": {
|
||||||
"default": "What would you like to watch this morning?",
|
"default": "What would you like to watch this morning?",
|
||||||
"extra": [
|
"extra": ["I hear Before Sunrise is good"]
|
||||||
"I hear Before Sunrise is good"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"night": {
|
"night": {
|
||||||
"default": "What would you like to watch tonight?",
|
"default": "What would you like to watch tonight?",
|
||||||
"extra": [
|
"extra": ["Tired? I hear The Exorcist is good."]
|
||||||
"Tired? I hear The Exorcist is good."
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -243,7 +239,7 @@
|
||||||
"menus": {
|
"menus": {
|
||||||
"downloads": {
|
"downloads": {
|
||||||
"disclaimer": "Downloads are taken directly from the provider. movie-web does not have control over how the downloads are provided.",
|
"disclaimer": "Downloads are taken directly from the provider. movie-web does not have control over how the downloads are provided.",
|
||||||
"downloadPlaylist": "Download playlist",
|
"copyHlsPlaylist": "Copy HLS playlist link",
|
||||||
"downloadSubtitle": "Download current subtitle",
|
"downloadSubtitle": "Download current subtitle",
|
||||||
"downloadVideo": "Download video",
|
"downloadVideo": "Download video",
|
||||||
"hlsDisclaimer": "Downloads are taken directly from the provider. movie-web does not have control over how the downloads are provided.<br /><br />Please note that you are downloading an HLS playlist, <bold>it is not recommended to download if you are not familiar with advanced streaming formats</bold>. Try different sources for different formats.",
|
"hlsDisclaimer": "Downloads are taken directly from the provider. movie-web does not have control over how the downloads are provided.<br /><br />Please note that you are downloading an HLS playlist, <bold>it is not recommended to download if you are not familiar with advanced streaming formats</bold>. Try different sources for different formats.",
|
||||||
|
|
|
@ -7,7 +7,9 @@ import { Spinner } from "@/components/layout/Spinner";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
icon?: Icons;
|
icon?: Icons;
|
||||||
onClick?: () => void;
|
onClick?: (
|
||||||
|
event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement, MouseEvent>,
|
||||||
|
) => void;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
theme?: "white" | "purple" | "secondary" | "danger";
|
theme?: "white" | "purple" | "secondary" | "danger";
|
||||||
padding?: string;
|
padding?: string;
|
||||||
|
@ -21,11 +23,19 @@ interface Props {
|
||||||
export function Button(props: Props) {
|
export function Button(props: Props) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { onClick, href, loading } = props;
|
const { onClick, href, loading } = props;
|
||||||
const cb = useCallback(() => {
|
const cb = useCallback(
|
||||||
|
(
|
||||||
|
event: React.MouseEvent<
|
||||||
|
HTMLAnchorElement | HTMLButtonElement,
|
||||||
|
MouseEvent
|
||||||
|
>,
|
||||||
|
) => {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
if (href) navigate(href);
|
if (href && !onClick) navigate(href);
|
||||||
else onClick?.();
|
else onClick?.(event);
|
||||||
}, [onClick, href, navigate, loading]);
|
},
|
||||||
|
[onClick, href, navigate, loading],
|
||||||
|
);
|
||||||
|
|
||||||
let colorClasses = "bg-white hover:bg-gray-200 text-black";
|
let colorClasses = "bg-white hover:bg-gray-200 text-black";
|
||||||
if (props.theme === "purple")
|
if (props.theme === "purple")
|
||||||
|
@ -80,6 +90,7 @@ export function Button(props: Props) {
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
download={props.download}
|
download={props.download}
|
||||||
|
onClick={cb}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
|
import { useCopyToClipboard } from "react-use";
|
||||||
|
|
||||||
import { Button } from "@/components/buttons/Button";
|
import { Button } from "@/components/buttons/Button";
|
||||||
import { Icon, Icons } from "@/components/Icon";
|
import { Icon, Icons } from "@/components/Icon";
|
||||||
|
@ -43,6 +44,7 @@ export function DownloadView({ id }: { id: string }) {
|
||||||
const router = useOverlayRouter(id);
|
const router = useOverlayRouter(id);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const downloadUrl = useDownloadLink();
|
const downloadUrl = useDownloadLink();
|
||||||
|
const [, copyToClipboard] = useCopyToClipboard();
|
||||||
|
|
||||||
const sourceType = usePlayerStore((s) => s.source?.type);
|
const sourceType = usePlayerStore((s) => s.source?.type);
|
||||||
const selectedCaption = usePlayerStore((s) => s.caption?.selected);
|
const selectedCaption = usePlayerStore((s) => s.caption?.selected);
|
||||||
|
@ -69,7 +71,17 @@ export function DownloadView({ id }: { id: string }) {
|
||||||
<StyleTrans k="player.menus.downloads.hlsDisclaimer" />
|
<StyleTrans k="player.menus.downloads.hlsDisclaimer" />
|
||||||
</Menu.Paragraph>
|
</Menu.Paragraph>
|
||||||
|
|
||||||
<Button className="w-full" href={downloadUrl} theme="purple">
|
<Button
|
||||||
|
className="w-full"
|
||||||
|
theme="purple"
|
||||||
|
href={downloadUrl}
|
||||||
|
onClick={(event) => {
|
||||||
|
// Allow context menu & left click to copy
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
copyToClipboard(downloadUrl);
|
||||||
|
}}
|
||||||
|
>
|
||||||
{t("player.menus.downloads.downloadPlaylist")}
|
{t("player.menus.downloads.downloadPlaylist")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
|
Loading…
Reference in a new issue