server/frontend/ui/src/components/NavThemes.svelte

51 lines
1.4 KiB
Svelte
Raw Normal View History

<script>
import {
Badge,
Dropdown,
DropdownItem,
DropdownMenu,
DropdownToggle,
Icon,
} from 'sveltestrap';
import { my } from '../stores/my.js';
2021-08-31 19:47:49 +00:00
import { max_solved } from '../stores/themes.js';
import { myThemes, themes } from '../stores/mythemes.js';
</script>
<Dropdown nav inNavbar>
<DropdownToggle nav caret>
<Icon name="tv" />
2021-09-02 09:07:02 +00:00
Scenarii
</DropdownToggle>
<DropdownMenu class="niceborder" end>
2021-08-31 19:50:26 +00:00
<div>
{#each Object.keys($themes) as th, index}
2021-09-01 09:20:41 +00:00
<DropdownItem href="{$themes[th].urlid}">
2021-08-31 19:50:26 +00:00
{$themes[th].name}
{#if $max_solved > 1 && $themes[th].solved == $max_solved}
<Badge color="danger">
<Icon name="heart-fill" />
</Badge>
{/if}
{#if $themes[th].exercice_coeff_max > 1}
<Badge color="success">
<Icon name="gift-fill" />
</Badge>
{/if}
<Badge>
{#if $my && $my.team_id}{$myThemes[$themes[th].id].exercice_solved}/{/if}{$themes[th].exercice_count}
</Badge>
2021-08-31 19:50:26 +00:00
</DropdownItem>
{/each}
</div>
</DropdownMenu>
</Dropdown>
2021-08-31 19:50:26 +00:00
<style>
div {
overflow-y: auto;
max-height: calc(80vh - 100px);
}
</style>