2026-04-10 21:53:50 +02:00
|
|
|
/**
|
2026-04-10 17:57:26 +02:00
|
|
|
* This file is part of the SplendidBear Websites' projects.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2026 @ www.splendidbear.org
|
|
|
|
|
*
|
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
2026-04-10 21:53:50 +02:00
|
|
|
import { useGame } from '@mine-contexts';
|
|
|
|
|
import { useServerCommunication } from '@mine-hooks';
|
2026-04-10 17:57:26 +02:00
|
|
|
import GridControl from './grid/GridControl';
|
|
|
|
|
|
2026-04-19 18:04:01 +02:00
|
|
|
export const GameBoard = ({ gameAssoc, gameInherited, opponentName = '', isEnvDev }) => {
|
2026-04-10 17:57:26 +02:00
|
|
|
const { gridReady } = useGame();
|
2026-04-19 18:04:01 +02:00
|
|
|
const { onClick, resign } = useServerCommunication(gameAssoc, gameInherited, opponentName, isEnvDev);
|
2026-04-10 17:57:26 +02:00
|
|
|
|
|
|
|
|
if (!gridReady) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="game-overlay">
|
|
|
|
|
<div className="game-overlay-window"><h1>Loading…</h1></div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 19:09:05 +02:00
|
|
|
return (
|
|
|
|
|
<GridControl
|
2026-04-14 19:37:42 +02:00
|
|
|
gameAssoc={gameAssoc}
|
2026-04-10 19:09:05 +02:00
|
|
|
onClick={onClick}
|
|
|
|
|
resign={resign}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2026-04-10 17:57:26 +02:00
|
|
|
};
|