feat: made Controller.svelte a bit more responsive

This commit is contained in:
Laureηt 2021-12-14 14:33:27 +01:00
parent 29a363fc2c
commit 5638d605c8
No known key found for this signature in database
GPG key ID: D88C6B294FD40994
2 changed files with 73 additions and 38 deletions

View file

@ -7,11 +7,11 @@
websocket = new WebSocket('ws://localhost:6789/'); websocket = new WebSocket('ws://localhost:6789/');
}); });
let passwordInput = document.querySelector('#password-text'); let passwordInput = document.querySelector('#password-text') as HTMLElement;
let divLogin = document.querySelector('#login'); let divLogin = document.querySelector('#login') as HTMLElement;
let divDashboard = document.querySelector('#dashboard'); let divDashboard = document.querySelector('#dashboard') as HTMLElement;
let stateList = document.querySelector('#stateList'); let stateList = document.querySelector('#stateList') as HTMLElement;
let saveButton = document.getElementById('save'); let saveButton = document.getElementById('save') as HTMLElement;
saveButton.onclick = function (event) { saveButton.onclick = function (event) {
websocket.send(JSON.stringify({ admin: 'save' })); websocket.send(JSON.stringify({ admin: 'save' }));
@ -43,7 +43,7 @@
const sendCreds = () => () => { const sendCreds = () => () => {
if (websocket) { if (websocket) {
let message = JSON.stringify({ auth: passwordInput.value }); let message = JSON.stringify({ auth: (<HTMLInputElement>passwordInput).value });
websocket.send(message); websocket.send(message);
websocket.addEventListener('message', authSuccess); websocket.addEventListener('message', authSuccess);
} }

View file

@ -74,49 +74,84 @@
</table> </table>
<style lang="scss"> <style lang="scss">
td { @media (orientation: landscape) {
text-align: center; button {
width: 10vh;
height: 10vh;
}
#start,
#select,
#l,
#r {
button {
width: 20vh;
}
}
#r,
#l {
padding-bottom: 10vh;
}
#right {
padding-right: 15vh;
}
}
@media (orientation: portrait) {
button { button {
width: 10vw; width: 10vw;
height: 10vw; height: 10vw;
} }
}
#a, #start,
#b { #select,
button { #l,
border-radius: 50%; #r {
button {
width: 20vw;
}
}
#r,
#l {
padding-bottom: 10vw;
}
#right {
padding-right: 15vw;
} }
} }
#left, td {
#right, text-align: center;
#up, &#r {
#down { text-align: right;
button {
border-radius: 10%;
} }
} &#start,
&#select,
#start, &#l,
#select, &#r {
#l, button {
#r { border-radius: 25%;
button { }
width: 20vw;
border-radius: 25%;
} }
}
#r, &#left,
#l { &#right,
padding-bottom: 10vw; &#up,
} &#down {
#r { button {
text-align: right; border-radius: 10%;
} }
}
#right { &#a,
padding-right: 15vw; &#b {
button {
border-radius: 50%;
}
}
} }
</style> </style>