mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2024-11-17 06:19:25 +08:00
Show landmarks if it exists in homepage and in conversation page
This commit is contained in:
parent
c0a8a8efc8
commit
51b7b24430
3 changed files with 81 additions and 44 deletions
|
@ -22,7 +22,7 @@ if (__DEV__) {
|
|||
}
|
||||
|
||||
// Switch this on if you wanna run production URLs while in development
|
||||
let use_production = true;
|
||||
let use_production = false;
|
||||
if (__DEV__ && use_production) {
|
||||
backendURL = "https://stude.keannu1.duckdns.org";
|
||||
backendURLWebsocket = "ws://stude.keannu1.duckdns.org";
|
||||
|
|
|
@ -200,9 +200,17 @@ export default function ConversationPage() {
|
|||
>
|
||||
<View style={styles.flex_row}>
|
||||
<Text style={{ ...styles.text_white_medium }}>
|
||||
{`Group: ${studygroup?.name ? studygroup.name : ""}`}
|
||||
{`Group: ${studygroup?.name ? studygroup.name : "Loading..."}`}
|
||||
</Text>
|
||||
</View>
|
||||
{studygroup.landmark ? (
|
||||
<Text style={{...styles.text_white_tiny_bold,...{textAlign:'left'}}}>
|
||||
{studygroup.landmark}
|
||||
</Text>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
|
||||
<View style={{ ...styles.flex_row }}>
|
||||
<Text
|
||||
style={{
|
||||
|
|
|
@ -146,27 +146,28 @@ export default function Home() {
|
|||
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){
|
||||
if (student_status && location) {
|
||||
const dist = GetDistance(
|
||||
student_status.location.latitude,
|
||||
student_status.location.longitude,
|
||||
location.coords.latitude,
|
||||
location.coords.longitude
|
||||
);
|
||||
console.log('Distance:',dist)
|
||||
console.log(student_status.location.latitude,
|
||||
console.log("Distance:", dist);
|
||||
console.log(
|
||||
student_status.location.latitude,
|
||||
student_status.location.longitude,
|
||||
location.coords.latitude,
|
||||
location.coords.longitude)
|
||||
location.coords.longitude
|
||||
);
|
||||
if (dist > 0.02 && studying && !stopping_toofar) {
|
||||
console.log('Too far from current studying location')
|
||||
console.log("Too far from current studying location");
|
||||
stop_studying.mutate({
|
||||
active: false,
|
||||
});
|
||||
setStopping(true);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
toast.show(String(error), {
|
||||
|
@ -591,6 +592,13 @@ export default function Home() {
|
|||
<Text style={styles.text_white_tiny_bold}>
|
||||
Study Group: {studygroup.name}
|
||||
</Text>
|
||||
{studygroup.landmark ? (
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{studygroup.landmark}
|
||||
</Text>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{`Studying ${studygroup.subject}`}
|
||||
</Text>
|
||||
|
@ -698,6 +706,13 @@ export default function Home() {
|
|||
<Text style={styles.text_white_tiny_bold}>
|
||||
Study Group: {studygroup.name}
|
||||
</Text>
|
||||
{studygroup.landmark ? (
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{studygroup.landmark}
|
||||
</Text>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{`Studying ${studygroup.subject}`}
|
||||
</Text>
|
||||
|
@ -906,7 +921,7 @@ export default function Home() {
|
|||
duration: 2000,
|
||||
animationType: "slide-in",
|
||||
});
|
||||
requestLocation()
|
||||
requestLocation();
|
||||
}}
|
||||
>
|
||||
<RefreshIcon size={32} />
|
||||
|
@ -982,14 +997,13 @@ export default function Home() {
|
|||
<DropdownIcon size={32} />
|
||||
</Pressable>
|
||||
<View style={styles.flex_column}>
|
||||
|
||||
<Text style={styles.text_white_medium}>List View</Text>
|
||||
<Switch
|
||||
value={modalByGroup}
|
||||
onChange={() => {
|
||||
setModalByGroup(!modalByGroup);
|
||||
}}
|
||||
style={{alignSelf:'center'}}
|
||||
style={{ alignSelf: "center" }}
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
@ -1048,6 +1062,13 @@ export default function Home() {
|
|||
<Text style={styles.text_white_tiny_bold}>
|
||||
Group Name: {studygroup.name}
|
||||
</Text>
|
||||
{studygroup.landmark ? (
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{studygroup.landmark}
|
||||
</Text>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{`Studying ${studygroup.subject}`}
|
||||
</Text>
|
||||
|
@ -1130,14 +1151,13 @@ export default function Home() {
|
|||
<DropdownIcon size={32} />
|
||||
</Pressable>
|
||||
<View style={styles.flex_column}>
|
||||
|
||||
<Text style={styles.text_white_medium}>List View</Text>
|
||||
<Switch
|
||||
value={modalByGroup}
|
||||
onChange={() => {
|
||||
setModalByGroup(!modalByGroup);
|
||||
}}
|
||||
style={{alignSelf:'center'}}
|
||||
style={{ alignSelf: "center" }}
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
@ -1174,7 +1194,8 @@ export default function Home() {
|
|||
<></>
|
||||
)}
|
||||
{modalByGroup ? (
|
||||
study_groups_global.map((studygroup: StudyGroupType, index: number) => {
|
||||
study_groups_global.map(
|
||||
(studygroup: StudyGroupType, index: number) => {
|
||||
return (
|
||||
<View
|
||||
key={index}
|
||||
|
@ -1193,6 +1214,13 @@ export default function Home() {
|
|||
<Text style={styles.text_white_tiny_bold}>
|
||||
Group Name: {studygroup.name}
|
||||
</Text>
|
||||
{studygroup.landmark ? (
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{studygroup.landmark}
|
||||
</Text>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{`Studying ${studygroup.subject}`}
|
||||
</Text>
|
||||
|
@ -1201,7 +1229,8 @@ export default function Home() {
|
|||
</Text>
|
||||
</View>
|
||||
);
|
||||
})
|
||||
}
|
||||
)
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
|
|
Loading…
Reference in a new issue