got to a good point with sighting modal, want to do cleanup

This commit is contained in:
2025-09-16 11:07:35 +01:00
parent c414342515
commit c506c395e6
25 changed files with 490 additions and 141 deletions

View File

@@ -0,0 +1,30 @@
import { createContext, useContext } from "react";
import type { SightingType, 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;
selectedSighting: SightingType | null;
setSelectedSighting: (
sighting: SightingType | SightingWidgetType | null
) => void;
setSightingModalOpen: (isSightingModalOpen: boolean) => void;
isSightingModalOpen: 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;
};