mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-22 14:57:40 +01:00
27 lines
618 B
TypeScript
27 lines
618 B
TypeScript
|
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;
|
||
|
}
|