Files
Mav-Mobile-UI/src/context/SightingFeedContext.tsx

27 lines
756 B
TypeScript
Raw Normal View History

2025-08-29 10:07:59 +01:00
import { createContext, useContext } from "react";
2025-08-20 08:27:05 +01:00
import type { SightingWidgetType } from "../types/types";
type SightingFeedContextType = {
2025-08-22 10:38:28 +01:00
sightings: (SightingWidgetType | null | undefined)[];
2025-08-20 08:27:05 +01:00
selectedRef: number | null;
setSelectedRef: (ref: number | null) => void;
effectiveSelected: SightingWidgetType | null;
2025-08-22 10:38:28 +01:00
mostRecent: SightingWidgetType | null;
side: string;
isPending: boolean;
noSighting: boolean;
2025-08-20 08:27:05 +01:00
};
2025-08-29 10:07:59 +01:00
export const SightingFeedContext = createContext<
SightingFeedContextType | undefined
>(undefined);
2025-08-20 08:27:05 +01:00
export const useSightingFeedContext = () => {
const ctx = useContext(SightingFeedContext);
if (!ctx)
throw new Error(
"useSightingFeedContext must be used within SightingFeedProvider"
);
return ctx;
};