ars/templates/view.stpl
2023-11-05 19:54:47 +01:00

53 lines
1.8 KiB
Text

<% if !htmx {%>
<!DOCTYPE html>
<html>
<head>
<title>zettoIT ARS</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="/static/zettoit-style/zettoit.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.qrcode svg{
filter: invert();
width: 100%;
height: auto;
}
</style>
</head>
<body>
<script src="/static/chart.js"></script>
<main class="container" hx-sse="connect:/<%= id %>/view/events swap:message">
<% } %>
<% if let ViewerState::Answering{ inner_body } = state { %>
<%- inner_body %>
<button hx-post="" class="outline">Show correct Answer</button>
<% } else if let ViewerState::Result{ last_question, inner_body} = state { %>
<%- inner_body %>
<% if last_question { %>
<button hx-post="" class="outline">End Quiz</button>
<% } else { %>
<button hx-post="" class="outline">Next Question</button>
<% } %>
<% } else if let ViewerState::NotStarted((player, qrcode, url)) = state { %>
</article>
<center class="qrcode"><%- qrcode %></center>
<center>or visit <%= url %></center>
<button hx-post="" class="outline">Start Quiz with <b><%= player %></b> Players</button>
</article>
<% } else {%>
<article>
The Quiz finished. You can close this tab now.
</article>
<% } %>
<% if !htmx { %>
</main>
<a class="watermark" href="https://git2.zettoit.eu/zettoit"><img src="/static/zettoit-style/zettoit.svg" alt="zettoIT Logo"></a>
<script src="/static/htmx.min.js"></script>
</body>
</html>
<% } %>