Skip to content

Comments

Twobet#59307

Closed
fabiolemaire3-cmyk wants to merge 1 commit intonodejs:mainfrom
fabiolemaire3-cmyk:patch-1
Closed

Twobet#59307
fabiolemaire3-cmyk wants to merge 1 commit intonodejs:mainfrom
fabiolemaire3-cmyk:patch-1

Conversation

@fabiolemaire3-cmyk
Copy link

screens/Matchs.js

import React from 'react';
import { View, Text, FlatList} from 'react-native';
import PariForm from '../components/PariForm';

const matchs = [
  { id: 1, equipes: 'LOME FC vs KARA FC', cotes: { LOME: 2.1, NUL: 3.2, KARA: 3.1}},
  { id: 2, equipes: 'REAL vs BARÇA', cotes: { REAL: 2.5, NUL: 3.3, BARÇA: 2.8}}
];

export default function Matchs() {
  return (
    <View style={{ padding: 20}}>
      <Text style={{ fontSize: 20, marginBottom: 10}}>Matchs disponibles</Text>
      <FlatList
        data={matchs}
        keyExtractor={(item) => item.id.toString()}
        renderItem={({ item}) => (
          <View style={{ marginBottom: 20}}>
            <Text>{item.equipes}</Text>
            <PariForm matchId={item.id} cotes={item.cotes} />
          </View>
)}
      />
    </View>
);
}

screens/Historique.js

import React, { useEffect, useState} from 'react';
import { View, Text, FlatList} from 'react-native';

export default function Historique() {
  const [historique, setHistorique] = useState([]);

  useEffect(() => {
    fetch('https://twobet-backend.com/api/paris/historique')
.then((res) => res.json())
.then((data) => setHistorique(data));
}, []);

  return (
    <View style={{ padding: 20}}>
      <Text style={{ fontSize: 20, marginBottom: 10}}>Historique des paris</Text>
      <FlatList
        data={historique}
        keyExtractor={(item, index) => index.toString()}
        renderItem={({ item}) => (
          <View style={{ marginBottom: 10}}>
            <Text>{item.match} | Choix: {item.choix} | Mise: {item.montant} | Gain: {item.gainPotentiel}</Text>
          </View>
)}
      />
    </View>
);
}

screens/Connexion.js

import React, { useState} from 'react';
import { View, TextInput, Button, Text} from 'react-native';
import { auth} from '../utils/firebase';
import { signInWithEmailAndPassword} from 'firebase/auth';

export default function Connexion({ navigation}) {
  const [email, setEmail] = useState('');
  const [motDePasse, setMotDePasse] = useState('');

  const handleLogin = () => {
    signInWithEmailAndPassword(auth, email, motDePasse)
.then(() => navigation.navigate('Accueil'))
.catch(() => alert('Échec de connexion'));
};

  return (
    <View style={{ padding: 20}}>
      <Text style={{ fontSize: 20, marginBottom: 10}}>Connexion</Text>
      <TextInput placeholder="Email" value={email} onChangeText={setEmail} style={{ marginBottom: 10}} />
      <TextInput placeholder="Mot de passe" value={motDePasse} onChangeText={setMotDePasse} secureTextEntry style={{ marginBottom: 10}} />
      <Button title="Se connecter" onPress={handleLogin} />
    </View>
);
}

@jasnell jasnell closed this Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants