ui: Ensure a message is shown when theme is disabled

This commit is contained in:
nemunaire 2023-04-03 23:23:42 +02:00
parent 0a7b40abd7
commit 1a21115503
3 changed files with 39 additions and 6 deletions

View File

@ -15,6 +15,7 @@
export let hints = [];
export let exercice = {};
export let locked_theme = false;
let hints_submitted = {};
@ -117,7 +118,7 @@
{#if !(hint.content || hint.file) || (!hint.file && hint.hidden)}
<div>
{#if !(hint.content || hint.file)}
<button type="button" on:click={openHint(hint)} class="btn btn-info" class:disabled={hints_submitted[hint.id]} disabled={$settings.disablesubmitbutton}>
<button type="button" on:click={openHint(hint)} class="btn btn-info" class:disabled={hints_submitted[hint.id]} disabled={$settings.disablesubmitbutton || locked_theme}>
{#if hints_submitted[hint.id]}
<Spinner size="sm" class="me-2" />
{:else}

View File

@ -33,6 +33,11 @@
<Icon name="gift-fill" />
</Badge>
{/if}
{#if th.locked}
<Badge color="light">
<Icon name="lock-fill" />
</Badge>
{/if}
<Badge>
{#if $my && $my.team_id}{$myThemes[th.id].exercice_solved}/{/if}{th.exercice_count}
</Badge>

View File

@ -30,6 +30,15 @@
{#if $current_exercice}
<Card body class="niceborder text-indent my-3">
{#if $current_theme.locked}
<div style="position: absolute; z-index: 0; top: 0; bottom: 0; left: 0; right: 0;" class="d-flex justify-content-center align-items-center">
<div style="transform: rotate(-25deg)">
<div class="display-3 font-weight-bolder border border-danger text-danger px-3 py-1" style="opacity: 0.5; border-radius: 20px; border-width: 5px !important; font-family: 'Courier New'">
CONFIDENTIEL
</div>
</div>
</div>
{/if}
<h3 class="display-4">{$current_exercice.title}</h3>
<div>
{#each $current_exercice.tags as tag, index}
@ -181,6 +190,7 @@
{/if}
{#if $my.exercices[$current_exercice.id].hints}
<ExerciceHints
locked_theme={$current_theme.locked}
exercice={$my.exercices[$current_exercice.id]}
hints={$my.exercices[$current_exercice.id].hints}
/>
@ -188,11 +198,28 @@
</Col>
<Col lg="6" class="mb-5">
{#if $my.exercices[$current_exercice.id].flags && $my.exercices[$current_exercice.id].non_found_flags > 0 && !solved[$current_exercice.id]}
<ExerciceFlags
exercice={$my.exercices[$current_exercice.id]}
bind:forcesolved={solved[$current_exercice.id]}
flags={$my.exercices[$current_exercice.id].flags}
/>
{#if $current_theme.locked}
<Card class="border-danger mb-2">
<CardHeader class="bg-black text-light">
<Icon name="lock-fill" />
Faire son rapport
</CardHeader>
<CardBody>
<p>
Ce scénario n'est pas accessible&nbsp;!
</p>
<p>
Vous ne pouvez pas compléter son rapport.
</p>
</CardBody>
</Card>
{:else}
<ExerciceFlags
exercice={$my.exercices[$current_exercice.id]}
bind:forcesolved={solved[$current_exercice.id]}
flags={$my.exercices[$current_exercice.id].flags}
/>
{/if}
{/if}
{#if $my.exercices[$current_exercice.id].solved_rank || solved[$current_exercice.id]}
<ExerciceSolved