code fixes and adding modal

This commit is contained in:
2025-09-12 08:21:52 +01:00
parent fae17b88a4
commit d03f73f751
24 changed files with 524 additions and 303 deletions

View File

@@ -1,15 +1,17 @@
import { createContext, useContext } from "react";
import type { SightingWidgetType } from "../types/types";
import type { SightingType, SightingWidgetType } from "../types/types";
type SightingFeedContextType = {
sightings: (SightingWidgetType | null | undefined)[];
selectedRef: number | null;
setSelectedRef: (ref: number | null) => void;
effectiveSelected: SightingWidgetType | null;
// effectiveSelected: SightingWidgetType | null;
mostRecent: SightingWidgetType | null;
side: string;
isPending: boolean;
noSighting: boolean;
selectedSighting: SightingType | null;
setSelectedSighting: (sighting: SightingType | null) => void;
setSightingModalOpen: (isSightingModalOpen: boolean) => void;
isSightingModalOpen: boolean;
};
export const SightingFeedContext = createContext<

View File

@@ -1,4 +1,4 @@
import type { ReactNode } from "react";
import { useState, type ReactNode } from "react";
import { useSightingFeed } from "../../hooks/useSightingFeed";
import { SightingFeedContext } from "../SightingFeedContext";
@@ -17,23 +17,25 @@ export const SightingFeedProvider = ({
sightings,
selectedRef,
setSelectedRef,
effectiveSelected,
// effectiveSelected,
setSelectedSighting,
selectedSighting,
mostRecent,
isPending,
noSighting,
} = useSightingFeed(url);
const [isSightingModalOpen, setSightingModalOpen] = useState(false);
return (
<SightingFeedContext.Provider
value={{
sightings,
selectedRef,
setSelectedRef,
effectiveSelected,
setSelectedSighting,
selectedSighting,
setSightingModalOpen,
isSightingModalOpen,
// effectiveSelected,
mostRecent,
side,
isPending,
noSighting,
}}
>
{children}