diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 4d96b752..61b7e88b 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -128,15 +128,11 @@ }, "morning": { "default": "What would you like to watch this morning?", - "extra": [ - "I hear Before Sunrise is good" - ] + "extra": ["I hear Before Sunrise is good"] }, "night": { "default": "What would you like to watch tonight?", - "extra": [ - "Tired? I hear The Exorcist is good." - ] + "extra": ["Tired? I hear The Exorcist is good."] } } }, @@ -243,7 +239,7 @@ "menus": { "downloads": { "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", "downloadVideo": "Download video", "hlsDisclaimer": "Downloads are taken directly from the provider. movie-web does not have control over how the downloads are provided.

Please note that you are downloading an HLS playlist, it is not recommended to download if you are not familiar with advanced streaming formats. Try different sources for different formats.", diff --git a/src/components/buttons/Button.tsx b/src/components/buttons/Button.tsx index 70e2c780..1c1a2b61 100644 --- a/src/components/buttons/Button.tsx +++ b/src/components/buttons/Button.tsx @@ -7,7 +7,9 @@ import { Spinner } from "@/components/layout/Spinner"; interface Props { icon?: Icons; - onClick?: () => void; + onClick?: ( + event: React.MouseEvent, + ) => void; children?: ReactNode; theme?: "white" | "purple" | "secondary" | "danger"; padding?: string; @@ -21,11 +23,19 @@ interface Props { export function Button(props: Props) { const navigate = useNavigate(); const { onClick, href, loading } = props; - const cb = useCallback(() => { - if (loading) return; - if (href) navigate(href); - else onClick?.(); - }, [onClick, href, navigate, loading]); + const cb = useCallback( + ( + event: React.MouseEvent< + HTMLAnchorElement | HTMLButtonElement, + MouseEvent + >, + ) => { + if (loading) return; + if (href && !onClick) navigate(href); + else onClick?.(event); + }, + [onClick, href, navigate, loading], + ); let colorClasses = "bg-white hover:bg-gray-200 text-black"; if (props.theme === "purple") @@ -80,6 +90,7 @@ export function Button(props: Props) { target="_blank" rel="noreferrer" download={props.download} + onClick={cb} > {content} diff --git a/src/components/player/atoms/settings/Downloads.tsx b/src/components/player/atoms/settings/Downloads.tsx index 45c97997..4ab7a232 100644 --- a/src/components/player/atoms/settings/Downloads.tsx +++ b/src/components/player/atoms/settings/Downloads.tsx @@ -1,5 +1,6 @@ import { useCallback, useMemo } from "react"; import { Trans, useTranslation } from "react-i18next"; +import { useCopyToClipboard } from "react-use"; import { Button } from "@/components/buttons/Button"; import { Icon, Icons } from "@/components/Icon"; @@ -43,6 +44,7 @@ export function DownloadView({ id }: { id: string }) { const router = useOverlayRouter(id); const { t } = useTranslation(); const downloadUrl = useDownloadLink(); + const [, copyToClipboard] = useCopyToClipboard(); const sourceType = usePlayerStore((s) => s.source?.type); const selectedCaption = usePlayerStore((s) => s.caption?.selected); @@ -69,7 +71,17 @@ export function DownloadView({ id }: { id: string }) { -