Handle routines

This commit is contained in:
nemunaire 2022-10-04 18:34:37 +02:00
commit 97fa583814
8 changed files with 338 additions and 40 deletions

View file

@ -1,7 +1,9 @@
<script>
import {
Badge,
Button,
Card,
CardBody,
CardHeader,
Col,
Container,
@ -11,25 +13,11 @@
Icon,
} from 'sveltestrap';
import { actions_idx } from '../stores/actions';
export let routine = {
title: "Classique",
steps: [
{
id: 1,
name: "Salutation & heure",
start: 0,
},
{
id: 2,
name: "7 min workout",
start: 60,
},
{
id: 3,
name: "RATP traffic",
start: 540,
},
],
name: "Classique",
steps: [],
};
</script>
@ -49,11 +37,26 @@
>
<Icon name="pencil" />
</Button>
{routine.title}
{routine.name}
</CardHeader>
<ListGroup>
{#each routine.steps as step (step.id)}
<ListGroupItem action>{step.name}</ListGroupItem>
{/each}
</ListGroup>
{#if routine.steps}
<ListGroup>
{#each routine.steps as step}
<ListGroupItem action>
{#if $actions_idx && $actions_idx[step.action]}
{$actions_idx[step.action].name}
{:else}
{step.action}
{/if}
<Badge class="float-end">
{step.delay/60} min
</Badge>
</ListGroupItem>
{/each}
</ListGroup>
{:else}
<CardBody>
Aucune action définie.
</CardBody>
{/if}
</Card>