Compare commits
29 Commits
Backend/Pa
...
master
Author | SHA1 | Date |
---|---|---|
![]() |
964f0e2ba8 | 2 years ago |
![]() |
a3d83b19fd | 2 years ago |
![]() |
448ad0f5dd | 2 years ago |
![]() |
2d684c1640 | 2 years ago |
![]() |
ecf486f435 | 2 years ago |
![]() |
f3f41a2b94 | 2 years ago |
|
7dfc7e0482 | 2 years ago |
|
724f63e605 | 2 years ago |
![]() |
47fc46c04c | 2 years ago |
![]() |
474a58b51a | 2 years ago |
![]() |
0329133e1a | 2 years ago |
|
b643be8199 | 2 years ago |
![]() |
b6ee229a50 | 2 years ago |
![]() |
971600d64d | 2 years ago |
![]() |
72056b172b | 2 years ago |
![]() |
2f91957532 | 2 years ago |
![]() |
4754741fab | 2 years ago |
|
782a5aa86c | 2 years ago |
![]() |
aafed73b1b | 2 years ago |
![]() |
8cc6ca1f72 | 2 years ago |
![]() |
011553d47e | 2 years ago |
|
49e7d3aa3b | 2 years ago |
![]() |
b9eb0b5444 | 2 years ago |
![]() |
5123771c8d | 2 years ago |
![]() |
eeaf9973b6 | 2 years ago |
![]() |
ed1db9438d | 2 years ago |
![]() |
7227a4cab0 | 2 years ago |
![]() |
9f0b7c720f | 2 years ago |
|
b1224c334f | 2 years ago |
After Width: | Height: | Size: 527 B |
After Width: | Height: | Size: 594 B |
After Width: | Height: | Size: 419 B |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 587 B |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,55 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { View,Image,Text, StyleSheet, Touchable } from "react-native";
|
||||||
|
import { TouchableOpacity } from "react-native-gesture-handler";
|
||||||
|
import { Session } from "../core/Session";
|
||||||
|
|
||||||
|
type SessionListItemProps = {
|
||||||
|
session: Session;
|
||||||
|
onPress: (team: Session) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SessionListItem(props: SessionListItemProps) {
|
||||||
|
|
||||||
|
const timeInSeconds = props.session.getLaps()[props.session.getLaps().length - 1].getTime();
|
||||||
|
return (
|
||||||
|
<TouchableOpacity style={styles.container}
|
||||||
|
onPress={()=> props.onPress(props.session)}>
|
||||||
|
<Text style={styles.text_style}> {props.session.getName()}</Text>
|
||||||
|
<View style={styles.container_low}>
|
||||||
|
<Text style={styles.text_under}> {props.session.getType().toString() }</Text>
|
||||||
|
<Text style={styles.text_under}> { timeInSeconds }</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</TouchableOpacity>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
borderRadius:30,
|
||||||
|
alignItems:'center',
|
||||||
|
backgroundColor:'#e1e8ee',
|
||||||
|
padding:1,
|
||||||
|
flex: 1,
|
||||||
|
margin:10,
|
||||||
|
},
|
||||||
|
container_low: {
|
||||||
|
borderRadius:30,
|
||||||
|
alignItems:'center',
|
||||||
|
backgroundColor:'#e1e8ee',
|
||||||
|
padding:10,
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
marginBottom:10,
|
||||||
|
},
|
||||||
|
text_style:{
|
||||||
|
textAlign:'center',
|
||||||
|
fontSize:25,
|
||||||
|
},
|
||||||
|
text_under:{
|
||||||
|
marginLeft:15,
|
||||||
|
textAlign:'center',
|
||||||
|
fontSize:20,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { View,Image,Text, StyleSheet, Touchable } from "react-native";
|
||||||
|
import { TouchableOpacity } from "react-native-gesture-handler";
|
||||||
|
import { Team } from "../core/Team";
|
||||||
|
|
||||||
|
type TeamListItemProps = {
|
||||||
|
team: Team;
|
||||||
|
onPress: (team: Team) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function TeamListItem(props: TeamListItemProps) {
|
||||||
|
return (
|
||||||
|
<TouchableOpacity style={styles.container}
|
||||||
|
onPress={()=> props.onPress(props.team)}>
|
||||||
|
<Image style={styles.teaserImage} source={props.team.getLogo()} />
|
||||||
|
<Text style={styles.text_style}> {props.team.getName()}</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
alignItems:'center',
|
||||||
|
backgroundColor:'#e1e8ee',
|
||||||
|
padding:10,
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
marginBottom:10,
|
||||||
|
},
|
||||||
|
text_style:{
|
||||||
|
marginLeft:15,
|
||||||
|
textAlign:'center',
|
||||||
|
fontSize:20,
|
||||||
|
},
|
||||||
|
teaserImage: {
|
||||||
|
borderWidth:1,
|
||||||
|
borderColor:'black',
|
||||||
|
borderRadius:50,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
import { Session } from "./Session";
|
||||||
|
|
||||||
|
|
||||||
|
export interface ILoader{
|
||||||
|
Load() : Session
|
||||||
|
LoadFromFile(file : File) : Session
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
import { ILoader } from "./ILoader";
|
||||||
|
import { Session } from "./Session";
|
||||||
|
|
||||||
|
export class LoadDB implements ILoader{
|
||||||
|
LoadFromFile(file: File): Session {
|
||||||
|
throw new Error("file argument is not accepted !."); // GARDER EN NON IMPLEMENTED !
|
||||||
|
}
|
||||||
|
Load(): Session {
|
||||||
|
throw new Error("Method not implemented."); // APPEL API
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
import { ILoader } from "./ILoader";
|
||||||
|
import { Session } from "./Session";
|
||||||
|
|
||||||
|
|
||||||
|
export class LoadXLS implements ILoader{
|
||||||
|
LoadFromFile(file: File): Session {
|
||||||
|
throw new Error("Method not implemented."); // APPEL API RETOUR JSON
|
||||||
|
}
|
||||||
|
Load(): Session {
|
||||||
|
throw new Error("Cannot load without a file."); // GARDER EN NON IMPLEMENTED !
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
enum SessionType {
|
export enum SessionType {
|
||||||
Test,
|
Test = "Test",
|
||||||
PrivateTest,
|
PrivateTest = "Private Test",
|
||||||
Qualification,
|
Qualification = "Qualification",
|
||||||
ShortStroke,
|
ShortStroke = "Short Stroke",
|
||||||
LongStroke,
|
LongStroke = "Long Stroke",
|
||||||
Unknown,
|
Unknown = "Unknown",
|
||||||
}
|
}
|
@ -1,9 +1,8 @@
|
|||||||
import { Session } from "./Session";
|
import { Session } from "./Session";
|
||||||
import { Team } from "./Team";
|
|
||||||
import { User } from "./User";
|
import { User } from "./User";
|
||||||
|
|
||||||
export class WaitingMember extends User {
|
export class WaitingMember extends User {
|
||||||
constructor(id: number, pseudo: string, password: string, email: string, sessions: Session[], team: Team) {
|
constructor( pseudo: string, password: string, email: string, sessions: Session[],image : HTMLImageElement= require('../assets/images/user.jpg')) {
|
||||||
super(id, pseudo, password, email, sessions, team);
|
super(pseudo, password, email, sessions, image);
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
|||||||
|
export const FETCH_USERS = 'FETCH_USERS';
|
||||||
|
export const FETCH_TEAMS = 'FETCH_TEAMS';
|
||||||
|
export const FETCH_SESSIONS = 'FETCH_SESSIONS';
|
||||||
|
export const ADD_TEAM = 'ADD_TEAM';
|
||||||
|
export const ADD_FILE = 'ADD_FILE';
|
||||||
|
//export const server_link = "https://codefirst.iut.uca.fr/containers/enzojolys-r-dash_container";
|
||||||
|
export const server_link = "https://r-dash.azurewebsites.net";
|
@ -0,0 +1,18 @@
|
|||||||
|
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit'
|
||||||
|
import appReducer from './reducers/appReducer';
|
||||||
|
|
||||||
|
// Reference here all your application reducers
|
||||||
|
const reducer = {
|
||||||
|
appReducer: appReducer,
|
||||||
|
}
|
||||||
|
|
||||||
|
const middleware = getDefaultMiddleware({
|
||||||
|
serializableCheck: false, // Disable serializableCheck
|
||||||
|
immutableCheck: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const store = configureStore({
|
||||||
|
reducer,
|
||||||
|
middleware,
|
||||||
|
});
|
||||||
|
export default store;
|
@ -0,0 +1,74 @@
|
|||||||
|
import { Alert } from "react-native";
|
||||||
|
import { Geocalisation } from "../../core/Geocalisation";
|
||||||
|
import { Lap } from "../../core/Lap";
|
||||||
|
import { Point } from "../../core/Point";
|
||||||
|
import { Session } from "../../core/Session";
|
||||||
|
import { User } from "../../core/User";
|
||||||
|
import { FETCH_SESSIONS, server_link } from "../Constants";
|
||||||
|
|
||||||
|
export const setSessionsList = (sessionsList: Session[]) => {
|
||||||
|
return {
|
||||||
|
type: FETCH_SESSIONS,
|
||||||
|
payload: sessionsList,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// export const addXlsFile = async (file: File) => {
|
||||||
|
// try {
|
||||||
|
// const formData = new FormData();
|
||||||
|
// formData.append('file', file);
|
||||||
|
// const response = await fetch(
|
||||||
|
// 'https://r-dash.azurewebsites.net/File?' + "pseudoPilote=test_PILOTE" + "&Email=test@gmail.com" + "&password=test123" + "&nameSession=test_SESSION" + "&nameCircuit=test_CIRCUIT" + "&typeSession=Unknown", {
|
||||||
|
// method: 'POST',
|
||||||
|
// body: formData
|
||||||
|
// });
|
||||||
|
// const data = await response.json();
|
||||||
|
// return data;
|
||||||
|
// } catch (error) {
|
||||||
|
// console.log('Error---------', error);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
export const addXlsFile = (file: File, pseudoPilote: string, email: string, password: string, nameSession: string, nameCircuit: string, typeSession: string) => {
|
||||||
|
return async dispatch => {
|
||||||
|
try {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
const response = await fetch(
|
||||||
|
server_link+`/File?pseudoPilote=${pseudoPilote}&Email=${email}&password=${password}&nameSession=${nameSession}&nameCircuit=${nameCircuit}&typeSession=${typeSession}`,
|
||||||
|
{
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const data = await response.json();
|
||||||
|
return data;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Error - POST FILE', error);
|
||||||
|
Alert.alert('Error', 'An error occured while adding a session. (server might be down)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export const getSessionsList = () => {
|
||||||
|
return async dispatch => {
|
||||||
|
try {
|
||||||
|
const sessionsPromise = await fetch(server_link+'/FullSession');
|
||||||
|
const sessionsListJson = await sessionsPromise.json();
|
||||||
|
const sessionsList: Session[] = sessionsListJson.map(elt => {
|
||||||
|
const laps: Lap[] = elt["tours"].map(lap => {
|
||||||
|
const points: Point[] = lap["points"].map(point => {
|
||||||
|
const geo = new Geocalisation(point["longitude"], point["latitude"]);
|
||||||
|
return new Point(geo, point["timer"] , point["distance"], point["nGear"], point["pBrakeF"], point["aSteer"], point["rPedal"], point["gLong"], point["gLat"], point["vCar"]);
|
||||||
|
});
|
||||||
|
return new Lap(lap["numero"], points, lap["temps"]);
|
||||||
|
});
|
||||||
|
return new Session(elt["name"], laps, elt["type"]);
|
||||||
|
});
|
||||||
|
dispatch(setSessionsList(sessionsList));
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Error -- GET SESSIONS', error);
|
||||||
|
Alert.alert('Error', 'An error occured while getting sessions. (server might be down)');
|
||||||
|
//dispatch(fetchDataRejected(error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
import { Team } from "../../core/Team";
|
||||||
|
import { FETCH_TEAMS, ADD_TEAM, server_link } from "../Constants";
|
||||||
|
|
||||||
|
export const setTeamsList = (teamsList: Team[]) => {
|
||||||
|
return {
|
||||||
|
type: FETCH_TEAMS,
|
||||||
|
payload: teamsList,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addNewTeam = (newTeam: Team) => {
|
||||||
|
return async dispatch => {
|
||||||
|
try {
|
||||||
|
const response = await fetch(server_link + '/Ecuries?' + "Email=test@gmail.com" + "&password=test123" + "&pseudoPilote=test_PILOTE", {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(newTeam)
|
||||||
|
});
|
||||||
|
const team = await response.json();
|
||||||
|
dispatch({
|
||||||
|
type: ADD_TEAM,
|
||||||
|
payload: team
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Error---------', error);
|
||||||
|
//dispatch(fetchDataRejected(error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTeamsList = () => {
|
||||||
|
return async dispatch => {
|
||||||
|
try {
|
||||||
|
const teamsPromise = await fetch(server_link+'/Ecuries');
|
||||||
|
const teamsListJson = await teamsPromise.json();
|
||||||
|
const teamsList: Team[] = teamsListJson.map(elt => new Team(elt["name"], elt["owner"], elt["users"], elt["logo"]));
|
||||||
|
dispatch(setTeamsList(teamsList));
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Error---------', error);
|
||||||
|
//dispatch(fetchDataRejected(error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
import { Member } from "../../core/Member";
|
||||||
|
import { Owner } from "../../core/Owner";
|
||||||
|
import { Team } from "../../core/Team";
|
||||||
|
import { User } from "../../core/User";
|
||||||
|
import { WaitingMember } from "../../core/WaitingMember";
|
||||||
|
import { FETCH_USERS } from "../Constants";
|
||||||
|
import { DtoUserEcurie } from "../dto/dtoUserEcurie";
|
||||||
|
|
||||||
|
export const setUsersList = (usersList: User[]) => {
|
||||||
|
return {
|
||||||
|
type: FETCH_USERS,
|
||||||
|
payload: usersList,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getUsersList = (team: Team) => {
|
||||||
|
return async dispatch => {
|
||||||
|
try {
|
||||||
|
const usersPromise = await fetch(server_link+'/Pilotes/'+team);
|
||||||
|
const usersListJson = await usersPromise.json();
|
||||||
|
const dto: DtoUserEcurie = usersListJson.map(elt => new DtoUserEcurie(elt["owner"], elt["members"], elt["waitingMember"]));
|
||||||
|
const usersList: User[] = []
|
||||||
|
usersList.push(dto.getOwner())
|
||||||
|
dto.getMembers().forEach(element => {
|
||||||
|
usersList.push(element);
|
||||||
|
});
|
||||||
|
dto.getWaitingMember().forEach(element => {
|
||||||
|
usersList.push(element)
|
||||||
|
});
|
||||||
|
dispatch(setUsersList(usersList));
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Error---------', error);
|
||||||
|
//dispatch(fetchDataRejected(error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
import { Member } from "../../core/Member";
|
||||||
|
import { Owner } from "../../core/Owner";
|
||||||
|
import { WaitingMember } from "../../core/WaitingMember";
|
||||||
|
|
||||||
|
export class DtoUserEcurie {
|
||||||
|
private owner: Owner;
|
||||||
|
private members: Member[];
|
||||||
|
private waitingMember: WaitingMember[];
|
||||||
|
|
||||||
|
constructor(owner: Owner, members: Member[], waitingMember: WaitingMember[]) {
|
||||||
|
this.owner = owner;
|
||||||
|
this.members = members;
|
||||||
|
this.waitingMember = waitingMember;
|
||||||
|
}
|
||||||
|
|
||||||
|
getOwner() {
|
||||||
|
return this.owner;
|
||||||
|
}
|
||||||
|
setOwner(owner: Owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMembers() {
|
||||||
|
return this.members;
|
||||||
|
}
|
||||||
|
setMembers(members: Member[]) {
|
||||||
|
this.members = members;
|
||||||
|
}
|
||||||
|
|
||||||
|
getWaitingMember() {
|
||||||
|
return this.waitingMember;
|
||||||
|
}
|
||||||
|
setWaitingMember(waitingMember: WaitingMember[]) {
|
||||||
|
this.waitingMember = waitingMember;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import { addXlsFile } from "../actions/sessions";
|
||||||
|
import { addNewTeam } from "../actions/teams";
|
||||||
|
import { FETCH_SESSIONS, FETCH_TEAMS, FETCH_USERS, ADD_TEAM, ADD_FILE } from "../Constants";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
teams: [],
|
||||||
|
users: [],
|
||||||
|
sessions: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const appReducer = (state = initialState, action: { type: any; payload: any; }) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case ADD_TEAM:
|
||||||
|
return { ...state, teams: [...state.teams, addNewTeam] };
|
||||||
|
case ADD_FILE:
|
||||||
|
return { ...state, sessions: [...state.sessions, addXlsFile] };
|
||||||
|
case FETCH_TEAMS:
|
||||||
|
return { ...state, teams: action.payload };
|
||||||
|
case FETCH_USERS:
|
||||||
|
return { ...state, users: action.payload };
|
||||||
|
case FETCH_SESSIONS:
|
||||||
|
return { ...state, sessions: action.payload };
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default appReducer;
|
@ -0,0 +1,256 @@
|
|||||||
|
import { BackgroundImage } from '@rneui/base';
|
||||||
|
import { StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';
|
||||||
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
|
import MapView, { MapCallout, Marker } from 'react-native-maps';
|
||||||
|
import React from 'react';
|
||||||
|
import TopBar from '../components/TopBar';
|
||||||
|
import { Point } from '../core/Point';
|
||||||
|
|
||||||
|
export default function Lap(props: { navigation: any, route : any}) {
|
||||||
|
const { currentLap } = props.route.params;
|
||||||
|
const { navigation } = props;
|
||||||
|
|
||||||
|
const points: Point[] = currentLap.getPoints();
|
||||||
|
points.sort((pt1, pt2) => pt1.getTimer() - pt2.getTimer());
|
||||||
|
|
||||||
|
|
||||||
|
const [currentPointIndex, setCurrentPointIndex] = React.useState(0);
|
||||||
|
const currentPoint: Point | undefined = points[currentPointIndex];
|
||||||
|
|
||||||
|
const goToPreviousPoint = () => {
|
||||||
|
if (currentPointIndex > 0) {
|
||||||
|
setCurrentPointIndex(currentPointIndex - 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const goToNextPoint = () => {
|
||||||
|
if (currentPointIndex < points.length - 1) {
|
||||||
|
setCurrentPointIndex(currentPointIndex + 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleMarker = (index : number) => {
|
||||||
|
setCurrentPointIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// currentLap.getPoints().forEach(pt => {
|
||||||
|
// points.push({ latitude: pt.getGeo().getGpsLat(), longitude: pt.getGeo().getGpsLong() });
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
//var currentLap : undefined; // Penser à vérifier si la session ne possède pas de tour !! si c'est le cas afficher une popup d'erreur
|
||||||
|
return (
|
||||||
|
<SafeAreaView style={styles.container}>
|
||||||
|
<View style={styles.container}>
|
||||||
|
{/* Header */}
|
||||||
|
<TopBar navigation={navigation} />
|
||||||
|
|
||||||
|
{/* Body */}
|
||||||
|
<View style={styles.container}>
|
||||||
|
|
||||||
|
<View style={styles.top_lap}>
|
||||||
|
<TouchableOpacity style={[styles.LapBrowserButton, currentPointIndex === 0 ? styles.disabled : null]} onPress={goToPreviousPoint}>
|
||||||
|
<View>
|
||||||
|
<Text style={styles.button_text} >Previous Point</Text>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<Text style={styles.text_title}>Point {currentPointIndex + 1 } </Text>
|
||||||
|
|
||||||
|
<TouchableOpacity style={[styles.LapBrowserButton, currentPointIndex === points.length - 1 ? styles.disabled : null]} onPress={goToNextPoint}>
|
||||||
|
<View>
|
||||||
|
<Text style={styles.button_text} >Next Point</Text>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.containerBody}>
|
||||||
|
<MapView
|
||||||
|
style={styles.map}
|
||||||
|
mapType="satellite"
|
||||||
|
region={{
|
||||||
|
latitude: currentLap.getLocationLat(),
|
||||||
|
longitude: currentLap.getLocationLong(),
|
||||||
|
latitudeDelta: 0.001,
|
||||||
|
longitudeDelta: 0.015,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{markers.map(({ id, name, coordinate,image }) => (
|
||||||
|
<Marker key={id} title={name} coordinate={coordinate} onPress={() => handleMarker(id)} icon={image} style={{ width: 1, height: 1 }} />
|
||||||
|
))}
|
||||||
|
|
||||||
|
|
||||||
|
</MapView>
|
||||||
|
<ScrollView style={ styles.scrollView}>
|
||||||
|
<BackgroundImage source={require('../assets/images/rdash.png')} resizeMode="contain" >
|
||||||
|
|
||||||
|
<View style={styles.container2}>
|
||||||
|
|
||||||
|
<Text style={styles.header}>Point { currentPointIndex + 1} / { points.length} of Lap {currentLap.getNumber()}</Text>
|
||||||
|
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>Time:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getFormattedTime()}</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>Distance:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getDistance()} m</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>Speed (vCar):</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getVCar()} km/h</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>nGear:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getNGear()} gear</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>pBreakF:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getPBreakF()} bar</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>aSteer:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getASteer()} deg</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>rPedal:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getRPedal()} %</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>gLong:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getGLong()} g</Text>
|
||||||
|
</View>
|
||||||
|
<View style={styles.infoContainer}>
|
||||||
|
<Text style={styles.infoItem}>gLat:</Text>
|
||||||
|
<Text style={styles.infoValue}>{currentPoint.getGLat()} g</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</BackgroundImage>
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
scrollView: {
|
||||||
|
flex:1,
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
opacity: 0.5,
|
||||||
|
},
|
||||||
|
addContainerButton: {
|
||||||
|
margin:5,
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
height: "8%",
|
||||||
|
borderRadius: 10,
|
||||||
|
elevation: 3,
|
||||||
|
backgroundColor: "#BF181F",
|
||||||
|
},
|
||||||
|
containerBody:{
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'stretch',
|
||||||
|
},
|
||||||
|
container2: {
|
||||||
|
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
||||||
|
borderColor:'black',
|
||||||
|
borderWidth:2,
|
||||||
|
padding: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
marginBottom: 20,
|
||||||
|
shadowColor: '#000',
|
||||||
|
shadowOffset: {
|
||||||
|
width: 0,
|
||||||
|
height: 2,
|
||||||
|
},
|
||||||
|
shadowOpacity: 0.25,
|
||||||
|
shadowRadius: 3.84,
|
||||||
|
elevation: 5,
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
infoContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
marginBottom: 5,
|
||||||
|
},
|
||||||
|
infoItem: {
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
infoValue: {
|
||||||
|
fontSize: 18,
|
||||||
|
},
|
||||||
|
map: {
|
||||||
|
flex:1,
|
||||||
|
},
|
||||||
|
top_lap: {
|
||||||
|
height: "8%",
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
backgroundImage: {
|
||||||
|
flex: 1,
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
LapBrowserButton: {
|
||||||
|
width: "30%",
|
||||||
|
marginTop:5,
|
||||||
|
marginBottom:5,
|
||||||
|
alignContent: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
backgroundColor: '#BF181F',
|
||||||
|
},
|
||||||
|
button_text: {
|
||||||
|
textAlign: 'center',
|
||||||
|
color: '#fff',
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
text_title: {
|
||||||
|
fontSize: 30,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button, Pressable } from 'react-native';
|
import { Pressable } from 'react-native';
|
||||||
import { StyleSheet, Text, View, Image } from 'react-native';
|
import { StyleSheet, Text, View, Image } from 'react-native';
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
|
|
||||||
export default function InfoTeam(props: { navigation: any }) {
|
export default function Team_Info(props: { navigation: any }) {
|
||||||
const { navigation } = props;
|
const { navigation } = props;
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={styles.container}>
|
<SafeAreaView style={styles.container}>
|
@ -0,0 +1,53 @@
|
|||||||
|
import { Geocalisation } from "../core/Geocalisation";
|
||||||
|
import { Lap } from "../core/Lap";
|
||||||
|
import { Member } from "../core/Member";
|
||||||
|
import { Owner } from "../core/Owner";
|
||||||
|
import { Point } from "../core/Point";
|
||||||
|
import { Session } from "../core/Session";
|
||||||
|
import { SessionType } from "../core/SessionType";
|
||||||
|
import { Team } from "../core/Team";
|
||||||
|
import { User } from "../core/User";
|
||||||
|
import { WaitingMember } from "../core/WaitingMember";
|
||||||
|
|
||||||
|
const owner1 = new Owner("eric","PASSWORD123","eric@gmail.com",[]);
|
||||||
|
const owner2 = new Owner("castor","PASSWORD123","castor@gmail.com",[]);
|
||||||
|
|
||||||
|
export const USERS1 : User[] = [
|
||||||
|
new Member("jean","PASSWORD123","jean@gmail.com",[]),
|
||||||
|
new WaitingMember("anas","PASSWORD123","anas@gmail.com",[]),
|
||||||
|
]
|
||||||
|
export const USERS2 : User[] = [
|
||||||
|
new Member("stickman","PASSWORD123","stickman@gmail.com",[]),
|
||||||
|
new Member("crapaud","PASSWORD123","crapaud@gmail.com",[]),
|
||||||
|
new WaitingMember("mcdo","PASSWORD123","mcdo@gmail.com",[]),
|
||||||
|
new WaitingMember("bucheron","PASSWORD123","bucheron@gmail.com",[]),
|
||||||
|
]
|
||||||
|
|
||||||
|
export const TEAMS : Team[] = [
|
||||||
|
new Team("La team 1",owner1, USERS1),
|
||||||
|
new Team("Bat INFO",owner2,USERS2)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
const geo1 = new Geocalisation(40.7128, -74.0060);
|
||||||
|
const geo2 = new Geocalisation(51.5074, -0.1278);
|
||||||
|
const geo3 = new Geocalisation(35.6895, 139.6917);
|
||||||
|
|
||||||
|
|
||||||
|
const point1 = new Point(geo1, 120, 10, 3, 50, 90, 20, 10, 20, 100);
|
||||||
|
const point2 = new Point(geo2, 130, 15, 4, 60, 100, 30, 15, 25, 120);
|
||||||
|
const point3 = new Point(geo3, 140, 20, 5, 70, 110, 40, 20, 30, 140);
|
||||||
|
|
||||||
|
|
||||||
|
const lap1 = new Lap(1, [point1, point2], 250);
|
||||||
|
const lap2 = new Lap(2, [point2, point3], 300);
|
||||||
|
const lap3 = new Lap(3, [point3, point1], 350);
|
||||||
|
|
||||||
|
|
||||||
|
const session1 = new Session("First Session", [lap1, lap2], SessionType.PrivateTest);
|
||||||
|
const session2 = new Session("Second Session", [lap2, lap3], SessionType.Qualification);
|
||||||
|
const session3 = new Session("Third Session", [lap3, lap1], SessionType.Unknown);
|
||||||
|
|
||||||
|
export const SESSIONS : Session[] = [
|
||||||
|
session1,session2,session3
|
||||||
|
]
|
Loading…
Reference in new issue