From 2a65c7e0481bd4ac95992ae9a424ebccaf2afef3 Mon Sep 17 00:00:00 2001 From: Catherine Tan Date: Mon, 23 Dec 2024 00:50:44 -0800 Subject: [PATCH] remove hasPlot state from ProfileContext --- app/view-plants/page.tsx | 4 ++-- utils/ProfileProvider.tsx | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/view-plants/page.tsx b/app/view-plants/page.tsx index e5ef13f1..1562d292 100644 --- a/app/view-plants/page.tsx +++ b/app/view-plants/page.tsx @@ -65,11 +65,11 @@ const growingSeasonOptions: DropdownOption[] = [ export default function Page() { const router = useRouter(); - const { hasPlot, profileData, profileReady, setPlantsToAdd } = useProfile(); + const { profileData, profileReady, setPlantsToAdd } = useProfile(); const { userId, loading: authLoading } = useAuth(); const [viewingOption, setViewingOption] = useState<'myPlants' | 'all'>( - hasPlot ? 'myPlants' : 'all', + 'myPlants', ); const [inAddMode, setInAddMode] = useState(false); const [plants, setPlants] = useState([]); diff --git a/utils/ProfileProvider.tsx b/utils/ProfileProvider.tsx index bb91c75e..b7bc22fc 100644 --- a/utils/ProfileProvider.tsx +++ b/utils/ProfileProvider.tsx @@ -19,7 +19,6 @@ import { useAuth } from './AuthProvider'; export interface ProfileContextType { profileData: Profile | null; profileReady: boolean; - hasPlot: boolean | null; plantsToAdd: Plant[]; setProfile: (completeProfile: Profile) => Promise; // Now expects full Profile loadProfile: () => Promise; @@ -43,7 +42,6 @@ export default function ProfileProvider({ children }: ProfileProviderProps) { const { userId, loading: authLoading } = useAuth(); const [profileData, setProfileData] = useState(null); const [profileReady, setProfileReady] = useState(false); - const [hasPlot, setHasPlot] = useState(null); const [plantsToAdd, setPlantsToAdd] = useState([]); const loadProfile = useCallback(async () => { @@ -84,7 +82,6 @@ export default function ProfileProvider({ children }: ProfileProviderProps) { () => ({ profileData, profileReady, - hasPlot, plantsToAdd, setPlantsToAdd, setProfile, @@ -93,7 +90,6 @@ export default function ProfileProvider({ children }: ProfileProviderProps) { [ profileData, profileReady, - hasPlot, plantsToAdd, setPlantsToAdd, setProfile,