Skip to content

Commit

Permalink
remove hasPlot state from ProfileContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Dec 23, 2024
1 parent 16e7ec9 commit 2a65c7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/view-plants/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ const growingSeasonOptions: DropdownOption<SeasonEnum>[] = [

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<boolean>(false);
const [plants, setPlants] = useState<Plant[]>([]);
Expand Down
4 changes: 0 additions & 4 deletions utils/ProfileProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>; // Now expects full Profile
loadProfile: () => Promise<void>;
Expand All @@ -43,7 +42,6 @@ export default function ProfileProvider({ children }: ProfileProviderProps) {
const { userId, loading: authLoading } = useAuth();
const [profileData, setProfileData] = useState<Profile | null>(null);
const [profileReady, setProfileReady] = useState<boolean>(false);
const [hasPlot, setHasPlot] = useState<boolean | null>(null);
const [plantsToAdd, setPlantsToAdd] = useState<Plant[]>([]);

const loadProfile = useCallback(async () => {
Expand Down Expand Up @@ -84,7 +82,6 @@ export default function ProfileProvider({ children }: ProfileProviderProps) {
() => ({
profileData,
profileReady,
hasPlot,
plantsToAdd,
setPlantsToAdd,
setProfile,
Expand All @@ -93,7 +90,6 @@ export default function ProfileProvider({ children }: ProfileProviderProps) {
[
profileData,
profileReady,
hasPlot,
plantsToAdd,
setPlantsToAdd,
setProfile,
Expand Down

0 comments on commit 2a65c7e

Please sign in to comment.