Global Chat

This commit is contained in:
Xamora
2023-11-27 15:10:06 +01:00
parent 56b6f0e138
commit c16d281892
7 changed files with 78 additions and 30 deletions

View File

@ -1,37 +1,9 @@
body {
--nav-width: 200px;
margin: 0 0 0 var(--nav-width);
margin: 10;
font-family: 'Quicksand', sans-serif;
font-size: 18px;
}
.nav {
position: fixed;
top: 0;
left: 0;
width: var(--nav-width);
height: 100vh;
background: #222222;
}
.nav__link {
display: block;
padding: 12px 18px;
text-decoration: none;
color: #eeeeee;
font-weight: 500;
}
.nav__link:hover {
background: rgba(255, 255, 255, 0.05);
}
#app {
margin: 2em;
line-height: 1.5;
font-weight: 500;
}
a {
color: #009579;
}
}

View File

@ -11,6 +11,14 @@ export default class extends AbstractView {
this.chatSocket.onmessage = function(e){
let data = JSON.parse(e.data)
console.log('Data:', data)
if (data.type === 'chat') {
let messages = document.getElementById('messages')
messages.insertAdjacentHTML('beforeend', `
<div><p>${data.message}</p></div>
`)
}
}
}