1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-22 14:57:40 +01:00
smov/src/components/video/controls/ShowControl.tsx

27 lines
618 B
TypeScript
Raw Normal View History

import { useEffect } from "react";
import { useVideoPlayerState } from "../VideoContext";
interface ShowControlProps {
series?: {
episode: number;
season: number;
};
title?: string;
}
export function ShowControl(props: ShowControlProps) {
const { videoState } = useVideoPlayerState();
useEffect(() => {
videoState.setShowData({
current: props.series,
isSeries: !!props.series,
title: props.title,
});
// we only want it to run when props change, not when videoState changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props]);
return null;
}