File size: 636 Bytes
f56a29b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import { createContext, useContext } from 'react';
/**
* Provides the current stageId to media-aware components (BaseImageElement, BaseVideoElement).
*
* When set, these components subscribe to the media generation store and only use
* tasks whose stageId matches (preventing cross-course contamination).
* When undefined (e.g. homepage thumbnails), store subscription is skipped entirely.
*/
const MediaStageContext = createContext<string | undefined>(undefined);
export const MediaStageProvider = MediaStageContext.Provider;
export function useMediaStageId(): string | undefined {
return useContext(MediaStageContext);
}
|