diff --git a/src/icons/RefreshIcon/RefreshIcon.tsx b/src/icons/RefreshIcon/RefreshIcon.tsx
new file mode 100644
index 0000000..0a77560
--- /dev/null
+++ b/src/icons/RefreshIcon/RefreshIcon.tsx
@@ -0,0 +1,26 @@
+import * as React from "react";
+import { IconProps } from "../../interfaces/Interfaces";
+
+import { Svg, Path } from "react-native-svg";
+import { colors } from "../../styles";
+
+export default function RefreshIcon(props: IconProps) {
+ return (
+ <>
+
+ >
+ );
+}
diff --git a/src/routes/Home/Home.tsx b/src/routes/Home/Home.tsx
index 52dcd3f..27282cf 100644
--- a/src/routes/Home/Home.tsx
+++ b/src/routes/Home/Home.tsx
@@ -43,6 +43,7 @@ import GetDistanceFromUSTP from "../../components/GetDistance/GetDistanceFromUST
import Modal from "react-native-modal";
import DropdownIcon from "../../icons/CaretDownIcon/CaretDownIcon";
import CaretUpIcon from "../../icons/CaretUpIcon/CaretUpIcon";
+import RefreshIcon from "../../icons/RefreshIcon/RefreshIcon";
export default function Home() {
// Switch this condition to see the main map when debugging
@@ -64,7 +65,6 @@ export default function Home() {
async function requestLocation() {
const { status } = await Location.requestForegroundPermissionsAsync();
if (status !== "granted") {
- setLocationPermitted(true);
setFeedback("Allow location permissions to continue");
toast.show(
"Location permission was denied. Please allow in order to use StudE",
@@ -78,6 +78,10 @@ export default function Home() {
return;
}
if (status == "granted") {
+ if (locationPermitted === false) {
+ setLocationPermitted(true);
+ }
+
let newLocation = await Location.getCurrentPositionAsync();
if (newLocation) {
// Only update location state if user's location has changed
@@ -357,26 +361,51 @@ export default function Home() {
});
function CustomMap() {
- if (dist && location && locationFetched) {
- if (
- (StudentStatusQuery.isFetching && studying) ||
- StudentStatusListQuery.isFetching ||
- StudyGroupQuery.isFetching ||
- (StudentStatusQuery.isFetching && !studying) ||
- StudentStatusListGlobalQuery.isFetching ||
- StudyGroupGlobalQuery.isFetching
- ) {
- return (
- <>
-
-
- Loading...
- >
- );
- }
+ if (
+ (StudentStatusQuery.isFetching && studying) ||
+ StudentStatusListQuery.isFetching ||
+ StudyGroupQuery.isFetching ||
+ (StudentStatusQuery.isFetching && !studying) ||
+ StudentStatusListGlobalQuery.isFetching ||
+ StudyGroupGlobalQuery.isFetching
+ ) {
+ return (
+ <>
+
+
+ Loading...
+ >
+ );
+ } else if (!locationPermitted) {
+ console.log(locationPermitted);
+ return (
+ <>
+ {feedback}
+
+ >
+ );
+ } else if (dist && location && locationFetched) {
if (dist <= 1 || map_distance_override) {
return (
<>
+
+ {
+ queryClient.invalidateQueries({ queryKey: ["user"] });
+ queryClient.invalidateQueries({ queryKey: ["user_status"] });
+ queryClient.invalidateQueries({
+ queryKey: ["user_status_list"],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["study_group_list"],
+ });
+ }}
+ >
+
+
+
;
}
- } else if (!locationPermitted) {
+ } else {
return (
<>
- {feedback}
-
+
+
+ Loading...
>
);
- } else {
- return <>>;
}
}
return (
@@ -970,6 +996,47 @@ export default function Home() {
) : (
<>>
)}
+ {student_status?.study_group != studygroup.name ? (
+ {
+ change_study_group.mutate({
+ study_group: studygroup.name,
+ subject: studygroup.subject,
+ });
+ setModalOpen(!modalOpen);
+ }}
+ >
+
+ Join Group
+
+
+ ) : (
+ <>>
+ )}
+ {student_status?.study_group == studygroup.name ? (
+ {
+ change_study_group.mutate({
+ study_group: "",
+ });
+ setModalOpen(!modalOpen);
+ }}
+ >
+
+ Leave Group
+
+
+ ) : (
+ <>>
+ )}
);
})
@@ -979,6 +1046,7 @@ export default function Home() {
+