ui: Ensure $teams is correctly populated

This commit is contained in:
nemunaire 2022-02-02 16:03:24 +01:00
parent 5d36c8a2c2
commit 2b87449475

View File

@ -84,7 +84,7 @@
{#if $my && $my.team_id}
<NavItem>
{Math.round($my.score*100)/100} {$my.score === 1 ? 'point' : 'points'}
{#if $teams && $teams[$my.team_id].rank}
{#if $teams && $teams[$my.team_id] && $teams[$my.team_id].rank}
&ndash; {$teams[$my.team_id].rank}<sup>e</sup> sur {Object.keys($teams).length}
{/if}
</NavItem>
@ -94,10 +94,16 @@
<Badge href="register" color="warning">
Inscription
</Badge>
{:else if $my.team_id && $teams}
<Badge href="edit" style="background-color: {$teams[$my.team_id].color} !important; color: {$teams[$my.team_id].color};">
<span class="teamname">{$my.name}</span>
</Badge>
{:else if $my.team_id}
{#if $teams && $teams[$my.team_id]}
<Badge href="edit" style="background-color: {$teams[$my.team_id].color} !important; color: {$teams[$my.team_id].color};">
<span class="teamname">{$my.name}</span>
</Badge>
{:else}
<Badge href="edit" color="info">
<span class="teamname">{$my.name}</span>
</Badge>
{/if}
{/if}
</NavItem>
</Nav>