diff --git a/components/gamescreen/GameCard.jsx b/components/gamescreen/GameCard.jsx index 71038b1..8300bb5 100644 --- a/components/gamescreen/GameCard.jsx +++ b/components/gamescreen/GameCard.jsx @@ -8,7 +8,7 @@ const GameCard = ({ isLoading, players, questions, currentQuestionIndex }) => { return ( {!isLoading && questions.length > 0 && players.length > 0 ? ( (() => { diff --git a/components/gamescreen/InfoBloc.jsx b/components/gamescreen/InfoBloc.jsx new file mode 100644 index 0000000..1a5176a --- /dev/null +++ b/components/gamescreen/InfoBloc.jsx @@ -0,0 +1,16 @@ +import React from "react"; +import { View, Text } from "react-native"; +import { InformationCircleIcon } from "react-native-heroicons/solid"; + +const InfoBloc = ({ info }) => { + return ( + + + + {info} + + + ); +}; + +export default InfoBloc; \ No newline at end of file diff --git a/components/gamescreen/ProgressBar.jsx b/components/gamescreen/ProgressBar.jsx index b1e0c30..e39d552 100644 --- a/components/gamescreen/ProgressBar.jsx +++ b/components/gamescreen/ProgressBar.jsx @@ -5,17 +5,13 @@ import * as Progress from "react-native-progress"; const ProgressBar = ({ currentQuestionIndex, questions }) => { return ( - - Progression - ); diff --git a/components/settingscreen/SuggestionModal.jsx b/components/settingscreen/SuggestionModal.jsx index d1db5e7..77b110f 100644 --- a/components/settingscreen/SuggestionModal.jsx +++ b/components/settingscreen/SuggestionModal.jsx @@ -4,14 +4,16 @@ import { XCircleIcon } from "react-native-heroicons/solid"; const SuggestionModal = ({ showModal, setShowModal }) => { const [suggestion, setSuggestion] = React.useState(""); + const [isSubmitting, setIsSubmitting] = React.useState(false); const handleChange = (text) => { setSuggestion(text); }; const handleSubmit = () => { + setIsSubmitting(true); console.log("Submitted suggestion"); - setShowModal(false); // Fermer la modale après soumission + setShowModal(false); // Close the modal after submission }; return ( @@ -26,7 +28,7 @@ const SuggestionModal = ({ showModal, setShowModal }) => { > {/* Modale centrée */} - + setShowModal(false)} className="self-end"> @@ -45,8 +47,11 @@ const SuggestionModal = ({ showModal, setShowModal }) => { onChangeText={handleChange} value={suggestion} /> - - Envoyer + + {isSubmitting ? "Envoi en cours..." : "Envoyer"} diff --git a/package.json b/package.json index fca97f6..7ee8b7d 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "expo": "~51.0.38", "expo-application": "~5.9.1", "expo-asset": "~10.0.10", - "expo-dev-client": "~4.0.28", + "expo-dev-client": "~4.0.29", "expo-insights": "~0.7.0", "expo-status-bar": "~1.12.1", "mongodb": "^6.3.0", diff --git a/screens/Gamescreen.js b/screens/Gamescreen.js index 032d219..c600bf3 100644 --- a/screens/Gamescreen.js +++ b/screens/Gamescreen.js @@ -13,6 +13,7 @@ import GamescreenHeader from "../components/gamescreen/GamescreenHeader"; import ProgressBar from "../components/gamescreen/ProgressBar"; import GameCard from "../components/gamescreen/GameCard"; import NextRoundButton from "../components/gamescreen/NextRoundButton"; +import InfoBloc from "../components/gamescreen/InfoBloc"; export default function Gamescreen() { const [isLoading, setIsLoading] = useState(false); @@ -29,7 +30,7 @@ export default function Gamescreen() { const fetchQuestionsAndPlayers = async () => { setIsLoading(true); try { - let { data: questionsData, error } = await supabase.from("questionsV3").select("Theme, Questions, severity"); + let { data: questionsData, error } = await supabase.from("questionsV4").select("Theme, Questions, severity, Instructions"); if (error) throw error; if (!Array.isArray(questionsData)) { @@ -37,21 +38,24 @@ export default function Gamescreen() { } const shuffledQuestions = shuffledArray(questionsData); - setQuestions(shuffledQuestions); + + // Limit the questions to 45 + const limitedQuestions = shuffledQuestions.slice(0, 45); + setQuestions(limitedQuestions); // Fetch players from AsyncStorage const playerData = await AsyncStorage.getItem("players"); let parsedPlayers = JSON.parse(playerData) || []; - + parsedPlayers = parsedPlayers.map(player => ({ ...player, score: player.score || 0 // Initialize score if not present })); - + if (!Array.isArray(parsedPlayers)) { throw new TypeError("Parsed players data is not an array"); } - + const shuffledPlayers = shuffledArray(parsedPlayers); setPlayers(shuffledPlayers); } catch (error) { @@ -86,7 +90,6 @@ export default function Gamescreen() { } if (currentQuestionIndex + 1 >= questions.length) { - // No more questions, navigate to Endscreen or reset for a new game navigation.navigate("End", { players }); } else { // Increment index to move to the next question @@ -106,6 +109,7 @@ export default function Gamescreen() { +