strand/src/lib/GymProgress.svelte

42 lines
1,012 B
Svelte
Raw Normal View History

<script lang="ts">
2025-02-05 11:16:27 +01:00
import { gym, currentView } from "./store";
const remaining = $gym.length;
let done = $derived($gym.filter((c) => c.completed).length);
const back = () => {
currentView.update((_) => 0);
};
</script>
2025-02-06 11:34:06 +01:00
<header>
<button class="clickable back" onclick={() => back()}>←</button>
2025-02-05 11:16:27 +01:00
<h1>
Gym {done}/{remaining}
</h1>
2025-02-06 11:34:06 +01:00
</header>
<main>
<progress hidden max={remaining} value={done}></progress>
2025-02-05 11:16:27 +01:00
<div class="calendar">
{#each $gym as col}
2025-02-06 11:34:06 +01:00
<article class="clickable">
2025-02-05 11:16:27 +01:00
<label>
<input type="checkbox" bind:checked={col.completed} />
<strong>{col.name}</strong>
<small>{col.planned_at}</small>
</label>
</article>
{/each}
</div>
2025-02-06 11:34:06 +01:00
</main>
<style>
2025-02-06 11:34:06 +01:00
main {
background-color: #f62b5a;
border-top: 4px solid rgba(0, 0, 0, 0.2)
2025-02-05 11:16:27 +01:00
}
article:nth-child(1) {
grid-column: 3;
}
</style>