Add the ColourChoice modal to the lobby
This commit is contained in:
parent
36487500e1
commit
f3af5a77d7
1 changed files with 26 additions and 27 deletions
|
|
@ -1,12 +1,19 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import ColourChoice from "../../components/modals/ColourChoice.svelte";
|
||||||
import OptionInfo from "../../components/modals/OptionInfo.svelte";
|
import OptionInfo from "../../components/modals/OptionInfo.svelte";
|
||||||
import SciFiCheckbox from "../../components/SciFi-Checkbox.svelte";
|
import SciFiCheckbox from "../../components/SciFi-Checkbox.svelte";
|
||||||
import SciFiButton from "../../components/SciFi-Button.svelte";
|
import SciFiButton from "../../components/SciFi-Button.svelte";
|
||||||
import Player from "../../components/Player.svelte";
|
import Player from "../../components/Player.svelte";
|
||||||
import { myName, hostName } from "../../stores";
|
import { isHost, players } from "../../stores";
|
||||||
|
|
||||||
function tempButtonHandler() {};
|
function tempButtonHandler() {};
|
||||||
|
|
||||||
|
// The modals that can appear in the lobby
|
||||||
|
const modal = {
|
||||||
|
options: false,
|
||||||
|
colourChoice: false,
|
||||||
|
};
|
||||||
|
|
||||||
const gameOptions = [
|
const gameOptions = [
|
||||||
{
|
{
|
||||||
name: `No Secrets`,
|
name: `No Secrets`,
|
||||||
|
|
@ -51,17 +58,16 @@ function toggleOption(e: CustomEvent<string>) {
|
||||||
|
|
||||||
// TODO: Send websocket event to server
|
// TODO: Send websocket event to server
|
||||||
};
|
};
|
||||||
|
|
||||||
let optionsModal = false;
|
|
||||||
function toggleOptionsModal() {
|
|
||||||
console.log(`Toggling options modal`)
|
|
||||||
optionsModal = !optionsModal;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<OptionInfo
|
<OptionInfo
|
||||||
open="{optionsModal}"
|
open="{modal.options}"
|
||||||
on:close="{toggleOptionsModal}"
|
on:close="{_ => modal.options = false}"
|
||||||
|
/>
|
||||||
|
<ColourChoice
|
||||||
|
open="{modal.colourChoice}"
|
||||||
|
on:selectColour="{tempButtonHandler}"
|
||||||
|
on:close="{_ => modal.colourChoice = false}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
@ -70,23 +76,16 @@ function toggleOptionsModal() {
|
||||||
<div class="sci-fi-box">
|
<div class="sci-fi-box">
|
||||||
<h2>Players</h2>
|
<h2>Players</h2>
|
||||||
<div class="player-box">
|
<div class="player-box">
|
||||||
|
{#each $players as p, i}
|
||||||
<Player
|
<Player
|
||||||
name="Player 1"
|
name="{p.name}"
|
||||||
colour="#00aa00"
|
colour="{p.colour}"
|
||||||
/>
|
on:changeColour="{_ => modal.colourChoice = true}"
|
||||||
<Player
|
|
||||||
name="Player 2"
|
|
||||||
colour="#aaaa00"
|
|
||||||
/>
|
/>
|
||||||
|
{#if i == 1}
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<Player
|
{/if}
|
||||||
name="Player 3"
|
{/each}
|
||||||
colour="#00aaaa"
|
|
||||||
/>
|
|
||||||
<Player
|
|
||||||
name="Player 4"
|
|
||||||
colour="#ffaaff"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sci-fi-box">
|
<div class="sci-fi-box">
|
||||||
|
|
@ -107,7 +106,7 @@ function toggleOptionsModal() {
|
||||||
<SciFiCheckbox
|
<SciFiCheckbox
|
||||||
name="{option.name}"
|
name="{option.name}"
|
||||||
id="{option.id}"
|
id="{option.id}"
|
||||||
disabled="{$myName != $hostName}"
|
disabled="{!$isHost}"
|
||||||
bind:state="{option.active}"
|
bind:state="{option.active}"
|
||||||
on:toggle="{toggleOption}"
|
on:toggle="{toggleOption}"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue