marmar-context / web / context / src / clinician / shell / context.ts
context.ts
Raw
import { createContext, useContext } from "react";
import type { UrgentAlert } from "../../api/types";

/** The shell's polled urgent notes, for pages inside it. */
export const AlertsContext = createContext<UrgentAlert[]>([]);
export const useShellAlerts = () => useContext(AlertsContext);

export const SEARCH_EVENT = "context-open-search";
/** Open the shell's search, as ⌘K does. */
export const openSearch = () => window.dispatchEvent(new Event(SEARCH_EVENT));