ui: Include badge on CardTheme

This commit is contained in:
nemunaire 2021-09-02 16:39:58 +02:00
parent 9dcd43664a
commit b0a7daf1f4

View File

@ -1,6 +1,7 @@
<script>
import {
Alert,
Badge,
Card,
CardBody,
CardTitle,
@ -9,6 +10,10 @@
Row,
} from 'sveltestrap';
import { my } from '../stores/my.js';
import { max_solved } from '../stores/themes.js';
import { myThemes } from '../stores/mythemes.js';
export { className as class };
export let theme = {};
export let exercice = null;
@ -26,6 +31,25 @@
{/if}
<CardBody class="text-indent">
<CardTitle class="fw-bolder">
{#if $my && $my.team_id}
<div class="float-end">
{#if $max_solved > 1 && theme.solved == $max_solved}
<Badge color="danger">
<Icon name="heart-fill" />
</Badge>
{/if}
{#if theme.exercice_coeff_max > 1}
<Badge color="warning">
<Icon name="gift-fill" />
</Badge>
{/if}
{#if $myThemes[theme.id].exercice_solved > 0}
<Badge color="light">
{$myThemes[theme.id].exercice_solved}/{theme.exercice_count}
</Badge>
{/if}
</div>
{/if}
{#if exercice}{exercice.title}{:else}{theme.name}{/if}
</CardTitle>
<p class="card-text text-justify">{#if exercice}{@html exercice.headline}{:else}{@html theme.headline}{/if}</p>