mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-15 03:15:10 +01:00
24 lines
590 B
TypeScript
24 lines
590 B
TypeScript
|
import { MWMediaMeta } from "@/backend/metadata/types";
|
||
|
import { Helmet } from "react-helmet";
|
||
|
import { useCurrentSeriesEpisodeInfo } from "../hooks/useCurrentSeriesEpisodeInfo";
|
||
|
|
||
|
interface PageTitleControlProps {
|
||
|
media?: MWMediaMeta;
|
||
|
}
|
||
|
|
||
|
export function PageTitleControl(props: PageTitleControlProps) {
|
||
|
const { isSeries, episodeIdentifier } = useCurrentSeriesEpisodeInfo();
|
||
|
|
||
|
if (!props.media) return null;
|
||
|
|
||
|
const title = isSeries
|
||
|
? `${props.media.title} - ${episodeIdentifier}`
|
||
|
: props.media.title;
|
||
|
|
||
|
return (
|
||
|
<Helmet>
|
||
|
<title>{title}</title>
|
||
|
</Helmet>
|
||
|
);
|
||
|
}
|