deletion of redundant files, semicolon and small fixes

This commit is contained in:
Stachu 2023-03-16 19:06:03 +01:00
parent 25d65b2db4
commit ed2ba3ebdc
3 changed files with 23 additions and 24 deletions

View File

@ -1,6 +1,5 @@
import { TruckId } from "./Truck"; import { TruckId } from "./Truck";
import { AppContext } from './AppContext'; import React, {useEffect} from 'react';
import React, {useContext, useEffect, useState} from 'react';
import { ButtonShowCorrectAnswer } from "./GetImageAndQuestion"; import { ButtonShowCorrectAnswer } from "./GetImageAndQuestion";
export let EndCacheId = ""; export let EndCacheId = "";
export let EndCorrectAnswer = ""; export let EndCorrectAnswer = "";
@ -8,20 +7,20 @@ export let EndCorrectAnswer = "";
const FetchData = ({isClick,score,setIsClick,setScore,navigate}) => { const FetchData = ({isClick,score,setIsClick,setScore,navigate}) => {
useEffect(() => {
useEffect(() => { fetch(`/random-question?fire-truck=${TruckId}`)
fetch(`/random-question?fire-truck=${TruckId}`) .then(res => res.json())
.then(res => res.json()) .then(dataQuestion => {
.then(dataQuestion => { if(isClick){
if(isClick) { const propertValuesObjectFromDb = Object.values(dataQuestion);
const propertValuesObjectFromDb = Object.values(dataQuestion); EndCorrectAnswer = propertValuesObjectFromDb[1];
EndCorrectAnswer = propertValuesObjectFromDb[1]; EndCacheId = propertValuesObjectFromDb[0];
}
EndCacheId = propertValuesObjectFromDb[0];
}
})
}) })
});
@ -30,7 +29,7 @@ const FetchData = ({isClick,score,setIsClick,setScore,navigate}) => {
<div className="questionDiv"> <div className="questionDiv">
<h1 className='questionText1'>{EndCorrectAnswer}</h1> <h1 className='questionText1'>{EndCorrectAnswer}</h1>
<button onClick={() => ButtonShowCorrectAnswer(isClick, setIsClick , score , setScore, navigate)} className='NextQuestionButton'>{isClick ? "Pokaż odpowiedź" : "Następne pytanie"}</button> <button onClick={() => ButtonShowCorrectAnswer(isClick, setIsClick , score , setScore, navigate)} className='NextQuestionButton'>{isClick ? "Pokaż odpowiedź":"Następne pytanie"}</button>
</div> </div>
</> </>
@ -40,7 +39,13 @@ const FetchData = ({isClick,score,setIsClick,setScore,navigate}) => {
export const QuizGetQuestion = ({score,isClick,setScore,setIsClick,navigate}) => { export const QuizGetQuestion = ({score,isClick,setScore,setIsClick,navigate}) => {
return ( return (
<FetchData score = {score} isClick = {isClick} setScore = {setScore} setIsClick = {setIsClick} navigate = {navigate}/> <FetchData
score = {score}
isClick = {isClick}
setScore = {setScore}
setIsClick = {setIsClick}
navigate = {navigate}
/>
) )
} }

View File

@ -48,7 +48,7 @@ const Result = () => {
textColor : 'black' , textColor : 'black' ,
trailColor : '#c6c4c4' , trailColor : '#c6c4c4' ,
backgroundColor : '#d42436' , backgroundColor : '#d42436' ,
} ) } />; } ) } />
</div> </div>
<h3 className='textDependsEndScore'>{{endScore}/10 < 9 ? "Jesteś szybki.. ale pożar jest szybszy" : "Brawo udało ci się ugasić pożar !!!"}</h3> <h3 className='textDependsEndScore'>{{endScore}/10 < 9 ? "Jesteś szybki.. ale pożar jest szybszy" : "Brawo udało ci się ugasić pożar !!!"}</h3>

View File

@ -1,6 +0,0 @@
const Player = ({ url }) => {
const audio = new Audio(url);
const play = audio.play();
};
export default Player;