diff --git a/R-Dash/assets/images/fullBrake.png b/R-Dash/assets/images/fullBrake.png new file mode 100644 index 0000000..a52c1b7 Binary files /dev/null and b/R-Dash/assets/images/fullBrake.png differ diff --git a/R-Dash/assets/images/midBrake.png b/R-Dash/assets/images/midBrake.png new file mode 100644 index 0000000..d7c419d Binary files /dev/null and b/R-Dash/assets/images/midBrake.png differ diff --git a/R-Dash/assets/images/noBrake.png b/R-Dash/assets/images/noBrake.png new file mode 100644 index 0000000..c6a8b2b Binary files /dev/null and b/R-Dash/assets/images/noBrake.png differ diff --git a/R-Dash/assets/images/startBrake.png b/R-Dash/assets/images/startBrake.png new file mode 100644 index 0000000..9663ff7 Binary files /dev/null and b/R-Dash/assets/images/startBrake.png differ diff --git a/R-Dash/screens/Lap.tsx b/R-Dash/screens/Lap.tsx index 7d0a379..a322fd8 100644 --- a/R-Dash/screens/Lap.tsx +++ b/R-Dash/screens/Lap.tsx @@ -106,12 +106,12 @@ export default function Lap(props: { navigation: any, route : any}) { Average Speed: - {currentLap.getAverageSpeed()} km/h + {currentLap.getAverageSpeed().toFixed()} km/h Max Speed: - {currentLap.getMaxSpeed()} km/h + {currentLap.getMaxSpeed().toFixed()} km/h diff --git a/R-Dash/screens/Point_Viewer.tsx b/R-Dash/screens/Point_Viewer.tsx index 38f7a9c..ec3f517 100644 --- a/R-Dash/screens/Point_Viewer.tsx +++ b/R-Dash/screens/Point_Viewer.tsx @@ -1,7 +1,7 @@ import { BackgroundImage } from '@rneui/base'; import { StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; -import MapView, { Marker } from 'react-native-maps'; +import MapView, { MapCallout, Marker } from 'react-native-maps'; import React from 'react'; import TopBar from '../components/TopBar'; import { Point } from '../core/Point'; @@ -20,6 +20,7 @@ export default function Lap(props: { navigation: any, route : any}) { const goToPreviousPoint = () => { if (currentPointIndex > 0) { setCurrentPointIndex(currentPointIndex - 1); + } }; @@ -29,11 +30,24 @@ export default function Lap(props: { navigation: any, route : any}) { } }; - const markers: { id: number; name: string; coordinate: { latitude: number; longitude: number } }[] = points.map((pt, index) => { + const markers: { id: number; name: string; coordinate: { latitude: number; longitude: number }, image: HTMLImageElement }[] = points.map((pt, index) => { + var img; + const brake = pt.getPBreakF(); + if(brake <= 0) + { + img = require("../assets/images/noBrake.png"); + }else if(brake > 0 && brake <= 30){ + img = require("../assets/images/startBrake.png"); + }else if(brake > 0 && brake <= 100){ + img = require("../assets/images/midBrake.png"); + }else{ + img = require("../assets/images/fullBrake.png"); + } return { id: index, name: pt.getDistance() + 'm', coordinate: { latitude: pt.getGeo().getGpsLat(), longitude: pt.getGeo().getGpsLong() }, + image: img, }; }); @@ -63,7 +77,7 @@ export default function Lap(props: { navigation: any, route : any}) { - Point {currentPointIndex + 1 } / { points.length } + Point {currentPointIndex + 1 } @@ -84,8 +98,8 @@ export default function Lap(props: { navigation: any, route : any}) { longitudeDelta: 0.015, }} > - {markers.map(({ id, name, coordinate }) => ( - handleMarker(id)} /> + {markers.map(({ id, name, coordinate,image }) => ( + handleMarker(id)} icon={image} style={{ width: 1, height: 1 }} /> ))} @@ -116,7 +130,7 @@ export default function Lap(props: { navigation: any, route : any}) { nGear: - {currentPoint.getVCar()} gear + {currentPoint.getNGear()} gear @@ -137,7 +151,7 @@ export default function Lap(props: { navigation: any, route : any}) { gLat: - {currentPoint.getGLong()} g + {currentPoint.getGLat()} g diff --git a/R-Dash/screens/Session_browser.tsx b/R-Dash/screens/Session_browser.tsx index c16d380..a5670cc 100644 --- a/R-Dash/screens/Session_browser.tsx +++ b/R-Dash/screens/Session_browser.tsx @@ -6,6 +6,7 @@ import { Text, View, TouchableOpacity, + ActivityIndicator, } from "react-native"; import { useDispatch, useSelector } from "react-redux"; import SessionListItem from "../components/SessionCmp"; @@ -17,6 +18,7 @@ import { SESSIONS } from "../stub/stub"; export default function Session_browser(props: { navigation: any }) { const { navigation } = props; const [search, setSearch] = useState(""); + const [loading, setLoading] = useState(false); const handlePress = (item: Session) => { setSearch(""); @@ -28,8 +30,10 @@ export default function Session_browser(props: { navigation: any }) { const dispatch = useDispatch(); useEffect(() => { + setLoading(true); const loadTeams = async () => { await dispatch(getSessionsList()); + setLoading(false); }; loadTeams(); }, [dispatch]); @@ -61,13 +65,17 @@ export default function Session_browser(props: { navigation: any }) { value={search} onChangeText={setSearch} /> - ( - - )} - keyExtractor={(Item) => Item.getName()} - /> + {loading ? ( + + ) : ( + ( + + )} + keyExtractor={(Item) => Item.getName()} + /> + )}