FEATURE: migrated the chat window to svelte

This commit is contained in:
kharhamel 2021-07-07 18:07:58 +02:00
parent e5f7c62e25
commit 3cfbcc6b02
24 changed files with 470 additions and 305 deletions

View file

@ -0,0 +1,37 @@
<script lang="ts">
import type {PlayerInterface} from "../../Phaser/Game/PlayerInterface";
import {requestVisitCardsStore} from "../../Stores/GameStore";
export let player:PlayerInterface;
let showMenu: boolean = false;
function openVisitCard() {
if (player.visitCardUrl) {
requestVisitCardsStore.set(player.visitCardUrl);
}
}
</script>
<span class="chatPlayerName" style="color: {player.color || 'white'}" on:click={() => showMenu = !showMenu}>
{player.name}
</span>
{#if showMenu}
<ul class="selectMenu">
<li><button class="text-btn" disabled={!player.visitCardUrl} on:click={openVisitCard}>Visit card</button></li>
</ul>
{/if}
<style lang="scss">
.chatPlayerName:hover {
text-decoration: underline;
cursor: pointer;
}
ul.selectMenu {
background-color: whitesmoke;
position: absolute;
right: 0;
border-radius: 4px;
}
</style>