2022-10-31 13:25:32 +00:00
|
|
|
/* @refresh reload */
|
|
|
|
import { render } from 'solid-js/web';
|
|
|
|
import 'solid-devtools';
|
|
|
|
|
|
|
|
import App from './App';
|
|
|
|
import './main.css';
|
2022-11-01 10:00:17 +00:00
|
|
|
import '@fontsource/ubuntu';
|
2022-10-31 13:25:32 +00:00
|
|
|
import "@fontsource/noto-sans-symbols-2";
|
2022-11-01 10:00:17 +00:00
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
import Button from './components/Button';
|
2022-10-31 13:25:32 +00:00
|
|
|
|
|
|
|
const search = new URLSearchParams(window.location.search);
|
2022-11-01 10:00:17 +00:00
|
|
|
const root = document.getElementById('root')!;
|
|
|
|
|
|
|
|
function newGame() {
|
|
|
|
window.location.search = '?game_id=' + uuidv4();
|
|
|
|
}
|
|
|
|
|
2022-10-31 13:25:32 +00:00
|
|
|
if (search.has('game_id')) {
|
2022-11-01 10:00:17 +00:00
|
|
|
render(() => <App gameId={search.get('game_id')!} />, root);
|
2022-10-31 13:25:32 +00:00
|
|
|
} else {
|
2022-11-01 10:00:17 +00:00
|
|
|
render(() => <Button onClick={newGame}>New game</Button>, root);
|
2022-10-31 13:25:32 +00:00
|
|
|
}
|