2026-04-10 21:53:50 +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.
|
|
|
|
|
*/
|
|
|
|
|
|
2026-04-10 17:57:26 +02:00
|
|
|
import React, { useRef } from 'react';
|
|
|
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
2026-04-10 21:53:50 +02:00
|
|
|
import { GameProvider } from '@mine-contexts';
|
|
|
|
|
import { GameBoard } from '@mine-components';
|
2026-04-21 11:30:07 +02:00
|
|
|
import { string } from 'prop-types';
|
2026-04-10 17:57:26 +02:00
|
|
|
|
|
|
|
|
const queryClient = new QueryClient();
|
|
|
|
|
|
2026-04-19 18:04:01 +02:00
|
|
|
const MineSeeker = ({ env, gameId, opponentName = '' }) => {
|
2026-04-10 17:57:26 +02:00
|
|
|
const isEnvDev = 'dev' === env;
|
|
|
|
|
const gameAssoc = useRef('' !== gameId ? gameId : crypto.randomUUID()).current;
|
|
|
|
|
const gameInherited = '' !== gameId;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
|
<GameProvider>
|
|
|
|
|
<GameBoard
|
|
|
|
|
gameAssoc={gameAssoc}
|
|
|
|
|
gameInherited={gameInherited}
|
2026-04-19 18:04:01 +02:00
|
|
|
opponentName={opponentName}
|
2026-04-10 17:57:26 +02:00
|
|
|
isEnvDev={isEnvDev}
|
|
|
|
|
/>
|
|
|
|
|
</GameProvider>
|
|
|
|
|
</QueryClientProvider>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default MineSeeker;
|
2026-04-21 11:30:07 +02:00
|
|
|
|
|
|
|
|
MineSeeker.propTypes = {
|
|
|
|
|
env: string.isRequired,
|
|
|
|
|
gameId: string,
|
|
|
|
|
opponentName: string,
|
|
|
|
|
};
|