diff --git a/src/routes/ConversationPage/ConversationPage.tsx b/src/routes/ConversationPage/ConversationPage.tsx
index 94cae27..6bec280 100644
--- a/src/routes/ConversationPage/ConversationPage.tsx
+++ b/src/routes/ConversationPage/ConversationPage.tsx
@@ -200,17 +200,9 @@ export default function ConversationPage() {
>
- {`Group: ${studygroup?.name ? studygroup.name : "Loading..."}`}
+ {`Group: ${studygroup?.name ? studygroup.name : ""}`}
- {studygroup.landmark ? (
-
- {studygroup.landmark}
-
- ) : (
- <>>
- )}
-
{
- // console.log("Location Update");
- // console.log(locationPermitted);
+ console.log("changed");
+ console.log(locationPermitted);
requestLocation();
}, [locationPermitted]);
@@ -111,8 +117,8 @@ export default function Home() {
async function DistanceHandler(location: RawLocationType) {
let dist = GetDistanceFromUSTP(location.coords);
setDist(dist);
- // Deactivate student status if too far away from USTP and still studying
- if (dist >= 1 && !map_distance_override && studying && !stopping_toofar) {
+ // Deactivate student status if too far away and still studying
+ if (dist >= 2 && !map_distance_override && studying && !stopping_toofar) {
stop_studying.mutate({
active: false,
});
@@ -146,22 +152,6 @@ export default function Home() {
setSubject(data[1].subject);
setStudying(data[1].active);
setStudentStatus(data[1]);
- // Deactivate student status if too far away from current location you are studying in
- if (student_status && location) {
- const dist = GetDistance(
- student_status.location.latitude,
- student_status.location.longitude,
- location.coords.latitude,
- location.coords.longitude
- );
- if (dist > 0.5 && studying && !stopping_toofar) {
- console.log("Too far from current studying location");
- stop_studying.mutate({
- active: false,
- });
- setStopping(true);
- }
- }
},
onError: (error: Error) => {
toast.show(String(error), {
@@ -207,7 +197,9 @@ export default function Home() {
}, 500);
setStudyGroups([]);
setStudying(false);
- setStopping(false);
+ if (stopping_toofar) {
+ setStopping(false);
+ }
},
onError: (error: Error) => {
toast.show(String(error), {
@@ -406,21 +398,8 @@ export default function Home() {
Loading...
>
);
- } else if (
- study_groups == undefined ||
- study_groups_global == undefined ||
- student_statuses == undefined ||
- student_statuses_global == undefined
- ) {
- return (
- <>
-
-
- Loading...
- >
- );
} else if (dist && location) {
- if (dist <= 0.25 || map_distance_override) {
+ if (dist <= 1 || map_distance_override) {
return (
<>
{
toast.hideAll();
-
toast.show(
-
-
- Student: {student_status.user}
-
-
- {`Studying ${student_status.subject}`}
-
-
- {`${Math.round(
- GetDistance(
- student_status.location.latitude,
- student_status.location.longitude,
- location.coords.latitude,
- location.coords.longitude
- ) * 1000
- )}m away`}
-
-
-
+ />
);
}
)
@@ -608,7 +567,6 @@ export default function Home() {
zIndex={1000}
onPress={() => {
toast.hideAll();
-
toast.show(
Study Group: {studygroup.name}
- {studygroup.landmark ? (
-
- {studygroup.landmark}
-
- ) : (
- <>>
- )}
{`Studying ${studygroup.subject}`}
@@ -691,35 +642,7 @@ export default function Home() {
}
);
}}
- >
-
-
- Study Group: {studygroup.name}
-
-
- Studying: {studygroup.subject}
-
- {studygroup.landmark ? (
-
- {studygroup.landmark}
-
- ) : (
- <>>
- )}
-
- {`${studygroup.students.length} ${
- studygroup.students.length > 1
- ? "students"
- : "student"
- } studying`}
-
-
- {`${Math.round(
- studygroup.distance * 1000
- )}m away`}
-
-
-
+ />
Study Group: {studygroup.name}
- {studygroup.landmark ? (
-
- {studygroup.landmark}
-
- ) : (
- <>>
- )}
{`Studying ${studygroup.subject}`}
@@ -801,40 +717,7 @@ export default function Home() {
}
);
}}
- >
-
-
- Study Group: {studygroup.name}
-
-
- Studying: {studygroup.subject}
-
- {studygroup.landmark ? (
-
- {studygroup.landmark}
-
- ) : (
- <>>
- )}
-
- {`${studygroup.students.length} ${
- studygroup.students.length > 1
- ? "students"
- : "student"
- } studying`}
-
-
- {`${Math.round(
- GetDistance(
- studygroup.location.latitude,
- studygroup.location.longitude,
- location.coords.latitude,
- location.coords.longitude
- )
- )}m away`}
-
-
-
+ />
@@ -1026,7 +908,7 @@ export default function Home() {
setModalOpen(true);
}}
>
-
+ {studying ? : <>>}
{student_status?.active && !student_status?.study_group ? (
@@ -1085,15 +967,14 @@ export default function Home() {
>
-
- List View
+
{
setModalByGroup(!modalByGroup);
}}
- style={{ alignSelf: "center" }}
/>
+ List View
@@ -1124,20 +1005,6 @@ export default function Home() {
{`${Math.round(student_status.distance * 1000)}m away`}
- {location && location.coords ? (
-
- {`${Math.round(
- GetDistance(
- student_status.location.latitude,
- student_status.location.longitude,
- location.coords.latitude,
- location.coords.longitude
- )
- )}m away`}
-
- ) : (
- <>>
- )}
);
}
@@ -1165,13 +1032,6 @@ export default function Home() {
Group Name: {studygroup.name}
- {studygroup.landmark ? (
-
- {studygroup.landmark}
-
- ) : (
- <>>
- )}
{`Studying ${studygroup.subject}`}
@@ -1236,138 +1096,6 @@ export default function Home() {
-
-
- setModalOpen(false)}
- >
-
-
-
- List View
- {
- setModalByGroup(!modalByGroup);
- }}
- style={{ alignSelf: "center" }}
- />
-
-
-
- {!modalByGroup ? (
- student_statuses_global.map(
- (student_status: StudentStatusFilterType, index: number) => {
- return (
-
-
- Student: {student_status.user}
-
-
- {`Studying ${student_status.subject}`}
-
- {location && location.coords ? (
-
- {`${Math.round(
- GetDistance(
- student_status.location.latitude,
- student_status.location.longitude,
- location.coords.latitude,
- location.coords.longitude
- )
- )}m away`}
-
- ) : (
- <>>
- )}
-
- );
- }
- )
- ) : (
- <>>
- )}
- {modalByGroup ? (
- study_groups_global.map(
- (studygroup: StudyGroupType, index: number) => {
- return (
-
-
- Group Name: {studygroup.name}
-
- {studygroup.landmark ? (
-
- {studygroup.landmark}
-
- ) : (
- <>>
- )}
-
- {`Studying ${studygroup.subject}`}
-
-
- Students Studying: {studygroup.students.length}
-
- {location && location.coords ? (
-
- {`${Math.round(
- GetDistance(
- studygroup.location.latitude,
- studygroup.location.longitude,
- location.coords.latitude,
- location.coords.longitude
- )
- )}m away`}
-
- ) : (
- <>>
- )}
-
- );
- }
- )
- ) : (
- <>>
- )}
-
-
-