Enha: shorter sse patience; style cleaning

This commit is contained in:
Grail Finder
2025-07-16 07:34:44 +03:00
parent 123d6c240f
commit ccf0b8538f
7 changed files with 22 additions and 27 deletions

View File

@ -2,12 +2,13 @@ body{
background-color: #0C1616FF;
color: #8896b2;
min-width: 0px;
margin: 2em auto !important;
margin: 2em 2em !important;
margin-left: auto;
margin-right: auto;
line-height: 1.5;
font-size: 16px;
font-family: Open Sans,Arial;
font-weight: bold;
text-align: center;
display: block;
}
@ -22,18 +23,6 @@ tr{
#usertable{
display: block ruby;
}
.actiontable{
display: inline flow-root;
margin-inline: 10px;
}
.action_name{
border: none;
display: inline;
font-family: inherit;
font-size: inherit;
padding: none;
width: auto;
}
#errorbox{
border: 1px solid black;
background-color: darkorange;

Binary file not shown.

View File

@ -9,7 +9,7 @@ import (
// the amount of time to wait when pushing a message to
// a slow client or a client that closed after `range clients` started.
const patience time.Duration = time.Second * 1
const patience time.Duration = time.Millisecond * 500
type (
NotificationEvent struct {

View File

@ -1,6 +1,6 @@
{{define "error"}}
<a href="/">
<div id=errorbox class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4" role="alert">
<div id=errorbox class="bg-orange-100 border-l-4 border-black text-black p-4" role="alert">
<p class="font-bold">An error from server</p>
<p>{{.}}</p>
<p>Click this banner to return to main page.</p>

11
components/journal.html Normal file
View File

@ -0,0 +1,11 @@
{{define "journal"}}
<div id="systembox" class="overflow-y-auto max-h-96 border-2 border-gray-300 p-4 rounded-lg space-y-2">
bot journal: <br>
<ul>
{{range .LogJournal}}
<li>{{.Username}}: {{.Entry}}</li>
{{end}}
</ul>
</div>
{{end}}

View File

@ -53,22 +53,16 @@
</div>
<hr/>
<div class="grid grid-cols-1 md:grid-cols-5 md:gap-4">
<div hx-get="/actionhistory" hx-trigger="sse:backlog_{{.Room.ID}}" class="md:col-span-1">
<div class="md:col-span-1">
{{template "actionhistory" .Room.ActionHistory}}
</div>
<div id="cardtable" class="md:col-span-3">
{{template "cardtable" .Room}}
</div>
<div class="hidden md:block md:col-span-1"></div> <!-- Spacer -->
</div>
<div id="systembox" class="overflow-y-auto max-h-96 border-2 border-gray-300 p-4 rounded-lg space-y-2">
bot thought: <br>
<ul>
{{range .Room.LogJournal}}
<li>{{.Username}}: {{.Entry}}</li>
{{end}}
</ul>
</div>
<div class="hidden md:block md:col-span-1">
{{template "journal" .Room}}
</div> <!-- Spacer -->
</div>
<div>
{{if .Room.IsRunning}}
{{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn)}}

View File

@ -106,8 +106,9 @@ func HandleExit(w http.ResponseWriter, r *http.Request) {
if err := repo.RoomDeleteByID(r.Context(), fi.Room.ID); err != nil {
log.Error("failed to remove room", "error", err)
}
notify(models.NotifyRoomListUpdate, "")
notify(models.NotifyRoomListUpdate, "") // why is it needed?
} else {
notify(models.NotifyRoomUpdatePrefix, "")
// if regular player leaves, just exit room
if err := repo.PlayerExitRoom(r.Context(), fi.State.Username); err != nil {
log.Error("failed to exit room", "error", err)