Merge branch 'dev' into mediasession

This commit is contained in:
chaos 2024-02-09 15:52:31 +00:00 committed by GitHub
commit b129181b6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 48 additions and 19 deletions

View File

@ -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.",

View File

@ -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>

View File

@ -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

View File

@ -104,7 +104,7 @@ function ThemePreview(props: {
<span className="font-medium text-white">{props.name}</span> <span className="font-medium text-white">{props.name}</span>
<span <span
className={classNames( className={classNames(
"inline-block px-3 text-sm transition-opacity duration-150 rounded-full bg-[#27182F] text-white", "inline-block px-3 py-1 leading-tight text-sm transition-opacity duration-150 rounded-full bg-pill-activeBackground text-white/85",
props.active ? "opacity-100" : "opacity-0 pointer-events-none", props.active ? "opacity-100" : "opacity-0 pointer-events-none",
)} )}
> >

View File

@ -97,6 +97,8 @@ export const defaultTheme = {
background: tokens.shade.c300, background: tokens.shade.c300,
backgroundHover: tokens.shade.c200, backgroundHover: tokens.shade.c200,
highlight: tokens.blue.c200, highlight: tokens.blue.c200,
activeBackground: tokens.shade.c300,
}, },
// meta data for the theme itself // meta data for the theme itself

View File

@ -63,7 +63,9 @@ export default createTheme({
pill: { pill: {
background: tokens.shade.c300, background: tokens.shade.c300,
backgroundHover: tokens.shade.c200, backgroundHover: tokens.shade.c200,
highlight: tokens.blue.c200 highlight: tokens.blue.c200,
activeBackground: tokens.shade.c300,
}, },
global: { global: {

View File

@ -63,7 +63,9 @@ export default createTheme({
pill: { pill: {
background: tokens.shade.c300, background: tokens.shade.c300,
backgroundHover: tokens.shade.c200, backgroundHover: tokens.shade.c200,
highlight: tokens.blue.c200 highlight: tokens.blue.c200,
activeBackground: tokens.shade.c300,
}, },
global: { global: {

View File

@ -63,7 +63,9 @@ export default createTheme({
pill: { pill: {
background: tokens.shade.c300, background: tokens.shade.c300,
backgroundHover: tokens.shade.c200, backgroundHover: tokens.shade.c200,
highlight: tokens.blue.c200 highlight: tokens.blue.c200,
activeBackground: tokens.shade.c300,
}, },
global: { global: {

View File

@ -63,7 +63,9 @@ export default createTheme({
pill: { pill: {
background: tokens.shade.c300, background: tokens.shade.c300,
backgroundHover: tokens.shade.c200, backgroundHover: tokens.shade.c200,
highlight: tokens.blue.c200 highlight: tokens.blue.c200,
activeBackground: tokens.shade.c300,
}, },
global: { global: {