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