front: Add mediainfo button in movie page header

This commit is contained in:
Arthur Jamet 2024-01-21 13:31:11 +01:00 committed by Zoe Roux
parent 0955da489c
commit 37acfa1eec
2 changed files with 20 additions and 2 deletions

View File

@ -50,7 +50,7 @@ export const EpisodesContext = ({
const downloader = useDownloader(); const downloader = useDownloader();
const { css } = useYoshiki(); const { css } = useYoshiki();
const { t } = useTranslation(); const { t } = useTranslation();
const [popup, setPopup] = useState<ReactElement | undefined>(); const [popup, setPopup] = useState<ReactElement | undefined>(undefined);
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const mutation = useMutation({ const mutation = useMutation({

View File

@ -49,8 +49,9 @@ import {
DottedSeparator, DottedSeparator,
focusReset, focusReset,
} from "@kyoo/primitives"; } from "@kyoo/primitives";
import { Fragment } from "react"; import { Fragment, ReactElement, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import Info from "@material-symbols/svg-400/rounded/info.svg";
import { ImageStyle, Platform, View } from "react-native"; import { ImageStyle, Platform, View } from "react-native";
import { import {
Theme, Theme,
@ -76,6 +77,7 @@ import { capitalize } from "@kyoo/primitives";
import { ShowWatchStatusCard } from "./show"; import { ShowWatchStatusCard } from "./show";
import Download from "@material-symbols/svg-400/rounded/download.svg"; import Download from "@material-symbols/svg-400/rounded/download.svg";
import { useDownloader } from "../downloads"; import { useDownloader } from "../downloads";
import { MediaInfoPopup } from "../components/media-info";
export const TitleLine = ({ export const TitleLine = ({
isLoading, isLoading,
@ -110,6 +112,7 @@ export const TitleLine = ({
const { css, theme } = useYoshiki(); const { css, theme } = useYoshiki();
const { t } = useTranslation(); const { t } = useTranslation();
const downloader = useDownloader(); const downloader = useDownloader();
const [popup, setPopup] = useState<ReactElement | undefined>(undefined);
return ( return (
<Container <Container
@ -250,6 +253,21 @@ export const TitleLine = ({
{...tooltip(t("home.episodeMore.download"))} {...tooltip(t("home.episodeMore.download"))}
/> />
)} )}
{type === "movie" && (
<IconButton
icon={Info}
onPress={() =>
slug && setPopup(
<MediaInfoPopup
mediaType={type}
mediaSlug={slug}
close={() => setPopup(undefined)}
/>,
)
}
/>
)}
{popup}
{rating !== null && ( {rating !== null && (
<> <>
<DottedSeparator <DottedSeparator