2023-01-24 02:39:56 +01:00
|
|
|
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) {
|
2023-01-24 14:38:37 +01:00
|
|
|
const { isSeries, humanizedEpisodeId } = useCurrentSeriesEpisodeInfo();
|
2023-01-24 02:39:56 +01:00
|
|
|
|
|
|
|
if (!props.media) return null;
|
|
|
|
|
|
|
|
const title = isSeries
|
2023-01-24 14:38:37 +01:00
|
|
|
? `${props.media.title} - ${humanizedEpisodeId}`
|
2023-01-24 02:39:56 +01:00
|
|
|
: props.media.title;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Helmet>
|
|
|
|
<title>{title}</title>
|
|
|
|
</Helmet>
|
|
|
|
);
|
|
|
|
}
|