diff --git a/App.tsx b/App.tsx index 06d0623..bf69a4b 100644 --- a/App.tsx +++ b/App.tsx @@ -20,6 +20,7 @@ import { useState, useEffect } from "react"; import { QueryClientProvider, QueryClient } from "@tanstack/react-query"; import { StatusBar } from "expo-status-bar"; import UserInfoPage from "./src/routes/UserInfoPage/UserInfoPage"; +import SubjectsPage from "./src/routes/SubjectsPage/SubjectsPage"; const Drawer = createDrawerNavigator(); @@ -71,6 +72,7 @@ export default function App() { + diff --git a/src/components/DrawerSettings/CustomDrawerContent.tsx b/src/components/DrawerSettings/CustomDrawerContent.tsx index 8d3d765..49c1054 100644 --- a/src/components/DrawerSettings/CustomDrawerContent.tsx +++ b/src/components/DrawerSettings/CustomDrawerContent.tsx @@ -78,6 +78,15 @@ export default function CustomDrawerContent(props: {}) { User Info + { + navigation.navigate("Subjects"); + }} + > + + Subjects + { diff --git a/src/routes/SubjectsPage/SubjectsPage.tsx b/src/routes/SubjectsPage/SubjectsPage.tsx index ad760a3..489c44d 100644 --- a/src/routes/SubjectsPage/SubjectsPage.tsx +++ b/src/routes/SubjectsPage/SubjectsPage.tsx @@ -75,7 +75,6 @@ export default function SubjectsPage() { first_name: data[1].first_name, last_name: data[1].last_name, }); - console.log(user.subjects); setSelectedSubjects(user.subjects); }, }); @@ -91,11 +90,11 @@ export default function SubjectsPage() { // Subjects const [selected_subjects, setSelectedSubjects] = useState([]); - const [subjectsOpen, setSubjectsOpen] = useState(true); + const [subjectsOpen, setSubjectsOpen] = useState(false); const [subjects, setSubjects] = useState([]); const Subjects = useQuery({ - enabled: StudentInfo.isFetched && !StudentInfo.isStale, + enabled: StudentInfo.isFetched, queryKey: ["subjects"], queryFn: async () => { let data; @@ -128,14 +127,12 @@ export default function SubjectsPage() { label: subject.name, value: subject.name, })); - // Update the 'subjects' state + setSelectedSubjects(user.subjects); setSubjects(subjectsData); }, }); - // Toggle editing of profile - const [isEditable, setIsEditable] = useState(false); // Profile photo function Avatar() { if (user.avatar) { @@ -172,7 +169,6 @@ export default function SubjectsPage() { { - if (isEditable) { + if (subjectsOpen) { setSelectedSubjects([]); setSubjectsOpen(false); mutation.mutate({ subjects: selected_subjects, }); } - setIsEditable(!isEditable); }} > - {isEditable && StudentInfo.isSuccess ? "Save" : "Edit Subjects"} + {subjectsOpen && StudentInfo.isSuccess ? "Save" : "Edit Subjects"} diff --git a/src/routes/UserInfoPage/UserInfoPage.tsx b/src/routes/UserInfoPage/UserInfoPage.tsx index 10895c5..5f39149 100644 --- a/src/routes/UserInfoPage/UserInfoPage.tsx +++ b/src/routes/UserInfoPage/UserInfoPage.tsx @@ -230,6 +230,7 @@ export default function UserInfoPage() { dropDownContainerStyle={{ backgroundColor: colors.primary_2, zIndex: 4000, + borderWidth: 0, }} dropDownDirection="TOP" /> @@ -265,6 +266,7 @@ export default function UserInfoPage() { dropDownContainerStyle={{ backgroundColor: colors.primary_2, zIndex: 3000, + borderWidth: 0, }} dropDownDirection="TOP" /> @@ -300,6 +302,7 @@ export default function UserInfoPage() { dropDownContainerStyle={{ backgroundColor: colors.primary_2, zIndex: 2000, + borderWidth: 0, }} dropDownDirection="TOP" />