- updated state for tracking sessions
- removed un used state in sighting feed - added groupings depending on sightings
This commit is contained in:
@@ -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>(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user