Feat: remove bot

This commit is contained in:
Grail Finder
2025-06-27 07:35:25 +03:00
parent 12fe92b261
commit 86b1ecf82e
9 changed files with 165 additions and 100 deletions

View File

@ -1,18 +1,31 @@
{{ define "addbot" }}
{{$botName := ""}}
<div>
{{$botName = .Room.FindBotByTeamRole "blue" "mime"}}
{{ if eq .Room.BlueTeam.Mime "" }}
<button hx-get="/add-bot?team=blue&role=mime" hx-target="#addbot" class="bg-blue-400 text-black px-4 py-2 rounded">Add Bot Mime</button>
{{ else if ne $botName "" }}
<button hx-get="/remove-bot?bot={{$botName}}" hx-target="#addbot" class="bg-blue-400 text-black px-4 py-2 rounded">Remove {{$botName}}</button>
{{ end }}
{{$botName = .Room.FindBotByTeamRole "red" "mime"}}
{{ if eq .Room.RedTeam.Mime "" }}
<button hx-get="/add-bot?team=red&role=mime" hx-target="#addbot" class="bg-red-400 text-black px-4 py-2 rounded">Add Bot Mime</button>
{{ else if ne $botName "" }}
<button hx-get="/remove-bot?bot={{$botName}}" hx-target="#addbot" class="bg-red-400 text-black px-4 py-2 rounded">Remove {{$botName}}</button>
{{ end }}
</div>
{{$botName = .Room.FindBotByTeamRole "blue" "guesser"}}
<div>
{{ if not .Room.BlueTeam.Guessers }}
<button hx-get="/add-bot?team=blue&role=guesser" hx-target="#addbot" class="bg-blue-300 text-black px-4 py-2 rounded">Add Bot Guesser</button>
{{ else if ne $botName "" }}
<button hx-get="/remove-bot?bot={{$botName}}" hx-target="#addbot" class="bg-blue-300 text-black px-4 py-2 rounded">Remove {{$botName}}</button>
{{ end }}
{{$botName = .Room.FindBotByTeamRole "red" "guesser"}}
{{ if not .Room.RedTeam.Guessers }}
<button hx-get="/add-bot?team=red&role=guesser" hx-target="#addbot" class="bg-red-300 text-black px-4 py-2 rounded">Add Bot Guesser</button>
{{ else if ne $botName "" }}
<button hx-get="/remove-bot?bot={{$botName}}" hx-target="#addbot" class="bg-red-300 text-black px-4 py-2 rounded">Remove {{$botName}}</button>
{{ end }}
</div>
{{end}}

View File

@ -1,16 +1,16 @@
{{define "cardword"}}
{{if .Revealed}}
{{if eq .Color "amber"}}
<div id="card-{{.Word}}" class="bg-{{.Color}}-100 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
<div id="card-{{.Word}}" class="bg-{{.Color}}-100 border border-gray-500 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
style="text-shadow: 0 2px 4px rgba(0,0,0,0.9);"> {{.Word}}
</div>
{{else}}
<div id="card-{{.Word}}" class="bg-{{.Color}}-600 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
<div id="card-{{.Word}}" class="bg-{{.Color}}-600 border border-gray-500 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
style="text-shadow: 0 2px 4px rgba(0,0,0,0.9);"> {{.Word}}
</div>
{{end}}
{{else}}
<div id="card-{{.Word}}" class="bg-stone-600 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
<div id="card-{{.Word}}" class="bg-stone-600 border border-gray-500 p-4 rounded-lg min-w-[100px] text-center text-white cursor-pointer"
style="text-shadow: 0 2px 4px rgba(0,0,0,0.8);"
hx-get="/word/show-color?word={{.Word}}" hx-trigger="click" hx-swap="outerHTML transition:true swap:.05s">
{{.Word}}