mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-06-29 00:35:46 +08:00
Added back button to create group and start studying pages and adding loading indicator for start studying
This commit is contained in:
parent
7ac6a6745f
commit
6e63f86805
3 changed files with 92 additions and 34 deletions
|
@ -6,6 +6,7 @@ import {
|
|||
TextInput,
|
||||
NativeSyntheticEvent,
|
||||
TextInputChangeEventData,
|
||||
Pressable,
|
||||
} from "react-native";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
|
@ -22,6 +23,7 @@ import { urlProvider } from "../../components/Api/Api";
|
|||
import MapView, { UrlTile, Marker } from "react-native-maps";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import { useToast } from "react-native-toast-notifications";
|
||||
import CaretLeftIcon from "../../icons/CaretLeftIcon/CaretLeftIcon";
|
||||
|
||||
export default function CreateGroup({ route }: any) {
|
||||
const { location, subject } = route.params;
|
||||
|
@ -157,17 +159,23 @@ export default function CreateGroup({ route }: any) {
|
|||
}}
|
||||
/>
|
||||
<View style={styles.padding} />
|
||||
<Button
|
||||
onPress={() => {
|
||||
study_group_create.mutate({
|
||||
name: name,
|
||||
location: location,
|
||||
subject: subject,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Text style={styles.text_white_small}>Start Studying</Text>
|
||||
</Button>
|
||||
<View style={styles.flex_row}>
|
||||
<Pressable onPress={() => navigation.navigate("Home")}>
|
||||
<CaretLeftIcon size={32} />
|
||||
</Pressable>
|
||||
<Button
|
||||
onPress={() => {
|
||||
study_group_create.mutate({
|
||||
name: name,
|
||||
location: location,
|
||||
subject: subject,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Text style={styles.text_white_small}>Start Studying</Text>
|
||||
</Button>
|
||||
</View>
|
||||
|
||||
<View style={styles.padding} />
|
||||
</AnimatedContainerNoScroll>
|
||||
</View>
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import * as React from "react";
|
||||
import styles, { Viewport } from "../../styles";
|
||||
import { View, Text, ToastAndroid } from "react-native";
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
ToastAndroid,
|
||||
Pressable,
|
||||
ActivityIndicator,
|
||||
} from "react-native";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
UserInfoReturnType,
|
||||
|
@ -24,6 +30,7 @@ import { urlProvider } from "../../components/Api/Api";
|
|||
import MapView, { UrlTile, Marker } from "react-native-maps";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import { useToast } from "react-native-toast-notifications";
|
||||
import CaretLeftIcon from "../../icons/CaretLeftIcon/CaretLeftIcon";
|
||||
|
||||
export default function StartStudying({ route }: any) {
|
||||
const { location } = route.params;
|
||||
|
@ -90,6 +97,17 @@ export default function StartStudying({ route }: any) {
|
|||
},
|
||||
});
|
||||
|
||||
if (StudentInfo.isLoading) {
|
||||
return (
|
||||
<View style={styles.background}>
|
||||
<AnimatedContainerNoScroll>
|
||||
<View style={{ paddingVertical: 8 }} />
|
||||
<ActivityIndicator size={96} color={colors.secondary_1} />
|
||||
<Text style={styles.text_white_medium}>Loading...</Text>
|
||||
</AnimatedContainerNoScroll>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
if (location && location.coords) {
|
||||
return (
|
||||
<View style={styles.background}>
|
||||
|
@ -174,28 +192,32 @@ export default function StartStudying({ route }: any) {
|
|||
listMode="MODAL"
|
||||
/>
|
||||
<View style={styles.padding} />
|
||||
<Button
|
||||
onPress={() => {
|
||||
console.log({
|
||||
subject: selected_subject,
|
||||
location: {
|
||||
latitude: location.coords.latitude,
|
||||
longitude: location.coords.longitude,
|
||||
},
|
||||
});
|
||||
mutation.mutate({
|
||||
active: true,
|
||||
subject: selected_subject,
|
||||
location: {
|
||||
latitude: location.coords.latitude,
|
||||
longitude: location.coords.longitude,
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Text style={styles.text_white_small}>Start Studying</Text>
|
||||
</Button>
|
||||
<View style={styles.padding} />
|
||||
<View style={styles.flex_row}>
|
||||
<Pressable onPress={() => navigation.navigate("Home")}>
|
||||
<CaretLeftIcon size={32} />
|
||||
</Pressable>
|
||||
<Button
|
||||
onPress={() => {
|
||||
console.log({
|
||||
subject: selected_subject,
|
||||
location: {
|
||||
latitude: location.coords.latitude,
|
||||
longitude: location.coords.longitude,
|
||||
},
|
||||
});
|
||||
mutation.mutate({
|
||||
active: true,
|
||||
subject: selected_subject,
|
||||
location: {
|
||||
latitude: location.coords.latitude,
|
||||
longitude: location.coords.longitude,
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Text style={styles.text_white_small}>Start Studying</Text>
|
||||
</Button>
|
||||
</View>
|
||||
</AnimatedContainerNoScroll>
|
||||
</View>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue