- updated state for tracking sessions

- removed un used state in sighting feed

- added groupings depending on sightings
This commit is contained in:
2025-10-08 15:46:54 +01:00
parent 4e2d3c47c0
commit 17a4a6de8d
7 changed files with 82 additions and 24 deletions

View File

@@ -1,13 +1,13 @@
import { createContext, useContext, type SetStateAction } from "react";
import type { NPEDUser, SightingType } from "../types/types";
import type { NPEDUser, ReducedSightingType } from "../types/types";
type UserContextValue = {
user: NPEDUser | null;
setUser: React.Dispatch<SetStateAction<NPEDUser | null>>;
sessionStarted: boolean;
setSessionStarted: React.Dispatch<SetStateAction<boolean>>;
sessionList: SightingType[];
setSessionList: React.Dispatch<SetStateAction<SightingType[]>>;
sessionList: ReducedSightingType[];
setSessionList: React.Dispatch<SetStateAction<ReducedSightingType[]>>;
};
export const NPEDUserContext = createContext<UserContextValue | undefined>(

View File

@@ -1,5 +1,5 @@
import { useState, type ReactNode } from "react";
import type { NPEDUser, SightingType } from "../../types/types";
import type { NPEDUser, ReducedSightingType } from "../../types/types";
import { NPEDUserContext } from "../NPEDUserContext";
type NPEDUserProviderType = {
@@ -9,7 +9,7 @@ type NPEDUserProviderType = {
export const NPEDUserProvider = ({ children }: NPEDUserProviderType) => {
const [user, setUser] = useState<NPEDUser | null>(null);
const [sessionStarted, setSessionStarted] = useState(false);
const [sessionList, setSessionList] = useState<SightingType[]>([]);
const [sessionList, setSessionList] = useState<ReducedSightingType[]>([]);
return (
<NPEDUserContext.Provider