mirror of
https://github.com/sussy-code/smov.git
synced 2026-04-18 23:22:06 +00:00
This commit updates the import statements in the codebase to comply with ESLint rules for import ordering. All imports have been sorted alphabetically and grouped according to the specified import groups in the ESLint configuration. This improves the codebase's consistency and maintainability.
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import { useEffect } from "react";
|
|
|
|
import { MWCaption } from "@/backend/helpers/streams";
|
|
import { DetailedMeta } from "@/backend/metadata/getmeta";
|
|
import { useVideoPlayerDescriptor } from "@/video/state/hooks";
|
|
import { useMeta } from "@/video/state/logic/meta";
|
|
import { useProgress } from "@/video/state/logic/progress";
|
|
|
|
export type WindowMeta = {
|
|
meta: DetailedMeta;
|
|
captions: MWCaption[];
|
|
episode?: {
|
|
episodeId: string;
|
|
seasonId: string;
|
|
};
|
|
seasons?: {
|
|
id: string;
|
|
number: number;
|
|
title: string;
|
|
episodes?: { id: string; number: number; title: string }[];
|
|
}[];
|
|
progress: {
|
|
time: number;
|
|
duration: number;
|
|
};
|
|
} | null;
|
|
|
|
declare global {
|
|
interface Window {
|
|
meta?: Record<string, WindowMeta>;
|
|
}
|
|
}
|
|
|
|
export function MetaAction() {
|
|
const descriptor = useVideoPlayerDescriptor();
|
|
const meta = useMeta(descriptor);
|
|
const progress = useProgress(descriptor);
|
|
|
|
useEffect(() => {
|
|
if (!window.meta) window.meta = {};
|
|
if (meta) {
|
|
window.meta[descriptor] = {
|
|
meta: meta.meta,
|
|
captions: meta.captions,
|
|
seasons: meta.seasons,
|
|
episode: meta.episode,
|
|
progress: {
|
|
time: progress.time,
|
|
duration: progress.duration,
|
|
},
|
|
};
|
|
}
|
|
|
|
return () => {
|
|
if (window.meta) delete window.meta[descriptor];
|
|
};
|
|
}, [meta, descriptor, progress]);
|
|
|
|
return null;
|
|
}
|