Make call API 2
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 1.1 KiB |
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#f5f6fa" d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/><path fill="none" d="M0 0h24v24H0V0z"/></svg>
|
|
Before Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 11 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 4.1 MiB |
Before Width: | Height: | Size: 4.0 MiB |
Before Width: | Height: | Size: 9.0 MiB |
Before Width: | Height: | Size: 17 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 12 MiB |
Before Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 123 KiB |
Before Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 926 KiB |
Before Width: | Height: | Size: 926 KiB |
Before Width: | Height: | Size: 926 KiB |
Before Width: | Height: | Size: 926 KiB |
@ -3,14 +3,9 @@ import React, {useContext} from 'react';
|
|||||||
import { AppContext } from './AppContext';
|
import { AppContext } from './AppContext';
|
||||||
|
|
||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
import {useState, useEffect} from 'react';
|
|
||||||
import FooterQuiz from './FooterQuiz';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const BottomFPage = () => {
|
const BottomFPage = () => {
|
||||||
|
|
||||||
|
|
||||||
const {unitOsp} = useContext(AppContext);
|
const {unitOsp} = useContext(AppContext);
|
||||||
|
|
||||||
|
|
||||||
@ -22,18 +17,10 @@ const BottomFPage = () => {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{buttonShow}
|
{buttonShow}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {useNavigate} from 'react-router-dom';
|
import {useNavigate} from 'react-router-dom';
|
||||||
import React, {useState, useContext} from 'react';
|
import React, {useState} from 'react';
|
||||||
import {QuizGetQuestion } from './GetQuestion';
|
import {QuizGetQuestion } from './GetQuestion';
|
||||||
import { QuizGetImage } from './GetImageAndQuestion';
|
import { QuizGetImage } from './GetImageAndQuestion';
|
||||||
import AppProvider, { AppContext } from './AppContext';
|
import AppProvider, { AppContext } from './AppContext';
|
||||||
@ -14,7 +14,7 @@ export let endScore = 0;
|
|||||||
|
|
||||||
const NavigationQuiz = ({score,buttonState}) => {
|
const NavigationQuiz = ({score,buttonState}) => {
|
||||||
|
|
||||||
console.log(endScore)
|
|
||||||
|
|
||||||
|
|
||||||
link = /[^/]*$/.exec(`${window.location.href}`)[0];
|
link = /[^/]*$/.exec(`${window.location.href}`)[0];
|
||||||
@ -53,7 +53,7 @@ const QuizGame = () => {
|
|||||||
|
|
||||||
const ButtonNextQuestionClick = (e) => {
|
const ButtonNextQuestionClick = (e) => {
|
||||||
setScore(score + 1);
|
setScore(score + 1);
|
||||||
console.log(Number(e.target.name), EndCacheId)
|
|
||||||
if(score === 9)
|
if(score === 9)
|
||||||
navigate("/result");
|
navigate("/result");
|
||||||
else if (Number(e.target.name) === EndCacheId)
|
else if (Number(e.target.name) === EndCacheId)
|
||||||
|
@ -8,9 +8,10 @@ import Conffetti from './Conffetti';
|
|||||||
|
|
||||||
import { CircularProgressbar , buildStyles } from 'react-circular-progressbar' ;
|
import { CircularProgressbar , buildStyles } from 'react-circular-progressbar' ;
|
||||||
import 'react-circular-progressbar/dist/styles.css';
|
import 'react-circular-progressbar/dist/styles.css';
|
||||||
export let points = endScore;
|
|
||||||
const Result = () => {
|
const Result = () => {
|
||||||
console.log(TruckId, SecondSeconds, endScore)
|
|
||||||
|
|
||||||
|
|
||||||
fetch('/quiz-results', {
|
fetch('/quiz-results', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -1,38 +1,27 @@
|
|||||||
import React, {useState, useEffect, useContext} from 'react';
|
|
||||||
|
|
||||||
|
|
||||||
export let SecondSeconds = 1;
|
export let SecondSeconds = 1;
|
||||||
export let SecondMinutes = 0;
|
export let SecondMinutes = 0;
|
||||||
|
|
||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
const Timer = () => {
|
const Timer = () => {
|
||||||
const [seconds, setSeconds] = useState(0);
|
const [time, setTime] = useState(0);
|
||||||
const [minutes, setMinutes] = useState(0);
|
let seconds = Math.floor(time % 60);
|
||||||
|
let minutes = Math.floor(time / 60);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let timer = setInterval(() => {
|
const intervalId = setInterval(() => {
|
||||||
SecondSeconds = seconds;
|
SecondSeconds = seconds;
|
||||||
SecondMinutes = minutes
|
SecondMinutes = minutes
|
||||||
setSeconds(seconds + 1);
|
setTime(time + 1);
|
||||||
|
|
||||||
if(seconds === 59) {
|
|
||||||
setMinutes(minutes + 1);
|
|
||||||
setSeconds(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
return () => clearInterval(intervalId);
|
||||||
|
}, [time]);
|
||||||
return () => clearInterval(timer);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div>
|
||||||
<h1 className='timerTime'>{minutes < 10 ? "0"+minutes: minutes} : {seconds < 10 ? "0"+seconds: seconds}</h1>
|
<h1 className='timerTime'>{minutes < 10 ? "0"+minutes: minutes} : {seconds < 10 ? "0"+seconds: seconds}</h1>
|
||||||
)
|
</div>
|
||||||
}
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default Timer;
|
export default Timer;
|
@ -1,12 +1,9 @@
|
|||||||
|
|
||||||
import React, {useRef,useEffect,useContext} from 'react';
|
import React, {useRef,useEffect} from 'react';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
import { AppContext } from './AppContext';
|
|
||||||
import { idUnits } from './SelectBox';
|
import { idUnits } from './SelectBox';
|
||||||
|
|
||||||
|
|
||||||
export let TruckId = "";
|
export let TruckId = "";
|
||||||
|
|
||||||
|
|
||||||
@ -36,18 +33,24 @@ const Truck = () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const BoxComponent = () => {
|
const BoxComponent = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let [truck, setTruck] = useState('');
|
let [truck, setTruck] = useState('');
|
||||||
useEffect(()=> {
|
useEffect(()=> {
|
||||||
|
|
||||||
|
|
||||||
fetch(`/fire-trucks?osp-unit=${idUnits}`)
|
fetch(`/fire-trucks?osp-unit=${idUnits}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
setTruck(data.map(({ID,name,imagePath,avgPercent},index) => {
|
setTruck(data.map(({ID,name,imagePath,avgPercent},index) => {
|
||||||
TruckId = ID;
|
TruckId = ID;
|
||||||
|
let percent = avgPercent.toString().slice(0,3);
|
||||||
let firstAvgPercent = avgPercent * 10;
|
let firstAvgPercent = percent * 10;
|
||||||
let SecondAvgPercent = avgPercent * 100;
|
let SecondAvgPercent = percent * 100;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|