<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});">
    
    <div style="color: white; padding: 5px; background-color: rgba(0,0,0,0.8); text-align: center">{name}</div>
    {#await promise}
        <p>waiting ...</p>
     {:then players}
        {#each players as player}
            {#if player.tileid == _id }
            <div style="width: 80px;height: 80px; background: url(./medias/logo/arnold.png) no-repeat {player.color}; background-size: 52px; background-position: center; border-radius: 50px"></div>
            {/if}
        {/each}
    {:catch err}
        {err.message}

    {/await}
</div>
            