2021-08-30 10:46:18 +00:00
|
|
|
<script context="module">
|
|
|
|
export async function load({ page, fetch, session, context }) {
|
|
|
|
return {
|
|
|
|
props: {
|
|
|
|
theme: context.theme,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
Alert,
|
|
|
|
Badge,
|
2021-09-01 08:15:26 +00:00
|
|
|
Button,
|
|
|
|
Card,
|
|
|
|
CardBody,
|
|
|
|
CardTitle,
|
|
|
|
Col,
|
2021-08-30 10:46:18 +00:00
|
|
|
Icon,
|
2021-09-01 08:15:26 +00:00
|
|
|
Row,
|
2021-08-30 10:46:18 +00:00
|
|
|
} from 'sveltestrap';
|
|
|
|
|
|
|
|
import { goto } from '$app/navigation';
|
|
|
|
|
|
|
|
import { my } from '../../stores/my.js';
|
|
|
|
|
|
|
|
export let theme = null;
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if theme && theme.exercices}
|
2021-09-01 08:15:26 +00:00
|
|
|
<Card class="niceborder text-indent mt-2 mb-4">
|
2021-08-30 10:46:18 +00:00
|
|
|
|
2021-09-01 08:15:26 +00:00
|
|
|
<CardBody class="bg-dark text-light">
|
|
|
|
<Row>
|
|
|
|
<Col>
|
|
|
|
<p class="mt-4 mx-3 card-text lead text-justify">{@html theme.headline}</p>
|
|
|
|
<p class="mb-4 mx-3 card-text text-justify">{@html theme.intro}</p>
|
|
|
|
</Col>
|
|
|
|
{#if theme.partner_txt || theme.partner_img || theme.partner_href}
|
|
|
|
<Col md="2" lg="3" class="d-none d-md-block">
|
|
|
|
<Card class="pt-3 px-3">
|
|
|
|
{#if theme.partner_img}
|
|
|
|
<img src="{theme.partner_img}" class="card-img-top">
|
|
|
|
{/if}
|
|
|
|
{#if theme.partner_txt || theme.partner_href}
|
|
|
|
<CardBody class="p-0 mt-3">
|
|
|
|
{#if theme.partner_txt}
|
|
|
|
{@html theme.partner_txt}
|
|
|
|
{/if}
|
|
|
|
{#if theme.partner_href}
|
|
|
|
<Button tag="a" color="primary" href="{theme.partner_href}">
|
|
|
|
Visiter le site
|
|
|
|
</Button>
|
|
|
|
{/if}
|
|
|
|
</CardBody>
|
|
|
|
{/if}
|
|
|
|
</Card>
|
|
|
|
</Col>
|
|
|
|
{/if}
|
|
|
|
</Row>
|
|
|
|
</CardBody>
|
2021-08-30 10:46:18 +00:00
|
|
|
|
|
|
|
<ul class="list-group">
|
|
|
|
{#each Object.keys(theme.exercices) as k, index}
|
|
|
|
<li
|
|
|
|
class="list-group-item"
|
|
|
|
class:list-group-item-action={$my && $my.exercices[k]}
|
2021-09-01 09:20:41 +00:00
|
|
|
on:click={goto(`${theme.urlid}/${theme.exercices[k].urlid}`)}
|
2021-08-30 10:46:18 +00:00
|
|
|
>
|
|
|
|
<div class="row">
|
2021-08-31 23:47:44 +00:00
|
|
|
<div class="col-1" style="margin-top: -0.5rem; margin-bottom: -0.5rem; text-align: right; border-right: 5px solid #{$my && $my.exercices[k] && $my.exercices[k].solved_rank ? '62c462' : 'bbb'}">
|
2021-08-30 10:46:18 +00:00
|
|
|
</div>
|
|
|
|
<div class="col-10">
|
|
|
|
<div style="position: absolute; margin-left: calc(var(--bs-gutter-x) * -.5 - 15px); margin-top: -0.5rem;">
|
|
|
|
<svg style="height: 50px; width: 23px;">
|
|
|
|
<rect
|
2021-08-31 23:47:44 +00:00
|
|
|
style="fill:#{$my && $my.exercices[k] && (index < 1 || ($my.exercices[Object.keys(theme.exercices)[index-1]] && $my.exercices[Object.keys(theme.exercices)[index-1]].solved_rank)) ? '62c462' : 'bbb'}"
|
2021-08-30 10:46:18 +00:00
|
|
|
width="5"
|
|
|
|
height="30"
|
|
|
|
x="10"
|
|
|
|
y="0" />
|
|
|
|
<path
|
2021-08-31 00:54:59 +00:00
|
|
|
style="fill:#{$my && $my.exercices[k] ? ($my.exercices[k].solved_rank ? '62c462' : (theme.exercices[k].curcoeff > 1.0 ? 'f89406' : '5bc0de')) : '555'}"
|
2021-08-30 10:46:18 +00:00
|
|
|
d="m 22,20 a 9.5700617,9.5700617 0 0 1 -9.5690181,9.57006 9.5700617,9.5700617 0 0 1 -9.57110534,-9.56797 9.5700617,9.5700617 0 0 1 9.56692984,-9.57215 9.5700617,9.5700617 0 0 1 9.5731926,9.56588" />
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
{#each theme.exercices[k].tags as tag, idx}
|
2021-09-01 09:20:41 +00:00
|
|
|
<Badge href="tags/{tag}" pill color="secondary" class="mx-1 float-end">#{tag}</Badge>
|
2021-08-30 10:46:18 +00:00
|
|
|
{/each}
|
|
|
|
<h5 class="fw-bold">
|
|
|
|
{#if $my && $my.exercices[k]}
|
|
|
|
{theme.exercices[k].title}
|
|
|
|
{:else}
|
|
|
|
<span style="white-space: nowrap">
|
|
|
|
<Icon name="lock-fill" aria-hidden="true" title="Vous n'avez pas encore accès à ce défi" />
|
|
|
|
{theme.exercices[k].title}
|
|
|
|
</span>
|
|
|
|
{/if}
|
|
|
|
{#if theme.exercices[k].curcoeff > 1.0}
|
|
|
|
<Icon name="gift" aria-hidden="true" title="Un bonus est actuellement appliqué lors de la résolution de ce défi" />
|
|
|
|
{/if}
|
|
|
|
</h5>
|
|
|
|
<p>{@html theme.exercices[k].headline}</p>
|
|
|
|
</div>
|
|
|
|
<div class="d-none d-md-block col-1">
|
|
|
|
{#if $my && $my.exercices[k]}
|
|
|
|
<a class="float-right" href="{theme.urlid}/{theme.exercices[k].urlid}" style="font-size: 3rem">
|
|
|
|
<Icon name="chevron-right" aria-hidden="true" />
|
|
|
|
</a>
|
|
|
|
{:else}
|
|
|
|
<span class="float-right" style="font-size: 3rem">
|
|
|
|
<Icon name="chevron-right" aria-hidden="true" />
|
|
|
|
</span>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
{/each}
|
|
|
|
</ul>
|
|
|
|
|
2021-09-01 08:15:26 +00:00
|
|
|
</Card>
|
2021-08-30 10:46:18 +00:00
|
|
|
{:else}
|
|
|
|
<Alert color="danger" fade={false}>
|
|
|
|
<Icon name="dash-circle-fill" />
|
|
|
|
Ce scénario n'existe pas.
|
|
|
|
</Alert>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.list-group-item-action {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
</style>
|