From 448ad0f5dd9ccc82f38fb3412f488d25a4090068 Mon Sep 17 00:00:00 2001 From: mohamed Date: Sat, 25 Mar 2023 23:05:09 +0100 Subject: [PATCH] fix quelques bug. ajout images points. --- R-Dash/assets/images/fullBrake.png | Bin 0 -> 527 bytes R-Dash/assets/images/midBrake.png | Bin 0 -> 594 bytes R-Dash/assets/images/noBrake.png | Bin 0 -> 419 bytes R-Dash/assets/images/startBrake.png | Bin 0 -> 587 bytes R-Dash/screens/Lap.tsx | 4 ++-- R-Dash/screens/Point_Viewer.tsx | 28 +++++++++++++++++++++------- R-Dash/screens/Session_browser.tsx | 22 +++++++++++++++------- 7 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 R-Dash/assets/images/fullBrake.png create mode 100644 R-Dash/assets/images/midBrake.png create mode 100644 R-Dash/assets/images/noBrake.png create mode 100644 R-Dash/assets/images/startBrake.png diff --git a/R-Dash/assets/images/fullBrake.png b/R-Dash/assets/images/fullBrake.png new file mode 100644 index 0000000000000000000000000000000000000000..a52c1b75940bf0d1552f3f5aeae6445bcd5a2310 GIT binary patch literal 527 zcmV+q0`UEbP)P)t-s(=;>9 zTVKswVBSMR+CDwYdxFnBKHx`2M{rEmI5*BjM$bS&(l#~FJUz&~%gstm&^kNLNlei= zIMF&g&PYqtGc(gP7Sl8{(=#)Z$QUmG000(rQchF;Eh7H@3cLOQ{)eLa#RFZ~XX)Q` z{zRe)z5oCLT}ebiR7l6o*4c7|AP@ymXa$EwT&vpu|I#oM2U-UaO{$Xn>?x#K8uqvx z_Lsy7A6HBS@3fI^D~;~BI42HfIa*x9Mmh5n0(xTp%Mi~d%`-#{JuYk)#C{M*1dK(N z2wDSa!X+lf6G@&TygdR>)ACOOG9wr&340<86-w1UYJ-f}k%7!y)m8IKMHJd$OQ6RH z8j^^x=NqD*cKF*>$ RW6%Hq002ovPDHLkV1izv<*)z% literal 0 HcmV?d00001 diff --git a/R-Dash/assets/images/midBrake.png b/R-Dash/assets/images/midBrake.png new file mode 100644 index 0000000000000000000000000000000000000000..d7c419d762540d55ae69b9b60c827298d99366f7 GIT binary patch literal 594 zcmV-Y069(ku6p5-FXN9X;gT}nl|JH-EZ>$s+@f3Do>SnD zF5Z(j+M7+@pjYrjCFG7K3X!x?0000MbW%=J{$Zjh{{FoH{tDar#ER*19WJzjA~FV< zz_=M?w9X^adale$V*rLurWkA7&n*VgB zi!Q1-Bh@Pj!T_OqCH?9qlkN43@8@WhaS`OY-CW|^xP+JZGHy?v3Iwfq*$uB~7BAi~ g#rMdcUrH7G0;iy4a>sxH5yCp~L_u@eIWBe$oEV~EG`tJ6*k zH7oGAvI?>Y8vOsiF*S$vl=s<^#P>nAlb;9)wLd&>QhoPFl<~Tj>5qKkAF7B>=AFed zHJu?oXIbm_1v5nt@NG=1(w58(RgRSQJkp+|gUy(p}!qI^fSZ-qAgC&syPJ2- z7Se{-wXdv&D}meYA9v)j60{M_V#!jnFUc1R`(pdiMb>+fd6WEC%2)D%i9MERKbA!Y zQV)NjMDi7jy2$!)k)1Tr?ZVVKwJ8 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()} + /> + )}