<script>
    export let size;
    export let _id;
    export let position;
    export let img;
    export let name;
    export let price;
    export let tiletype;
    export let partyid;
    export let playerposition;

    var style="tile";
    if(size=="big") style="bigtile";

    var promise = Edge.Client.rpc("getPlayerPartys",partyid);
</script>

<div class="{style} {tiletype}"  style="background-image: url({img});">
    
    <span style="color: white; margin: 5px; padding: 5px;font-size: 700; background-color: rgba(0,0,0,0.4)">{name}</span>
    <span style="color: white; margin: 5px; padding: 5px;font-size: 700; background-color: rgba(0,0,0,0.4)">{position}</span>
    {#await promise}
        <p>wainting ...</p>
     {:then players}
        {#each players as player}
            {#if player.tileid == _id }
            <div style="background-color: {player.color}; width:40px;height:40px; border-radius:100%"></div>
            {/if}
        {/each}
    {:catch err}
        {err.message}

    {/await}
</div>
            

