Skip to content

Commit

Permalink
core(gamescreen): replace secret and fix button (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
arenault-pass authored Apr 12, 2024
1 parent 5893f20 commit 6e2eb14
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 12 deletions.
6 changes: 4 additions & 2 deletions eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"version": ">= 7.1.2"
},
"build": {
"development": {
"development-simulator": {
"developmentClient": true,
"distribution": "internal"
"ios": {
"simulator": true
}
},
"preview": {
"ios": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@react-navigation/native-stack": "^6.9.17",
"eas-cli": "^7.3.0",
"expo": "~49.0.15",
"expo-dev-client": "~2.4.13",
"expo-status-bar": "~1.6.0",
"mongodb": "^6.3.0",
"mongoose": "^8.2.0",
Expand Down
24 changes: 14 additions & 10 deletions screens/Gamescreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { HomeIcon } from "react-native-heroicons/solid";
import { useNavigation } from "@react-navigation/native";
import * as Progress from "react-native-progress";
import { useImage } from "../provider/ImageContext";
import {API_BASE_URL} from "@env"

export default function Gamescreen() {
const [isLoading, setIsLoading] = useState(false);
Expand All @@ -23,6 +22,9 @@ export default function Gamescreen() {
const [players, setPlayers] = useState([]);
const { backgroundImageSource } = useImage();


const apiUrl = process.env.API_BASE_URL;

useEffect(() => {
fetchQuestionsAndPlayers();
}, []); // Fetch questions and players initially
Expand All @@ -31,7 +33,7 @@ export default function Gamescreen() {
setIsLoading(true);
try {
// Fetch and shuffle questions
const questionsResponse = await fetch(`${API_BASE_URL}/api/questions`);
const questionsResponse = await fetch(`${apiUrl}/api/questions`);
const questionsData = await questionsResponse.json();
const shuffledQuestions = shuffledArray(questionsData);
setQuestions(shuffledQuestions);
Expand Down Expand Up @@ -60,14 +62,16 @@ export default function Gamescreen() {
};

const handleNextRound = () => {
if (currentQuestionIndex + 1 >= questions.length) {
// No more questions, navigate to Endscreen or reset for a new game
navigation.navigate("End");
} else {
// Increment index to move to the next question
setCurrentQuestionIndex(currentQuestionIndex + 1);
}

if (currentQuestionIndex + 1 >= questions.length) {
// No more questions, navigate to Endscreen or reset for a new game
navigation.navigate("End");
} else {
// Increment index to move to the next question
setCurrentQuestionIndex(currentQuestionIndex + 1);
}
};


const navigation = useNavigation();
const goToHomescreen = () => {
Expand Down Expand Up @@ -157,7 +161,7 @@ export default function Gamescreen() {
<View className="flex justify-center items-center ">
<TouchableOpacity
onPress={handleNextRound}
className=" bg-white w-40 px-4 py-4 border-solid rounded-lg mt-4 justify-center align-items-center"
className="bg-white w-40 px-4 py-4 border-solid rounded-lg mt-4 justify-center align-items-center"
>
<Text className="text-cyan-900 text-sm text-center font-bold">
TOUR SUIVANT
Expand Down
58 changes: 58 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4753,6 +4753,47 @@ expo-constants@~14.4.2:
"@expo/config" "~8.1.0"
uuid "^3.3.2"

expo-dev-client@~2.4.13:
version "2.4.13"
resolved "https://registry.yarnpkg.com/expo-dev-client/-/expo-dev-client-2.4.13.tgz#cf8c829e2f815b273db44c17e513d5410af5b7fa"
integrity sha512-EBNJlPntw+DZy7mKxYvpdrmE2GU4YjcEpxSLpwNn2GDwy7e2xXAC2k/25E13BGy3yKPLo1iBXNgB01uleIDdVg==
dependencies:
expo-dev-launcher "2.4.15"
expo-dev-menu "3.2.4"
expo-dev-menu-interface "1.3.0"
expo-manifests "~0.7.0"
expo-updates-interface "~0.10.0"

expo-dev-launcher@2.4.15:
version "2.4.15"
resolved "https://registry.yarnpkg.com/expo-dev-launcher/-/expo-dev-launcher-2.4.15.tgz#298ac56b523f77c40523453224f75dcc894198bc"
integrity sha512-6oF4NsxlKwuafnyIZvVtMp4OTxRu4Arsw6qJ9s4jDjZuGJtGwgEj9ux3R0YLkDPs8xhsK9Awp0q17RqbQzs1qg==
dependencies:
expo-dev-menu "3.2.3"
resolve-from "^5.0.0"
semver "^7.5.3"

expo-dev-menu-interface@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/expo-dev-menu-interface/-/expo-dev-menu-interface-1.3.0.tgz#51b6be8c6e0ce73e414ac7a545998dfad0dfdb80"
integrity sha512-WtRP7trQ2lizJJTTFXUSGGn1deIeHaYej0sUynvu/uC69VrSP4EeSnYOxbmEO29kuT/MsQBMGu0P/AkMQOqCOg==

expo-dev-menu@3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/expo-dev-menu/-/expo-dev-menu-3.2.3.tgz#31c102251d94e9a35fac667cefdbaeae7b1e1375"
integrity sha512-DneF3okTC4AAfAZgaOIylQ/UngSO8SnUT6bRV6nHhJU/jQS1OIP1cZoNW23I100+2yj6x6mobL21PxyiI5VA8g==
dependencies:
expo-dev-menu-interface "1.3.0"
semver "^7.5.3"

expo-dev-menu@3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/expo-dev-menu/-/expo-dev-menu-3.2.4.tgz#25ba1efe70bf74ab2d7804eab54212785cd2a01a"
integrity sha512-jPvEY4xGTsiVL6A8M6xThNG+tgCHKlDaWqmWHT+wy2EXgFf/7zE0daVYoFms0KJ1XtZc+/DmDRgIPTR86qIGTg==
dependencies:
expo-dev-menu-interface "1.3.0"
semver "^7.5.3"

expo-file-system@~15.4.0, expo-file-system@~15.4.5:
version "15.4.5"
resolved "https://registry.npmjs.org/expo-file-system/-/expo-file-system-15.4.5.tgz"
Expand All @@ -4767,11 +4808,23 @@ expo-font@~11.4.0:
dependencies:
fontfaceobserver "^2.1.0"

expo-json-utils@~0.7.0:
version "0.7.1"
resolved "https://registry.yarnpkg.com/expo-json-utils/-/expo-json-utils-0.7.1.tgz#efe315c982113204be46419cbc26d4d9a2af145f"
integrity sha512-L0lyH8diXQtV0q5BLbFlcoxTqPF5im79xDHPhybB0j36xYdm65hjwRJ4yMrPIN5lR18hj48FUZeONiDHRyEvIg==

expo-keep-awake@~12.3.0:
version "12.3.0"
resolved "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-12.3.0.tgz"
integrity sha512-ujiJg1p9EdCOYS05jh5PtUrfiZnK0yyLy+UewzqrjUqIT8eAGMQbkfOn3C3fHE7AKd5AefSMzJnS3lYZcZYHDw==

expo-manifests@~0.7.0:
version "0.7.2"
resolved "https://registry.yarnpkg.com/expo-manifests/-/expo-manifests-0.7.2.tgz#77c2d9476e8130fc9ca6d4274fa1a5495d34358e"
integrity sha512-xlhL0XI2zw3foJ0q2Ra4ieBhU0V2yz+Rv6GpVEaaIHFlIC/Dbx+mKrX5dgenZEMERr/MG7sRJaRbAVB2PaAYhA==
dependencies:
expo-json-utils "~0.7.0"

expo-modules-autolinking@1.5.1:
version "1.5.1"
resolved "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-1.5.1.tgz"
Expand All @@ -4797,6 +4850,11 @@ expo-status-bar@~1.6.0:
resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.6.0.tgz#e79ffdb9a84d2e0ec9a0dc7392d9ab364fefa9cf"
integrity sha512-e//Oi2WPdomMlMDD3skE4+1ZarKCJ/suvcB4Jo/nO427niKug5oppcPNYO+csR6y3ZglGuypS+3pp/hJ+Xp6fQ==

expo-updates-interface@~0.10.0:
version "0.10.1"
resolved "https://registry.yarnpkg.com/expo-updates-interface/-/expo-updates-interface-0.10.1.tgz#cab075641cd381718ccd9264bf133dc393430a44"
integrity sha512-I6JMR7EgjXwckrydDmrkBEX/iw750dcqpzQVsjznYWfi0HTEOxajLHB90fBFqQkUV5i5s4Fd3hYQ1Cn0oMzUbA==

expo@~49.0.15:
version "49.0.21"
resolved "https://registry.npmjs.org/expo/-/expo-49.0.21.tgz"
Expand Down

0 comments on commit 6e2eb14

Please sign in to comment.