69 lines
2.6 KiB
HTML
69 lines
2.6 KiB
HTML
{{define "room"}}
|
|
<div id="interier" hx-get="/" hx-trigger="sse:roomupdate_{{.State.RoomID}}">
|
|
<div id="meta">
|
|
<p>Hello {{.State.Username}};</p>
|
|
<p>Room created by {{.Room.CreatorName}};</p>
|
|
<p>Room link:</p><p><input id="roomlink" readonly="" onclick="copyText()" value="{{.Room.RoomLink}}"></input></p>
|
|
<p>Game is running: {{.Room.IsRunning}}</p>
|
|
<p>
|
|
{{if and (eq .State.Username .Room.CreatorName) (not .Room.IsRunning)}}
|
|
<button hx-get="/start-game" hx-target="#room" class="bg-amber-100 text-black px-4 py-2 rounded">Start Game</button>
|
|
{{end}}
|
|
</p>
|
|
{{if .Room.IsOver}}
|
|
<p>GAME OVER; team <span class="text-{{.Room.TeamWon}}-500">{{.Room.TeamWon}}</span> won! 🧚</p>
|
|
{{else}}
|
|
<p>Turn of the <span class="text-{{.Room.TeamTurn}}-500">{{.Room.TeamTurn}}</span> team</p>
|
|
{{end}}
|
|
<p>
|
|
{{if eq .State.Team ""}}
|
|
join the team!
|
|
{{else}}
|
|
you're on the team <span class="text-{{.State.Team}}-500">{{.State.Team}}</span>!
|
|
{{end}}
|
|
</p>
|
|
</div>
|
|
<hr />
|
|
{{if .Room.IsRunning}}
|
|
{{template "cardcounter" .Room}}
|
|
{{end}}
|
|
|
|
<div id="addbot">
|
|
{{if and (eq .State.Username .Room.CreatorName) (not .Room.IsRunning)}}
|
|
{{template "addbot" .}}
|
|
{{end}}
|
|
</div>
|
|
<div class="flex justify-center">
|
|
<!-- Left Panel -->
|
|
{{template "teamlist" .Room.BlueTeam}}
|
|
{{if and (ne .State.Team "blue") (not .Room.IsRunning)}}
|
|
{{template "teampew" "blue"}}
|
|
{{end}}
|
|
<!-- Right Panel -->
|
|
{{if and (ne .State.Team "red") (not .Room.IsRunning)}}
|
|
{{template "teampew" "red"}}
|
|
{{end}}
|
|
{{template "teamlist" .Room.RedTeam}}
|
|
</div>
|
|
<hr />
|
|
<div id="cardtable">
|
|
{{template "cardtable" .Room}}
|
|
</div>
|
|
<div>
|
|
{{if and (eq .State.Role "guesser") (eq .State.Team .Room.TeamTurn)}}
|
|
<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)}}
|
|
{{template "mimeclue"}}
|
|
{{end}}
|
|
</div>
|
|
<div hx-get="/actionhistory" hx-trigger="sse:backlog_{{.Room.ID}}">
|
|
{{template "actionhistory" .Room.ActionHistory}}
|
|
</div>
|
|
{{if not .Room.IsRunning}}
|
|
<div id="exitbtn">
|
|
<button button id="exit-room-btn" type="submit" class="justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" hx-get="/room/exit" hx-target="#ancestor">Exit Room</button>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|