diff --git a/src/client.ts b/src/client.ts index bc8170783..0154242cb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -96,5 +96,5 @@ async function testDelay() { console.log(ws.latency()); } -await testDelay(); -await new Client().connect("124931507"); +testDelay(); +new Client().connect("124931507"); diff --git a/src/main.ts b/src/main.ts index f1c79723d..2f573e805 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,3 @@ -import './style.css'; +import "./style.css"; import "./client"; - -const app = document.querySelector('#app')! - -app.innerHTML = ` -

Hello Vite!

- Documentation -` +import "./ui"; \ No newline at end of file diff --git a/src/ui.js b/src/ui.js new file mode 100644 index 000000000..e718e7488 --- /dev/null +++ b/src/ui.js @@ -0,0 +1,42 @@ +const app = document.querySelector("#app"); + +if (app) { + app.innerHTML = ` +
+ + + +
Host:
Id:
+ +`; + + document.body.onload = () => { + const host = document.querySelector('#host'); + host.value = localStorage.getItem('host'); + const id = document.querySelector('#id'); + id.value = localStorage.getItem('id'); + }; + + window.connect = () => { + const host = document.querySelector('#host'); + localStorage.setItem('host', host.value); + const id = document.querySelector('#id'); + localStorage.setItem('id', id.value); + document.querySelector('div#connect').style.display = 'none'; + document.querySelector('div#password').style.display = 'block'; + } + + window.cancel = () => { + document.querySelector('div#connect').style.display = 'block'; + document.querySelector('div#password').style.display = 'none'; + } + + window.confirm = () => { + // + } + +} \ No newline at end of file