mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-08-03 10:03:20 +08:00
Added create group functionality
This commit is contained in:
parent
62cee96b94
commit
debaa544bc
5 changed files with 234 additions and 11 deletions
|
@ -416,7 +416,7 @@ export default function Home() {
|
|||
Subject: {studygroup.subject}
|
||||
</Text>
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
Students Studying: {studygroup.users.length}
|
||||
Students Studying: {studygroup.students.length}
|
||||
</Text>
|
||||
<Button
|
||||
onPress={() => {
|
||||
|
@ -485,7 +485,7 @@ export default function Home() {
|
|||
Subject: {studygroup.subject}
|
||||
</Text>
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
Students Studying: {studygroup.users.length}
|
||||
Students Studying: {studygroup.students.length}
|
||||
</Text>
|
||||
<Button
|
||||
onPress={() => {
|
||||
|
@ -580,29 +580,41 @@ export default function Home() {
|
|||
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{"x: " +
|
||||
(student_status?.location?.longitude != 0
|
||||
(student_status?.location?.longitude != undefined
|
||||
? student_status?.location?.longitude.toFixed(4)
|
||||
: location.coords.longitude.toFixed(4))}
|
||||
</Text>
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{"y: " +
|
||||
(student_status?.location?.latitude != 0
|
||||
(student_status?.location?.latitude != undefined
|
||||
? student_status?.location?.latitude.toFixed(4)
|
||||
: location.coords.latitude.toFixed(4))}
|
||||
</Text>
|
||||
{studying ? (
|
||||
{student_status?.active &&
|
||||
!student_status?.study_group ? (
|
||||
<>
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{studying
|
||||
{student_status?.active
|
||||
? "Studying " + student_status?.subject
|
||||
: ""}
|
||||
</Text>
|
||||
<Button
|
||||
onPress={() => {
|
||||
if (student_status?.subject) {
|
||||
study_group_create.mutate({
|
||||
name: "asdasdasdasd",
|
||||
location: location.coords,
|
||||
console.log({
|
||||
location: {
|
||||
latitude: student_status?.location.latitude,
|
||||
longitude:
|
||||
student_status?.location.longitude,
|
||||
},
|
||||
subject: student_status?.subject,
|
||||
});
|
||||
navigation.navigate("Create Group", {
|
||||
location: {
|
||||
latitude: student_status?.location.latitude,
|
||||
longitude:
|
||||
student_status?.location.longitude,
|
||||
},
|
||||
subject: student_status?.subject,
|
||||
});
|
||||
}
|
||||
|
@ -616,6 +628,18 @@ export default function Home() {
|
|||
) : (
|
||||
<></>
|
||||
)}
|
||||
{student_status?.study_group ? (
|
||||
<>
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{`Studying ${student_status?.subject}`}
|
||||
</Text>
|
||||
<Text style={styles.text_white_tiny_bold}>
|
||||
{`In group ${student_status?.study_group}`}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</View>,
|
||||
{
|
||||
type: "normal",
|
||||
|
@ -634,7 +658,7 @@ export default function Home() {
|
|||
</MapView>
|
||||
<Button
|
||||
onPress={async () => {
|
||||
if (!studying) {
|
||||
if (!student_status?.active) {
|
||||
navigation.navigate("Start Studying", { location: location });
|
||||
} else {
|
||||
mutation.mutate({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue