Make player component use the isHost store
This commit is contained in:
parent
6dc0ed2ab5
commit
2530e90774
1 changed files with 8 additions and 4 deletions
|
|
@ -1,16 +1,20 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { myName, hostName } from "../stores";
|
|
||||||
|
|
||||||
import SciFiButton from "./SciFi-Button.svelte";
|
import SciFiButton from "./SciFi-Button.svelte";
|
||||||
|
import { createEventDispatcher } from "svelte";
|
||||||
|
import { myName, isHost } from "../stores";
|
||||||
|
|
||||||
export let name: string;
|
export let name: string;
|
||||||
export let colour: string;
|
export let colour: string;
|
||||||
|
|
||||||
|
const emit = createEventDispatcher();
|
||||||
|
|
||||||
function exitPlayer() {};
|
function exitPlayer() {};
|
||||||
|
|
||||||
function changeColour() {};
|
function changeColour() {
|
||||||
|
emit("changeColour");
|
||||||
|
};
|
||||||
|
|
||||||
let canLeave = $myName == $hostName || name == $myName;
|
let canLeave = $isHost || name == $myName;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="player" style="--colour: {colour};">
|
<div class="player" style="--colour: {colour};">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue