mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-04-19 16:31:21 +08:00
Made pull up menu only operable if studying
This commit is contained in:
parent
4e1a73f6ed
commit
4a909a9236
2 changed files with 56 additions and 49 deletions
|
@ -311,6 +311,7 @@ export async function GetStudyGroupListFiltered() {
|
||||||
return instance
|
return instance
|
||||||
.get("/api/v1/study_groups/near/", config)
|
.get("/api/v1/study_groups/near/", config)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
console.log("DEBUGGG", response.data);
|
||||||
return [true, response.data];
|
return [true, response.data];
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
|
@ -241,7 +241,6 @@ export default function Home() {
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
onSuccess: (data: StudentStatusListReturnType) => {
|
onSuccess: (data: StudentStatusListReturnType) => {
|
||||||
console.log("DEBUGGG", data[1]);
|
|
||||||
if (data[1] && location) {
|
if (data[1] && location) {
|
||||||
// Filter to only include students studying solo
|
// Filter to only include students studying solo
|
||||||
let data_filtered = data[1].filter(
|
let data_filtered = data[1].filter(
|
||||||
|
@ -379,7 +378,7 @@ export default function Home() {
|
||||||
Student: {student_status.user}
|
Student: {student_status.user}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Studying Subject: {student_status.subject}
|
{`Studying ${student_status.subject}`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>,
|
</View>,
|
||||||
{
|
{
|
||||||
|
@ -425,14 +424,18 @@ export default function Home() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Subject: {studygroup.subject}
|
Study Group: {studygroup.name}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Name: {studygroup.name}
|
{`Studying ${studygroup.subject}`}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Students Studying:{" "}
|
{`${studygroup.students.length} ${
|
||||||
{studygroup.students.length}
|
studygroup.students.length > 1
|
||||||
|
? "students"
|
||||||
|
: "student"
|
||||||
|
} studying`}
|
||||||
</Text>
|
</Text>
|
||||||
{student_status?.study_group !=
|
{student_status?.study_group !=
|
||||||
studygroup.name ? (
|
studygroup.name ? (
|
||||||
|
@ -522,14 +525,17 @@ export default function Home() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Subject: {studygroup.subject}
|
Study Group: {studygroup.name}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Name: {studygroup.name}
|
{`Studying ${studygroup.subject}`}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Students Studying:{" "}
|
{`${studygroup.students.length} ${
|
||||||
{studygroup.students.length}
|
studygroup.students.length > 1
|
||||||
|
? "students"
|
||||||
|
: "student"
|
||||||
|
} studying`}
|
||||||
</Text>
|
</Text>
|
||||||
{student_status?.study_group !=
|
{student_status?.study_group !=
|
||||||
studygroup.name ? (
|
studygroup.name ? (
|
||||||
|
@ -714,7 +720,7 @@ export default function Home() {
|
||||||
setModalOpen(true);
|
setModalOpen(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CaretUpIcon size={32} />
|
{studying ? <CaretUpIcon size={32} /> : <></>}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
@ -725,11 +731,10 @@ export default function Home() {
|
||||||
return <MapRendererFar location={location.coords} dist={dist} />;
|
return <MapRendererFar location={location.coords} dist={dist} />;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
requestLocation();
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Text style={styles.text_white_medium}>{feedback}</Text>
|
<Text style={styles.text_white_medium}>{feedback}</Text>
|
||||||
<Button onPress={requestLocation}>
|
<Button onPress={() => requestLocation()}>
|
||||||
<Text style={styles.text_white_medium}>Allow Access</Text>
|
<Text style={styles.text_white_medium}>Allow Access</Text>
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
@ -740,7 +745,7 @@ export default function Home() {
|
||||||
<View style={styles.background}>
|
<View style={styles.background}>
|
||||||
<Modal
|
<Modal
|
||||||
coverScreen={false}
|
coverScreen={false}
|
||||||
isVisible={modalOpen}
|
isVisible={modalOpen && studying}
|
||||||
style={{ opacity: 0.85 }}
|
style={{ opacity: 0.85 }}
|
||||||
hasBackdrop={false}
|
hasBackdrop={false}
|
||||||
>
|
>
|
||||||
|
@ -784,7 +789,10 @@ export default function Home() {
|
||||||
Student: {student_status.user}
|
Student: {student_status.user}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Studying Subject: {student_status.subject}
|
{`Studying ${student_status.subject}`}
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
|
{`${Math.round(student_status.distance * 1000)}m away`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -794,8 +802,7 @@ export default function Home() {
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
{modalByGroup ? (
|
{modalByGroup ? (
|
||||||
study_groups_global.map(
|
study_groups.map((studygroup: StudyGroupType, index: number) => {
|
||||||
(studygroup: StudyGroupType, index: number) => {
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
key={index}
|
key={index}
|
||||||
|
@ -811,25 +818,24 @@ export default function Home() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Subject: {studygroup.subject}
|
Group Name: {studygroup.name}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Group Name: {studygroup.name}
|
{`Studying ${studygroup.subject}`}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Students Studying: {studygroup.students.length}
|
Students Studying: {studygroup.students.length}
|
||||||
</Text>
|
</Text>
|
||||||
{student_status?.study_group != studygroup.name ? (
|
{student_status?.study_group != studygroup.name ? (
|
||||||
<Text style={styles.text_white_tiny_bold}>
|
<Text style={styles.text_white_tiny_bold}>
|
||||||
Study nearby to join
|
{`${Math.round(studygroup.distance * 1000)}m away`}
|
||||||
</Text>
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
})
|
||||||
)
|
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Add table
Reference in a new issue