Show landmarks if it exists in homepage and in conversation page

This commit is contained in:
Keannu Bernasol 2023-11-24 00:22:14 +08:00
parent c0a8a8efc8
commit 51b7b24430
3 changed files with 81 additions and 44 deletions

View file

@ -22,7 +22,7 @@ if (__DEV__) {
} }
// Switch this on if you wanna run production URLs while in development // Switch this on if you wanna run production URLs while in development
let use_production = true; let use_production = false;
if (__DEV__ && use_production) { if (__DEV__ && use_production) {
backendURL = "https://stude.keannu1.duckdns.org"; backendURL = "https://stude.keannu1.duckdns.org";
backendURLWebsocket = "ws://stude.keannu1.duckdns.org"; backendURLWebsocket = "ws://stude.keannu1.duckdns.org";

View file

@ -200,9 +200,17 @@ export default function ConversationPage() {
> >
<View style={styles.flex_row}> <View style={styles.flex_row}>
<Text style={{ ...styles.text_white_medium }}> <Text style={{ ...styles.text_white_medium }}>
{`Group: ${studygroup?.name ? studygroup.name : ""}`} {`Group: ${studygroup?.name ? studygroup.name : "Loading..."}`}
</Text> </Text>
</View> </View>
{studygroup.landmark ? (
<Text style={{...styles.text_white_tiny_bold,...{textAlign:'left'}}}>
{studygroup.landmark}
</Text>
) : (
<></>
)}
<View style={{ ...styles.flex_row }}> <View style={{ ...styles.flex_row }}>
<Text <Text
style={{ style={{

View file

@ -146,27 +146,28 @@ export default function Home() {
setStudying(data[1].active); setStudying(data[1].active);
setStudentStatus(data[1]); setStudentStatus(data[1]);
// Deactivate student status if too far away from current location you are studying in // 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( const dist = GetDistance(
student_status.location.latitude, student_status.location.latitude,
student_status.location.longitude, student_status.location.longitude,
location.coords.latitude, location.coords.latitude,
location.coords.longitude location.coords.longitude
); );
console.log('Distance:',dist) console.log("Distance:", dist);
console.log(student_status.location.latitude, console.log(
student_status.location.latitude,
student_status.location.longitude, student_status.location.longitude,
location.coords.latitude, location.coords.latitude,
location.coords.longitude) location.coords.longitude
);
if (dist > 0.02 && studying && !stopping_toofar) { 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({ stop_studying.mutate({
active: false, active: false,
}); });
setStopping(true); setStopping(true);
} }
} }
}, },
onError: (error: Error) => { onError: (error: Error) => {
toast.show(String(error), { toast.show(String(error), {
@ -591,6 +592,13 @@ export default function Home() {
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
Study Group: {studygroup.name} Study Group: {studygroup.name}
</Text> </Text>
{studygroup.landmark ? (
<Text style={styles.text_white_tiny_bold}>
{studygroup.landmark}
</Text>
) : (
<></>
)}
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
{`Studying ${studygroup.subject}`} {`Studying ${studygroup.subject}`}
</Text> </Text>
@ -698,6 +706,13 @@ export default function Home() {
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
Study Group: {studygroup.name} Study Group: {studygroup.name}
</Text> </Text>
{studygroup.landmark ? (
<Text style={styles.text_white_tiny_bold}>
{studygroup.landmark}
</Text>
) : (
<></>
)}
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
{`Studying ${studygroup.subject}`} {`Studying ${studygroup.subject}`}
</Text> </Text>
@ -906,7 +921,7 @@ export default function Home() {
duration: 2000, duration: 2000,
animationType: "slide-in", animationType: "slide-in",
}); });
requestLocation() requestLocation();
}} }}
> >
<RefreshIcon size={32} /> <RefreshIcon size={32} />
@ -982,14 +997,13 @@ export default function Home() {
<DropdownIcon size={32} /> <DropdownIcon size={32} />
</Pressable> </Pressable>
<View style={styles.flex_column}> <View style={styles.flex_column}>
<Text style={styles.text_white_medium}>List View</Text> <Text style={styles.text_white_medium}>List View</Text>
<Switch <Switch
value={modalByGroup} value={modalByGroup}
onChange={() => { onChange={() => {
setModalByGroup(!modalByGroup); setModalByGroup(!modalByGroup);
}} }}
style={{alignSelf:'center'}} style={{ alignSelf: "center" }}
/> />
</View> </View>
@ -1048,6 +1062,13 @@ export default function Home() {
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
Group Name: {studygroup.name} Group Name: {studygroup.name}
</Text> </Text>
{studygroup.landmark ? (
<Text style={styles.text_white_tiny_bold}>
{studygroup.landmark}
</Text>
) : (
<></>
)}
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
{`Studying ${studygroup.subject}`} {`Studying ${studygroup.subject}`}
</Text> </Text>
@ -1130,14 +1151,13 @@ export default function Home() {
<DropdownIcon size={32} /> <DropdownIcon size={32} />
</Pressable> </Pressable>
<View style={styles.flex_column}> <View style={styles.flex_column}>
<Text style={styles.text_white_medium}>List View</Text> <Text style={styles.text_white_medium}>List View</Text>
<Switch <Switch
value={modalByGroup} value={modalByGroup}
onChange={() => { onChange={() => {
setModalByGroup(!modalByGroup); setModalByGroup(!modalByGroup);
}} }}
style={{alignSelf:'center'}} style={{ alignSelf: "center" }}
/> />
</View> </View>
@ -1174,7 +1194,8 @@ export default function Home() {
<></> <></>
)} )}
{modalByGroup ? ( {modalByGroup ? (
study_groups_global.map((studygroup: StudyGroupType, index: number) => { study_groups_global.map(
(studygroup: StudyGroupType, index: number) => {
return ( return (
<View <View
key={index} key={index}
@ -1193,6 +1214,13 @@ export default function Home() {
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
Group Name: {studygroup.name} Group Name: {studygroup.name}
</Text> </Text>
{studygroup.landmark ? (
<Text style={styles.text_white_tiny_bold}>
{studygroup.landmark}
</Text>
) : (
<></>
)}
<Text style={styles.text_white_tiny_bold}> <Text style={styles.text_white_tiny_bold}>
{`Studying ${studygroup.subject}`} {`Studying ${studygroup.subject}`}
</Text> </Text>
@ -1201,7 +1229,8 @@ export default function Home() {
</Text> </Text>
</View> </View>
); );
}) }
)
) : ( ) : (
<></> <></>
)} )}