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