Client: Not yet loaded seats now show an hourglass loading spinner

main
Antonio De Lucreziis 3 years ago
parent 06f9a49731
commit e78e7427ac

@ -77,11 +77,13 @@ export async function createSeatWidget($roomGrid, roomId) {
if (occupiedBy.length === 0) { if (occupiedBy.length === 0) {
const confirmResponse = confirm('Occupare il posto?') const confirmResponse = confirm('Occupare il posto?')
if (confirmResponse) { if (confirmResponse) {
$seat.classList.remove('libero')
Database.occupySeat(seatId) Database.occupySeat(seatId)
} }
} else if (occupiedBy.length === 1 && occupiedBy[0] === user.id) { } else if (occupiedBy.length === 1 && occupiedBy[0] === user.id) {
const answer = confirm('Lasciare veramente il posto?') const answer = confirm('Lasciare veramente il posto?')
if (answer) { if (answer) {
$seat.classList.remove('mio')
Database.leaveSeat(seatId) Database.leaveSeat(seatId)
} }
} else { } else {

@ -311,9 +311,16 @@ main {
line-height: 1; line-height: 1;
&:not(.mio, .libero, .occupato)::before { &:not(.mio, .libero, .occupato) {
font-size: 12px; &::before {
content: ''; font-size: 12px;
content: '';
animation: rotating 1s linear infinite;
}
&::after {
content: none;
}
} }
&::before { &::before {

@ -2,7 +2,6 @@ package serverevents
import ( import (
"fmt" "fmt"
"log"
"net/http" "net/http"
) )
@ -46,14 +45,11 @@ func (sse *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
client := make(chan string) client := make(chan string)
sse.clients[client] = true sse.clients[client] = true
log.Printf(`New connection`)
if sse.Connected != nil { if sse.Connected != nil {
sse.Connected(client) sse.Connected(client)
} }
defer func() { defer func() {
log.Printf(`Connection closed`)
close(client) close(client)
delete(sse.clients, client) delete(sse.clients, client)
if sse.Disconnected != nil { if sse.Disconnected != nil {

Loading…
Cancel
Save