<script>
	import { get } from "svelte/store";


    export let partyid;
    export let playerid;

    var player;
    var tile;
    async function getPlayer() {
        player = await Edge.Client.rpc("getPlayerParty",{"partyid": partyid, "playerid": playerid });
        tile = await Edge.Client.rpc("getTile", player.tileid)
    }

    let promise = getPlayer();
</script>
    
<div style="color: white; padding: 5px; background-color: rgba(0,0,0,0.8); text-align: center">
    {#await promise}
        <p>waiting ...</p>
     {:then ok}
     <div class="flex flex-col p-1 w-20 h-80 md:w-auto md:h-auto items-center justify-center mx-1 text-black" style="background-color: {player.color}">
        
        <img src="./medias/logo/arnold.png" alt="arnold">
        {player.player.name}<br>
        Argent: {player.cash}<br>
        Position: {tile.name}
        <!-- <span class="text-xs text-center">Joueur<br><span class="{(player._id==my._id?"text-3xl":"")}">{(player._id==my._id?"MOI":player.name)}</span></span> -->
    </div>
    {:catch err}
        {err.message}

    {/await}
</div>