2022-12-29 17:32:14 +01:00
|
|
|
<!doctype html>
|
2022-12-29 17:19:36 +01:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
2022-12-29 17:32:14 +01:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2022-12-29 17:19:36 +01:00
|
|
|
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script>
|
|
|
|
<script src="index.js"></script>
|
|
|
|
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
|
|
|
<link rel="stylesheet" href="index.css">
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<main class="container">
|
|
|
|
<div x-data>
|
|
|
|
<div x-show="$store.localState.joined">
|
|
|
|
<hgroup>
|
2022-12-29 20:26:40 +01:00
|
|
|
<h1
|
|
|
|
x-text="'Currently playing: ' + ($store.remoteState.isMyTurn ? 'YOU!':$store.remoteState.players[$store.remoteState.currentPlayer])">
|
2022-12-29 17:19:36 +01:00
|
|
|
</h1>
|
2022-12-29 17:59:24 +01:00
|
|
|
<h2 x-text="'You are ' + $store.localState.name"></h2>
|
2022-12-29 17:19:36 +01:00
|
|
|
</hgroup>
|
|
|
|
|
|
|
|
<div x-data="Timer">
|
2022-12-29 20:46:09 +01:00
|
|
|
<div x-show="!time">
|
|
|
|
<div class="timer loading" href="#" aria-busy="true">please wait</div>
|
|
|
|
</div>
|
|
|
|
<div x-show="time">
|
2022-12-29 20:26:40 +01:00
|
|
|
<p :class="'timer' + ($store.remoteState.isMyTurn ? ' my-turn':'') + (time < 0 ? ' over':'')"
|
|
|
|
x-text="time + 's'"></p>
|
2022-12-29 20:46:09 +01:00
|
|
|
</div>
|
2022-12-29 17:19:36 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<button @click="$store.remoteState.giveTurnToNextPlayer()"
|
|
|
|
x-bind:disabled="$store.remoteState.currentPlayer !== $store.localState.id">I'm done!</button>
|
2022-12-29 20:26:40 +01:00
|
|
|
|
|
|
|
<label for="nextPlayer_select">Player after me: <b
|
|
|
|
x-text="$store.remoteState.players[$store.localState.nextPlayer]"></b> </label>
|
|
|
|
<select x-model="$store.localState.nextPlayer" id="nextPlayer_select">
|
2022-12-29 17:19:36 +01:00
|
|
|
<template
|
|
|
|
x-for="playerId in Object.keys($store.remoteState.players).filter(id => id != $store.localState.id)"
|
|
|
|
:key="playerId">
|
|
|
|
<option x-bind:value="playerId" x-text="$store.remoteState.players[playerId]"></option>
|
|
|
|
</template>
|
|
|
|
</select>
|
2022-12-29 20:26:40 +01:00
|
|
|
|
|
|
|
<fieldset>
|
|
|
|
<label for="sound_enabled">
|
|
|
|
<input x-model="$store.audio.isEnabled" @click="$store.audio.testPermission()" type="checkbox" id="sound_enabled" name="sound_enabled" role="switch">
|
|
|
|
Enable sound
|
|
|
|
</label>
|
|
|
|
</fieldset>
|
|
|
|
|
2022-12-29 17:19:36 +01:00
|
|
|
<div class="grid">
|
|
|
|
<button class="secondary outline" @click="$store.localState.leave()">Leave</button>
|
|
|
|
<button class="secondary outline" @click="$store.remoteState.clear()">Clear</button>
|
|
|
|
</div>
|
2022-12-29 20:26:40 +01:00
|
|
|
|
2022-12-29 17:19:36 +01:00
|
|
|
<p>Other players:</p>
|
|
|
|
<ul>
|
|
|
|
<template x-for="playerId in Object.keys($store.remoteState.players)" :key="playerId">
|
|
|
|
<li x-text="$store.remoteState.players[playerId]"></li>
|
|
|
|
</template>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div x-show="!$store.localState.joined">
|
|
|
|
<form x-data="JoinForm()" @submit.prevent="submitForm">
|
|
|
|
<input type="text" x-model="formData.name" placeholder="Name">
|
|
|
|
<button type="submit">Join</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|