Avancement team info

Backend/Page/Team_Browser
mohamed 2 years ago
parent 5123771c8d
commit b9eb0b5444

@ -7,7 +7,7 @@ import LoginStack from './navigation/LoginStack';
import Navigation from './navigation/Navigation'; import Navigation from './navigation/Navigation';
import ChangePassword from './screens/ChangePassword'; import ChangePassword from './screens/ChangePassword';
import CreateTeam from './screens/CreateTeam'; import CreateTeam from './screens/CreateTeam';
import InfoTeam from './screens/InfoTeam'; import Team_Info from './screens/Team_Info';
import Login from './screens/Login'; import Login from './screens/Login';
import ManageAccount from './screens/ManageAccount'; import ManageAccount from './screens/ManageAccount';
import NewTrack from './screens/NewTrack'; import NewTrack from './screens/NewTrack';

@ -1,16 +1,20 @@
import { View,Image,Text, StyleSheet } from "react-native"; 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"; import { Team } from "../core/Team";
type TeamListItemProps = { type TeamListItemProps = {
team: Team; team: Team;
onPress: (team: Team) => void;
} }
export default function TeamListItem(props: TeamListItemProps) { export default function TeamListItem(props: TeamListItemProps) {
return ( return (
<View style={styles.container}> <TouchableOpacity style={styles.container}
onPress={()=> props.onPress(props.team)}>
<Image style={styles.teaserImage} source={props.team.getLogo()} /> <Image style={styles.teaserImage} source={props.team.getLogo()} />
<Text style={styles.text_style}> {props.team.getName()}</Text> <Text style={styles.text_style}> {props.team.getName()}</Text>
</View> </TouchableOpacity>
) )
} }
@ -21,7 +25,7 @@ type TeamListItemProps = {
padding:10, padding:10,
flex: 1, flex: 1,
flexDirection: "row", flexDirection: "row",
marginTop:10, marginBottom:10,
}, },
text_style:{ text_style:{
marginLeft:15, marginLeft:15,

@ -1,6 +1,6 @@
import { createStackNavigator } from "@react-navigation/stack"; import { createStackNavigator } from "@react-navigation/stack";
import CreateTeam from "../screens/CreateTeam"; import CreateTeam from "../screens/CreateTeam";
import InfoTeam from "../screens/InfoTeam"; import Team_Info from "../screens/Team_Info";
import Team_Browser from "../screens/Team_Browser"; import Team_Browser from "../screens/Team_Browser";
import Team_Selection from "../screens/Team_Selection"; import Team_Selection from "../screens/Team_Selection";
@ -10,7 +10,7 @@ export default function TeamInfoStack() {
return ( return (
<Stack.Navigator initialRouteName="Home" screenOptions={{ headerShown: false }}> <Stack.Navigator initialRouteName="Home" screenOptions={{ headerShown: false }}>
<Stack.Screen name="Home" component={Team_Browser} /> <Stack.Screen name="Home" component={Team_Browser} />
<Stack.Screen name="Info" component={InfoTeam} /> <Stack.Screen name="Info" component={Team_Info} />
</Stack.Navigator> </Stack.Navigator>
) )
} }

@ -3,6 +3,7 @@ import { FlatList, StyleSheet, Text, View, Image, TouchableOpacity } from 'react
import { SafeAreaView } from 'react-native-safe-area-context'; import { SafeAreaView } from 'react-native-safe-area-context';
import MapView from 'react-native-maps'; import MapView from 'react-native-maps';
import PROVIDER_OPENSTREETMAP, { Marker } from 'react-native-maps'; import PROVIDER_OPENSTREETMAP, { Marker } from 'react-native-maps';
import React from 'react';
export default function Lap() { export default function Lap() {

@ -3,7 +3,7 @@ import React from 'react';
import { Button, Pressable } from 'react-native'; import { Button, Pressable } from 'react-native';
import { StyleSheet, Text, View, Image, TextInput } from 'react-native'; import { StyleSheet, Text, View, Image, TextInput } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context'; import { SafeAreaView } from 'react-native-safe-area-context';
import { AsyncStorage } from 'react-native'; // import { AsyncStorage } from 'react-native';
export default function Login(props: { navigation: any }) { export default function Login(props: { navigation: any }) {
@ -26,7 +26,7 @@ export default function Login(props: { navigation: any }) {
const secretKey = 'SECRET'; // appele API pour récupérer une clé secrete const secretKey = 'SECRET'; // appele API pour récupérer une clé secrete
const handleLogin = () => { const handleLogin = () => {
const isCorrect = false // envoi email + password a l'API, retour bool de l'API const isCorrect = true // envoi email + password a l'API, retour bool de l'API
// If the email and password are correct, generate a JWT // If the email and password are correct, generate a JWT
if(isCorrect){ if(isCorrect){

@ -1,24 +1,26 @@
import { Button, FlatList, Pressable, StyleSheet, Text, View } from 'react-native'; import { FlatList, StyleSheet, Text, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context'; import { SafeAreaView } from 'react-native-safe-area-context';
import { SearchBar } from '@rneui/base'; import { SearchBar } from '@rneui/base';
import { TouchableHighlight } from 'react-native-gesture-handler'; import React, { useState } from 'react';
import React from 'react';
import { TEAMS } from '../stub/stub'; import { TEAMS } from '../stub/stub';
import TeamListItem from '../components/TeamCmp'; import TeamListItem from '../components/TeamCmp';
import { Team } from '../core/Team';
export default function Team_Browser(props: { navigation: any }) { export default function Team_Browser(props: { navigation: any }) {
const { navigation } = props; const { navigation } = props;
const state = { const [search, setSearch] = useState('');
search: '',
};
const updateSearch = (search: string) => { const handlePress = (item: Team) => {
state.search=search; setSearch('');
navigation.navigate('Info', { "": item }); // A revoir
}; };
const { search } = state; const filteredData = search !== '' ? TEAMS.filter((item) =>
item.getName().toLowerCase().includes(search.toLowerCase())
) : TEAMS;
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
@ -27,10 +29,12 @@ export default function Team_Browser(props: { navigation: any }) {
<SearchBar <SearchBar
platform="default" platform="default"
lightTheme lightTheme
value={search}
onChangeText={setSearch}
/> />
<FlatList <FlatList
data={TEAMS} data={filteredData}
renderItem={({ item }) => <TeamListItem team={item} />} /> renderItem={({ item }) => <TeamListItem team={item} onPress={handlePress}/>} />
</View> </View>
</SafeAreaView> </SafeAreaView>

@ -3,7 +3,7 @@ import { Button, 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}>
Loading…
Cancel
Save