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