import { createContext, useContext } from "react"; import { type Sub } from "./plexSubUrl"; // The read + publish sides of the Plex view bridge (see PlexViewBridge for why it is a bridge), split // out of that file so it exports only components (Fast Refresh). export type PlexViewControls = { kind: Sub["kind"]; // the current top-level plex view — the header controls derive their state from it open: (v: Sub) => void; }; export const PlexViewReadContext = createContext(null); export const PlexViewPublishContext = createContext<(c: PlexViewControls | null) => void>(() => {}); export const usePlexViewControls = () => useContext(PlexViewReadContext); export const usePublishPlexView = () => useContext(PlexViewPublishContext);