ui: Handle standalone exercice in menus and pages
This commit is contained in:
parent
d234bbf272
commit
13a11269a8
@ -10,11 +10,11 @@
|
||||
|
||||
import { current_exercice } from '$lib/stores/exercices';
|
||||
import { my } from '$lib/stores/my.js';
|
||||
import { current_theme, max_solved } from '$lib/stores/themes.js';
|
||||
import { current_theme, max_solved, themesStore } from '$lib/stores/themes.js';
|
||||
import { myThemes, themes } from '$lib/stores/mythemes.js';
|
||||
</script>
|
||||
|
||||
<Dropdown nav inNavbar active={$current_theme}>
|
||||
<Dropdown nav inNavbar active={$current_theme && $current_theme.id != 0}>
|
||||
<DropdownToggle nav caret>
|
||||
<Icon name="tv" />
|
||||
Scenarii
|
||||
@ -22,6 +22,7 @@
|
||||
<DropdownMenu class="niceborder">
|
||||
<div>
|
||||
{#each $themes as th, index}
|
||||
{#if th.id != 0}
|
||||
<DropdownItem href="{th.urlid}" active={$current_theme && $current_theme.id == th.id}>
|
||||
{th.name}
|
||||
{#if $max_solved > 1 && th.solved == $max_solved}
|
||||
@ -43,10 +44,43 @@
|
||||
{#if $my && $my.team_id}{$myThemes[th.id].exercice_solved}/{/if}{th.exercice_count}
|
||||
</Badge>
|
||||
</DropdownItem>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
{#if $themesStore && $themesStore["0"] && $themesStore["0"].exercices}
|
||||
<Dropdown nav inNavbar active={$current_theme && $current_theme && $current_theme.id == 0}>
|
||||
<DropdownToggle nav caret>
|
||||
<Icon name="pencil" />
|
||||
Défis
|
||||
</DropdownToggle>
|
||||
<DropdownMenu class="niceborder">
|
||||
<div>
|
||||
{#each $themesStore["0"].exercices as exercice, index}
|
||||
<DropdownItem href="{$themesStore["0"].urlid}/{exercice.urlid}" active={$current_theme && $current_theme.id == 0 && $current_exercice && $current_exercice.id == exercice.id}>
|
||||
{exercice.title}
|
||||
{#if exercice.solved}
|
||||
<Badge color="secondary">
|
||||
<Icon name="check" />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if exercice.curcoeff > 1}
|
||||
<Badge color="success">
|
||||
<Icon name="gift-fill" />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if $themesStore["0"].locked || exercice.disabled}
|
||||
<Badge color="light">
|
||||
<Icon name="lock-fill" />
|
||||
</Badge>
|
||||
{/if}
|
||||
</DropdownItem>
|
||||
{/each}
|
||||
</div>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
div {
|
||||
|
@ -35,7 +35,11 @@
|
||||
<Column header="Raison">
|
||||
{#if row.reason == "Validation"}
|
||||
<Badge color="success"><Icon name="check" /></Badge>
|
||||
{#if !$exercices_idx[row.id_exercice].id_theme == 0}
|
||||
Défi validé
|
||||
{:else}
|
||||
Étape validée
|
||||
{/if}
|
||||
{:else if row.reason == "First blood"}
|
||||
<Badge color="light"><Icon name="trophy" /></Badge>
|
||||
Bonus premier sang
|
||||
@ -56,7 +60,7 @@
|
||||
{row.reason}
|
||||
{/if}
|
||||
{#if row.id_exercice && $exercices_idx[row.id_exercice]}
|
||||
sur <a href="/{$themes[$exercices_idx[row.id_exercice].id_theme].urlid}/{$exercices_idx[row.id_exercice].urlid}">
|
||||
: <a href="/{$themes[$exercices_idx[row.id_exercice].id_theme].urlid}/{$exercices_idx[row.id_exercice].urlid}">
|
||||
{$exercices_idx[row.id_exercice].title}
|
||||
</a>
|
||||
{/if}
|
||||
|
@ -50,11 +50,25 @@
|
||||
<div style="background-image: url({heading_image})" class="page-header">
|
||||
<Container class="text-primary">
|
||||
<h1 class="display-2">
|
||||
{#if $current_theme.urlid == "_"}
|
||||
<a href="{$current_theme.urlid}">{#if $current_exercice}{$current_exercice.title}{:else}Défis indépendants{/if}</a>
|
||||
{:else}
|
||||
<a href="{$current_theme.urlid}">{$current_theme.name}</a>
|
||||
{/if}
|
||||
</h1>
|
||||
<h2>{@html current_authors}</h2>
|
||||
<h2>
|
||||
{#if current_authors}
|
||||
{@html current_authors}
|
||||
{:else}
|
||||
{$challengeInfo.authors}
|
||||
{/if}
|
||||
</h2>
|
||||
</Container>
|
||||
{#if heading_image}
|
||||
<div class="headerfade"></div>
|
||||
{:else}
|
||||
<div style="height: 3rem;"></div>
|
||||
{/if}
|
||||
</div>
|
||||
<Container>
|
||||
<slot></slot>
|
||||
|
@ -27,6 +27,8 @@
|
||||
Vous n'avez pas encore accès à ce défi.
|
||||
</Alert>
|
||||
{:else}
|
||||
{#if $current_theme.id != 0}
|
||||
<ThemeNav theme={$current_theme} exercice={$current_exercice} />
|
||||
{/if}
|
||||
<slot></slot>
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user