import { createContext, useContext } from "react"; import type { SightingWidgetType } from "../types/types"; type SightingFeedContextType = { sightings: (SightingWidgetType | null | undefined)[]; selectedRef: number | null; setSelectedRef: (ref: number | null) => void; effectiveSelected: SightingWidgetType | null; mostRecent: SightingWidgetType | null; side: string; isPending: boolean; noSighting: boolean; }; export const SightingFeedContext = createContext< SightingFeedContextType | undefined >(undefined); export const useSightingFeedContext = () => { const ctx = useContext(SightingFeedContext); if (!ctx) throw new Error( "useSightingFeedContext must be used within SightingFeedProvider" ); return ctx; };