refactoring
This commit is contained in:
parent
b445a1e2cd
commit
e6118b4df0
|
|
@ -8,12 +8,11 @@ import Help from "../../components/game/Help.jsx";
|
|||
import SoundControl from "../../components/game/SoundControl.jsx";
|
||||
import ExtraControls from "../../components/game/ExtraControls.jsx";
|
||||
import { useUser } from "../../hooks/useUser.jsx";
|
||||
import Loading from "../../components/animations/Loading.jsx";
|
||||
|
||||
export default function GameContainer({ gameId }) {
|
||||
const gameDatas = useWordpressCustomData(`/screen/play/${gameId}`);
|
||||
console.log(gameDatas);
|
||||
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const [startX, setStartX] = useState(0);
|
||||
|
||||
|
|
@ -27,18 +26,6 @@ export default function GameContainer({ gameId }) {
|
|||
|
||||
useEffect(() => {
|
||||
if (!isGameComplete) return;
|
||||
// console.log(contextGameDatas);
|
||||
// const datas = {
|
||||
// user_locale: language,
|
||||
// user_country: country,
|
||||
// level_post_id: contextGameDatas.gameId,
|
||||
// level_score: score,
|
||||
// level_completion_time: currentTime,
|
||||
// };
|
||||
// postWordpressStatisticsData(datas);
|
||||
console.log("##############");
|
||||
// console.log(datas);
|
||||
console.log("##############");
|
||||
}, [isGameComplete]);
|
||||
|
||||
// HANDLE CANVAS DRAGGING INTERACTIONS
|
||||
|
|
@ -59,7 +46,7 @@ export default function GameContainer({ gameId }) {
|
|||
setIsDragging(false);
|
||||
}
|
||||
|
||||
if (!contextGameDatas) return;
|
||||
if (!contextGameDatas) return <Loading />;
|
||||
|
||||
const gameBackgroundUrl = contextGameDatas.gameBlockDatas.attrs.coverUrl;
|
||||
const blocks = contextGameDatas.gameBlockDatas.innerBlocks;
|
||||
|
|
@ -69,7 +56,7 @@ export default function GameContainer({ gameId }) {
|
|||
<ExtraControls />
|
||||
<SoundControl />
|
||||
<Score />
|
||||
<Timer currentTime={currentTime} setCurrentTime={setCurrentTime} />
|
||||
<Timer />
|
||||
<Help />
|
||||
<div onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} onMouseUp={handleMouseUp}>
|
||||
<section className='wp-block-lhoist-blocks-search-and-find lhoist-blocks-search-and-find'>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user