Fix: show only proper join buttons
This commit is contained in:
@ -40,13 +40,10 @@
|
|||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<!-- Left Panel -->
|
<!-- Left Panel -->
|
||||||
{{template "teamlist" .Room.BlueTeam}}
|
{{template "teamlist" .Room.BlueTeam}}
|
||||||
{{if and (ne .State.Team "blue") (not .Room.IsRunning)}}
|
{{if not .Room.IsRunning}}
|
||||||
{{template "teampew" "blue"}}
|
{{template "teampew" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
<!-- Right Panel -->
|
<!-- Right Panel -->
|
||||||
{{if and (ne .State.Team "red") (not .Room.IsRunning)}}
|
|
||||||
{{template "teampew" "red"}}
|
|
||||||
{{end}}
|
|
||||||
{{template "teamlist" .Room.RedTeam}}
|
{{template "teamlist" .Room.RedTeam}}
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
|
@ -1,18 +1,44 @@
|
|||||||
{{define "teampew"}}
|
{{define "teampew"}}
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-xl mb-4">Join {{.}} Team</h2>
|
<h2 class="text-xl mb-4">Join Blue Team</h2>
|
||||||
<form hx-post="/join-team" hx-target="#ancestor">
|
<form hx-post="/join-team" hx-target="#ancestor">
|
||||||
<input type="hidden" name="team" value="{{.}}">
|
<input type="hidden" name="team" value="blue">
|
||||||
<div class="mb-1">
|
<div class="mb-1">
|
||||||
<button type="submit" name="role" value="guesser" class="w-full bg-{{.}}-500 text-white py-2 px-4 rounded">
|
{{if and (eq .State.Role "guesser") (eq .State.Team "blue")}}
|
||||||
|
{{else}}
|
||||||
|
<button type="submit" name="role" value="guesser" class="w-full bg-blue-500 text-white py-2 px-4 rounded">
|
||||||
Join as Guesser
|
Join as Guesser
|
||||||
</button>
|
</button>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
{{if eq .Room.BlueTeam.Mime ""}}
|
||||||
<div>
|
<div>
|
||||||
<button type="submit" name="role" value="mime" class="w-full bg-{{.}}-700 text-white py-2 px-4 rounded">
|
<button type="submit" name="role" value="mime" class="w-full bg-blue-700 text-white py-2 px-4 rounded">
|
||||||
Join as Mime
|
Join as Mime
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2 class="text-xl mb-4">Join Red Team</h2>
|
||||||
|
<form hx-post="/join-team" hx-target="#ancestor">
|
||||||
|
<input type="hidden" name="team" value="red">
|
||||||
|
<div class="mb-1">
|
||||||
|
{{if and (eq .State.Role "guesser") (eq .State.Team "red")}}
|
||||||
|
{{else}}
|
||||||
|
<button type="submit" name="role" value="guesser" class="w-full bg-red-500 text-white py-2 px-4 rounded">
|
||||||
|
Join as Guesser
|
||||||
|
</button>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{if eq .Room.RedTeam.Mime ""}}
|
||||||
|
<div>
|
||||||
|
<button type="submit" name="role" value="mime" class="w-full bg-red-700 text-white py-2 px-4 rounded">
|
||||||
|
Join as Mime
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -151,6 +151,31 @@ func (r *Room) GetPlayerByName(name string) (role UserRole, team UserTeam, found
|
|||||||
return "", "", false
|
return "", "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Room) GetPlayerInfoByName(name string) *BotPlayer {
|
||||||
|
bp := &BotPlayer{}
|
||||||
|
if r.RedTeam.Mime == name {
|
||||||
|
bp.Role = UserRoleMime
|
||||||
|
bp.Team = UserTeamRed
|
||||||
|
}
|
||||||
|
if r.BlueTeam.Mime == name {
|
||||||
|
bp.Role = UserRoleMime
|
||||||
|
bp.Team = UserTeamBlue
|
||||||
|
}
|
||||||
|
for _, guesser := range r.RedTeam.Guessers {
|
||||||
|
if guesser == name {
|
||||||
|
bp.Role = UserRoleGuesser
|
||||||
|
bp.Team = UserTeamRed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, guesser := range r.BlueTeam.Guessers {
|
||||||
|
if guesser == name {
|
||||||
|
bp.Role = UserRoleGuesser
|
||||||
|
bp.Team = UserTeamBlue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bp
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Room) CanStart() error {
|
func (r *Room) CanStart() error {
|
||||||
if r.IsRunning {
|
if r.IsRunning {
|
||||||
return errors.New("cannot start; game is already running")
|
return errors.New("cannot start; game is already running")
|
||||||
|
3
todos.md
3
todos.md
@ -5,13 +5,13 @@
|
|||||||
- login with invite link; +
|
- login with invite link; +
|
||||||
- there three places for bot to check if its its move: start-game; end-turn, after mime gave clue; +
|
- there three places for bot to check if its its move: start-game; end-turn, after mime gave clue; +
|
||||||
- remove bot button (if game is not running, or bot already added); +
|
- remove bot button (if game is not running, or bot already added); +
|
||||||
- show in backlog (and with that in prompt to llm) how many cards are left to open, also additional comment: if guess was right;
|
|
||||||
- hide clue input for mime when it's not their turn; +
|
- hide clue input for mime when it's not their turn; +
|
||||||
- needs resend to llm btn; +
|
- needs resend to llm btn; +
|
||||||
- check if clue word is the same as one of the cards and return err if it is; +
|
- check if clue word is the same as one of the cards and return err if it is; +
|
||||||
- autoscroll down backlog on update; +
|
- autoscroll down backlog on update; +
|
||||||
- instead of guessing all words at ones, ask only for 1 word to be open. +
|
- instead of guessing all words at ones, ask only for 1 word to be open. +
|
||||||
- ways to remove bots from teams; +
|
- ways to remove bots from teams; +
|
||||||
|
- show in backlog (and with that in prompt to llm) how many cards are left to open, also additional comment: if guess was right;
|
||||||
- better styles and fluff;
|
- better styles and fluff;
|
||||||
- common auth system between sites;
|
- common auth system between sites;
|
||||||
- gameover to backlog;
|
- gameover to backlog;
|
||||||
@ -47,3 +47,4 @@
|
|||||||
- guesser bot no request after game restart;
|
- guesser bot no request after game restart;
|
||||||
- remove join as mime button if there is a mime already on that team (rewrite teampew templ);
|
- remove join as mime button if there is a mime already on that team (rewrite teampew templ);
|
||||||
- openrouter 429 errors;
|
- openrouter 429 errors;
|
||||||
|
- there is a clue window for a mime before game started;
|
||||||
|
Reference in New Issue
Block a user