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; background-color: #0C1616FF;
color: #8896b2; color: #8896b2;
min-width: 0px; min-width: 0px;
margin: 2em auto !important; margin: 2em 2em !important;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
line-height: 1.5; line-height: 1.5;
font-size: 16px; font-size: 16px;
font-family: Open Sans,Arial; font-family: Open Sans,Arial;
font-weight: bold;
text-align: center; text-align: center;
display: block; display: block;
} }
@ -22,18 +23,6 @@ tr{
#usertable{ #usertable{
display: block ruby; 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{ #errorbox{
border: 1px solid black; border: 1px solid black;
background-color: darkorange; 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 // the amount of time to wait when pushing a message to
// a slow client or a client that closed after `range clients` started. // 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 ( type (
NotificationEvent struct { NotificationEvent struct {

View File

@ -1,6 +1,6 @@
{{define "error"}} {{define "error"}}
<a href="/"> <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 class="font-bold">An error from server</p>
<p>{{.}}</p> <p>{{.}}</p>
<p>Click this banner to return to main page.</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,21 +53,15 @@
</div> </div>
<hr/> <hr/>
<div class="grid grid-cols-1 md:grid-cols-5 md:gap-4"> <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}} {{template "actionhistory" .Room.ActionHistory}}
</div> </div>
<div id="cardtable" class="md:col-span-3"> <div id="cardtable" class="md:col-span-3">
{{template "cardtable" .Room}} {{template "cardtable" .Room}}
</div> </div>
<div class="hidden md:block md:col-span-1"></div> <!-- Spacer --> <div class="hidden md:block md:col-span-1">
</div> {{template "journal" .Room}}
<div id="systembox" class="overflow-y-auto max-h-96 border-2 border-gray-300 p-4 rounded-lg space-y-2"> </div> <!-- Spacer -->
bot thought: <br>
<ul>
{{range .Room.LogJournal}}
<li>{{.Username}}: {{.Entry}}</li>
{{end}}
</ul>
</div> </div>
<div> <div>
{{if .Room.IsRunning}} {{if .Room.IsRunning}}

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 { if err := repo.RoomDeleteByID(r.Context(), fi.Room.ID); err != nil {
log.Error("failed to remove room", "error", err) log.Error("failed to remove room", "error", err)
} }
notify(models.NotifyRoomListUpdate, "") notify(models.NotifyRoomListUpdate, "") // why is it needed?
} else { } else {
notify(models.NotifyRoomUpdatePrefix, "")
// if regular player leaves, just exit room // if regular player leaves, just exit room
if err := repo.PlayerExitRoom(r.Context(), fi.State.Username); err != nil { if err := repo.PlayerExitRoom(r.Context(), fi.State.Username); err != nil {
log.Error("failed to exit room", "error", err) log.Error("failed to exit room", "error", err)