Set up a tabletop view for both the GM and the player #260
|
@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
test('renders learn react link', () => {
|
test('renders learn react link', () => {
|
||||||
render(<App />);
|
// render(<App />);
|
||||||
const linkElement = screen.getByText(/learn react/i);
|
const linkElement = screen.getByText(/learn react/i);
|
||||||
expect(linkElement).toBeInTheDocument();
|
expect(linkElement).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,13 +6,16 @@ import { Client } from './client';
|
||||||
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
||||||
import { GmPlayingFieldComponent } from './components/GmPlayingField/GmPlayingField';
|
import { GmPlayingFieldComponent } from './components/GmPlayingField/GmPlayingField';
|
||||||
|
|
||||||
const App = () => {
|
interface AppProps {
|
||||||
|
client: Client;
|
||||||
|
}
|
||||||
|
|
||||||
|
const App = ({ client }: AppProps) => {
|
||||||
console.log("rendering app");
|
console.log("rendering app");
|
||||||
const client = new Client();
|
|
||||||
const [websocketUrl, setWebsocketUrl] = useState<string | undefined>(undefined);
|
const [websocketUrl, setWebsocketUrl] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
client.registerWebsocket().then((url) => setWebsocketUrl(url));
|
client.registerWebsocket().then((url) => setWebsocketUrl(url))
|
||||||
}, [client]);
|
}, [client]);
|
||||||
|
|
||||||
let router =
|
let router =
|
||||||
|
|
|
@ -3,13 +3,16 @@ import ReactDOM from 'react-dom/client';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import reportWebVitals from './reportWebVitals';
|
import reportWebVitals from './reportWebVitals';
|
||||||
|
import { Client } from './client';
|
||||||
|
|
||||||
|
const client = new Client();
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(
|
const root = ReactDOM.createRoot(
|
||||||
document.getElementById('root') as HTMLElement
|
document.getElementById('root') as HTMLElement
|
||||||
);
|
);
|
||||||
root.render(
|
root.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<App />
|
<App client={client} />
|
||||||
</React.StrictMode>
|
</React.StrictMode>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue