From 33ffcde6bee91fbb75007660e340f7ea9ebf0aa0 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Mon, 7 Aug 2023 15:03:53 +0800 Subject: [PATCH] Added map preview to start studying page --- src/components/Api/Api.tsx | 3 + src/routes/Home/Home.tsx | 10 +-- src/routes/StartStudying/StartStudying.tsx | 78 ++++++++++++++++------ 3 files changed, 65 insertions(+), 26 deletions(-) diff --git a/src/components/Api/Api.tsx b/src/components/Api/Api.tsx index b8a8ace..55b410d 100644 --- a/src/components/Api/Api.tsx +++ b/src/components/Api/Api.tsx @@ -30,6 +30,9 @@ const instance = axios.create({ console.log(backendURL); +// 3rd Party APIs +export const urlProvider = + "https://tile.thunderforest.com/atlas/{z}/{x}/{y}.png?apikey=0f5cb5930d7642a8a921daea650754d9"; // App APIs // Token Handling diff --git a/src/routes/Home/Home.tsx b/src/routes/Home/Home.tsx index a213472..73eb82a 100644 --- a/src/routes/Home/Home.tsx +++ b/src/routes/Home/Home.tsx @@ -6,13 +6,10 @@ import MapView, { Callout, Marker, UrlTile } from "react-native-maps"; import * as Location from "expo-location"; import GetDistance from "../../components/GetDistance/GetDistance"; import Button from "../../components/Button/Button"; -import { PostStudentStatus } from "../../components/Api/Api"; -import { - RootDrawerParamList, - StudentStatusParams, -} from "../../interfaces/Interfaces"; +import { RootDrawerParamList } from "../../interfaces/Interfaces"; import { LocationType } from "../../interfaces/Interfaces"; import { useNavigation } from "@react-navigation/native"; +import { urlProvider } from "../../components/Api/Api"; export default function Home() { const navigation = useNavigation(); @@ -21,8 +18,7 @@ export default function Home() { const [feedback, setFeedback] = useState( "To continue, please allow Stud-E permission to location services" ); - const urlProvider = - "https://tile.thunderforest.com/atlas/{z}/{x}/{y}.png?apikey=0f5cb5930d7642a8a921daea650754d9"; + const ustpCoords = { latitude: 8.4857, longitude: 124.6565, diff --git a/src/routes/StartStudying/StartStudying.tsx b/src/routes/StartStudying/StartStudying.tsx index 56b9b37..4fadf35 100644 --- a/src/routes/StartStudying/StartStudying.tsx +++ b/src/routes/StartStudying/StartStudying.tsx @@ -1,20 +1,16 @@ import * as React from "react"; -import styles from "../../styles"; +import styles, { Viewport } from "../../styles"; import { View, Text } from "react-native"; import { useState } from "react"; -import { - UserInfoParams, - Subject, - OptionType, -} from "../../interfaces/Interfaces"; +import { UserInfoParams, OptionType } from "../../interfaces/Interfaces"; import Button from "../../components/Button/Button"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { UserInfo } from "../../components/Api/Api"; import { colors } from "../../styles"; import DropDownPicker from "react-native-dropdown-picker"; import AnimatedContainerNoScroll from "../../components/AnimatedContainer/AnimatedContainerNoScroll"; -import { useSelector } from "react-redux"; -import { RootState } from "../../features/redux/Store/Store"; +import { urlProvider } from "../../components/Api/Api"; +import MapView, { UrlTile, Marker } from "react-native-maps"; export default function StartStudying({ route }: any) { const { location } = route.params; @@ -43,6 +39,57 @@ export default function StartStudying({ route }: any) { return ( + + + + + + + + + {feedback} + Start Studying @@ -80,17 +127,10 @@ export default function StartStudying({ route }: any) { /> - - - - {location.coords.longitude + "\n" + location.coords.latitude} - - - - {feedback} - + + );