ui: Display a card to other exercices on home page

This commit is contained in:
nemunaire 2024-03-16 10:32:08 +01:00
parent 5e48ab0928
commit 516ebf9c5a
1 changed files with 15 additions and 1 deletions

View File

@ -33,13 +33,26 @@
if ($themesStore["0"] && !$themesStore["0"].locked && $themesStore["0"].exercices) {
let i = 1;
for (let j = $themesStore["0"].exercices.length - 1; j >= 0 && i < tmpitems.length; j--) {
let j = 0;
for (j = $themesStore["0"].exercices.length - 1; j >= 0 && i < tmpitems.length; j--) {
if ($my && $my.team_id && !$my.exercices[$themesStore["0"].exercices[j].id])
continue;
tmpitems.splice(i, 0, {id: tmpitems.length, theme: $themesStore["0"], exercice: $themesStore["0"].exercices[j]});
i += 2;
}
if (j >= 0) {
tmpitems.push({
id: tmpitems.length,
theme: {
...$themesStore["0"],
name: "Voir les autres défis",
headline: "Il y a " + ($themesStore["0"].exercices.length) + " défis à découvrir&nbsp;! Cliquez ici pour les afficher.",
},
color: "light",
});
}
}
items = tmpitems;
@ -93,6 +106,7 @@
<CardTheme
class="{$my && $my.team_id && $myThemes[th.id].exercice_solved > 0?'border-light ':''}{th.exercice_coeff_max > 1?'border-success ':''}{th.locked?' border-secondary ':''}"
theme={th}
color={item.color ? item.color : "dark"}
on:click={goto(`${th.urlid}`)}
/>
{/if}