FEATURE: migrated the chat window to svelte
This commit is contained in:
parent
e5f7c62e25
commit
3cfbcc6b02
24 changed files with 470 additions and 305 deletions
37
front/src/Components/Chat/ChatPlayerName.svelte
Normal file
37
front/src/Components/Chat/ChatPlayerName.svelte
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue