adding temporrary extra controls to handle functions
This commit is contained in:
parent
7d6085fbf7
commit
26a3d63152
4
src/assets/css/components/ExtraControls.scss
Normal file
4
src/assets/css/components/ExtraControls.scss
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
.extra-controls {
|
||||||
|
@apply bg-purple-300 absolute bottom-1/2 right-0 h-16 flex justify-center items-center px-12;
|
||||||
|
z-index: 50;
|
||||||
|
}
|
||||||
41
src/components/game/ExtraControls.jsx
Normal file
41
src/components/game/ExtraControls.jsx
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
import React from "react";
|
||||||
|
import { useGame } from "../../hooks/useGame";
|
||||||
|
import GameQuestion from "./GameQuestion";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { useUser } from "../../hooks/useUser";
|
||||||
|
import { postGameStatisticsData } from "../../services/WordpressFetchData";
|
||||||
|
export default function ExtraControls() {
|
||||||
|
const { language, country } = useUser();
|
||||||
|
const { contextGameDatas, score, currentGameModal, setCurrentGameModal } = useGame();
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const correctAnswer = contextGameDatas?.gameObjects[0].attrs.behaviourType;
|
||||||
|
const objectPictureUrl = contextGameDatas?.gameObjects[0].attrs.objectPictureUrl;
|
||||||
|
|
||||||
|
function sendDatasTest() {
|
||||||
|
postGameStatisticsData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='extra-controls'>
|
||||||
|
<button onClick={sendDatasTest}>send datas</button>
|
||||||
|
<button className='addModal' onClick={() => navigate("/")}>
|
||||||
|
go home
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className='addModal'
|
||||||
|
onClick={() =>
|
||||||
|
setCurrentGameModal(
|
||||||
|
<GameQuestion
|
||||||
|
questionId={0}
|
||||||
|
correctAnswer={correctAnswer}
|
||||||
|
objectPictureUrl={objectPictureUrl}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}>
|
||||||
|
AddModal
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user