diff --git a/src/hooks/teams.js b/src/hooks/teams.js index 17fc42f3..fb6c1e03 100644 --- a/src/hooks/teams.js +++ b/src/hooks/teams.js @@ -12,7 +12,7 @@ export const useTeam = (id, initialData) => { } export const useTeams = () => { - const query = useFirestore().collection('teams') + const query = useFirestore().collection('teams').orderBy('winOdd') return useFirestoreCollection(query, { initialData: [] }).data?.docs } diff --git a/src/screens/HomePage/Winner/Winner.jsx b/src/screens/HomePage/FinalWinner/FinalWinner.jsx similarity index 75% rename from src/screens/HomePage/Winner/Winner.jsx rename to src/screens/HomePage/FinalWinner/FinalWinner.jsx index 729932ad..ca58c70e 100644 --- a/src/screens/HomePage/Winner/Winner.jsx +++ b/src/screens/HomePage/FinalWinner/FinalWinner.jsx @@ -3,10 +3,10 @@ import CardContent from '@material-ui/core/CardContent' import Typography from '@material-ui/core/Typography' import React, { Suspense } from 'react' import { useSelectedWinner } from '../../../hooks' -import './Winner.scss' -import WinnerChoice from './WinnerChoice' +import './FinalWinner.scss' +import FinalWinnerChoice from './FinalWinnerChoice' -const Winner = () => { +const FinalWinner = () => { const [team, saveWinner] = useSelectedWinner() const handleChange = (e) => { @@ -28,15 +28,15 @@ const Winner = () => { }> - + ) } -Winner.propTypes = {} +FinalWinner.propTypes = {} -Winner.defaultProps = {} +FinalWinner.defaultProps = {} -export default Winner +export default FinalWinner diff --git a/src/screens/HomePage/Winner/Winner.scss b/src/screens/HomePage/FinalWinner/FinalWinner.scss similarity index 100% rename from src/screens/HomePage/Winner/Winner.scss rename to src/screens/HomePage/FinalWinner/FinalWinner.scss diff --git a/src/screens/HomePage/Winner/WinnerChoice/WinnerChoice.jsx b/src/screens/HomePage/FinalWinner/FinalWinnerChoice/FinalWinnerChoice.jsx similarity index 78% rename from src/screens/HomePage/Winner/WinnerChoice/WinnerChoice.jsx rename to src/screens/HomePage/FinalWinner/FinalWinnerChoice/FinalWinnerChoice.jsx index 5dd32b86..d9c1f8b3 100644 --- a/src/screens/HomePage/Winner/WinnerChoice/WinnerChoice.jsx +++ b/src/screens/HomePage/FinalWinner/FinalWinnerChoice/FinalWinnerChoice.jsx @@ -10,14 +10,14 @@ import React from 'react' import { COMPETITION_START_DATE } from '../../../../shared' import Flag from '../../../../components/Flag' import { useTeams } from '../../../../hooks' -import './WinnerChoice.scss' +import './FinalWinnerChoice.scss' -const WinnerChoice = ({ userTeam, onValueChange }) => { +const FinalWinnerChoice = ({ userTeam, onValueChange }) => { const teams = useTeams() return (
- {FlagTest(teams, userTeam)} + {FlagDisplay(teams, userTeam)}
- {OddTest(teams, userTeam)} + {OddDisplay(teams, userTeam)}
) } // Affichage du drapeau du pays choisi -const FlagTest = (teams, userTeam) => { +const FlagDisplay = (teams, userTeam) => { const teamDisplayed = find(teams, (team) => team.id === userTeam) + console.log(teamDisplayed) + return ( teamDisplayed && ( { } // Affichage de la cote du pays choisi -const OddTest = (teams, userTeam) => { +const OddDisplay = (teams, userTeam) => { const teamDisplayed = find(teams, (team) => team.id === userTeam) return ( teamDisplayed && ( - - {teamDisplayed.winOdd} + + {teamDisplayed.data().winOdd} ) ) } -WinnerChoice.defaultProps = { +FinalWinnerChoice.defaultProps = { teams: [], } -WinnerChoice.propTypes = { +FinalWinnerChoice.propTypes = { teams: PropTypes.arrayOf(PropTypes.shape({})), userTeam: PropTypes.string, onValueChange: PropTypes.func.isRequired, } -export default WinnerChoice +export default FinalWinnerChoice diff --git a/src/screens/HomePage/Winner/WinnerChoice/WinnerChoice.scss b/src/screens/HomePage/FinalWinner/FinalWinnerChoice/FinalWinnerChoice.scss similarity index 100% rename from src/screens/HomePage/Winner/WinnerChoice/WinnerChoice.scss rename to src/screens/HomePage/FinalWinner/FinalWinnerChoice/FinalWinnerChoice.scss diff --git a/src/screens/HomePage/FinalWinner/FinalWinnerChoice/index.js b/src/screens/HomePage/FinalWinner/FinalWinnerChoice/index.js new file mode 100644 index 00000000..3ece7cc4 --- /dev/null +++ b/src/screens/HomePage/FinalWinner/FinalWinnerChoice/index.js @@ -0,0 +1 @@ +export { default } from './FinalWinnerChoice' diff --git a/src/screens/HomePage/FinalWinner/index.js b/src/screens/HomePage/FinalWinner/index.js new file mode 100644 index 00000000..beeb10b3 --- /dev/null +++ b/src/screens/HomePage/FinalWinner/index.js @@ -0,0 +1 @@ +export { default } from './FinalWinner' diff --git a/src/screens/HomePage/HomePage.jsx b/src/screens/HomePage/HomePage.jsx index 377089d6..7358db20 100644 --- a/src/screens/HomePage/HomePage.jsx +++ b/src/screens/HomePage/HomePage.jsx @@ -18,7 +18,7 @@ import React from 'react' import { AuthCheck } from 'reactfire' import myImage from '../../assets/visuels/bandeauEvenement2.webp' import './HomePage.scss' -import Winner from './Winner' +import FinalWinner from './FinalWinner' const HomePage = ({ history }) => { return ( @@ -82,7 +82,7 @@ const HomePage = ({ history }) => { - + Home diff --git a/src/screens/HomePage/Winner/WinnerChoice/index.js b/src/screens/HomePage/Winner/WinnerChoice/index.js deleted file mode 100644 index 2a3a9ca3..00000000 --- a/src/screens/HomePage/Winner/WinnerChoice/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './WinnerChoice' diff --git a/src/screens/HomePage/Winner/index.js b/src/screens/HomePage/Winner/index.js deleted file mode 100644 index 62c36b8b..00000000 --- a/src/screens/HomePage/Winner/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Winner'