Fix: mime to see marks; reverse actions order; hide endturn button
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{{define "actionhistory"}}
|
{{define "actionhistory"}}
|
||||||
<div id="actionHistoryContainer" class="overflow-y-auto max-h-96 border-2 border-gray-300 p-4 rounded-lg space-y-2">
|
<div id="actionHistoryContainer" class="overflow-y-auto max-h-96 border-2 border-gray-300 p-4 rounded-lg space-y-2 h-full flex-col-reverse justify-end">
|
||||||
Backlog:
|
Backlog:
|
||||||
{{range .}}
|
{{range .}}
|
||||||
<div class="flex items-center justify-between p-2 rounded">
|
<div class="flex items-center justify-between p-2 rounded">
|
||||||
@@ -14,27 +14,4 @@
|
|||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
if (!window.actionHistoryScrollSet) {
|
|
||||||
// Use HTMX's after-swap event to scroll after content updates
|
|
||||||
document.addEventListener('htmx:afterSwap', function(evt) {
|
|
||||||
if (evt.target.id === 'actionHistoryContainer' || evt.detail.target.id === 'actionHistoryContainer') {
|
|
||||||
const container = document.getElementById('actionHistoryContainer');
|
|
||||||
if (container) {
|
|
||||||
container.scrollTop = container.scrollHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// Fallback for initial load
|
|
||||||
htmx.onLoad(function(target) {
|
|
||||||
if (target.id === 'actionHistoryContainer') {
|
|
||||||
const container = document.getElementById('actionHistoryContainer');
|
|
||||||
if (container) {
|
|
||||||
container.scrollTop = container.scrollHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
window.actionHistoryScrollSet = true;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{if .Room.IsRunning}}
|
{{if .Room.IsRunning}}
|
||||||
{{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn)}}
|
{{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn) (.Room.MimeDone)}}
|
||||||
<button hx-get="/end-turn" hx-target="#room" class="bg-amber-100 text-black px-4 py-2 rounded">End Turn</button>
|
<button hx-get="/end-turn" hx-target="#room" class="bg-amber-100 text-black px-4 py-2 rounded">End Turn</button>
|
||||||
{{else if and (eq .State.Role "mime") (not .Room.MimeDone)}}
|
{{else if and (eq .State.Role "mime") (not .Room.MimeDone)}}
|
||||||
{{template "mimeclue"}}
|
{{template "mimeclue"}}
|
||||||
|
@@ -9,6 +9,8 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -55,6 +57,12 @@ func HandleHome(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
fi.Room.GuesserView()
|
fi.Room.GuesserView()
|
||||||
}
|
}
|
||||||
|
// reverse actions if first action
|
||||||
|
if len(fi.Room.ActionHistory) > 1 {
|
||||||
|
if strings.EqualFold(fi.Room.ActionHistory[0].Action, models.ActionTypeGameStarted) {
|
||||||
|
slices.Reverse(fi.Room.ActionHistory)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if fi != nil && fi.Room == nil {
|
if fi != nil && fi.Room == nil {
|
||||||
rooms, err := repo.RoomList(r.Context())
|
rooms, err := repo.RoomList(r.Context())
|
||||||
|
7
todos.md
7
todos.md
@@ -104,7 +104,8 @@
|
|||||||
- llm resp token amount limit;
|
- llm resp token amount limit;
|
||||||
|
|
||||||
=============
|
=============
|
||||||
- autoscroll backlog to the last action;
|
- autoscroll backlog to the last action; (reversed order) +
|
||||||
- mimes to see marks on the words;
|
- mimes to see marks on the words; +
|
||||||
- clearer ways to see opened words;
|
- clearer ways to see opened words; (line through) +
|
||||||
|
- guesser sees end turn button before clue was given by mime; +
|
||||||
- sql no rows when joining by link?
|
- sql no rows when joining by link?
|
||||||
|
Reference in New Issue
Block a user