Heftig rekatorering
This commit is contained in:
parent
3261e4c3bf
commit
1e32dd67c4
5 changed files with 13 additions and 12 deletions
|
|
@ -3,17 +3,18 @@
|
|||
import ExerciseField from './ExerciseField.svelte';
|
||||
import { getTodayDateString, exampleWorkout, type WorkoutData, exercises } from '$lib/workout';
|
||||
import { getTodaysWorkout, saveWorkout } from './workout.remote';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
let todayDate = getTodayDateString();
|
||||
|
||||
// Form state
|
||||
let form: WorkoutData = {
|
||||
let form: WorkoutData = $state({
|
||||
pushups: 0,
|
||||
situps: 0,
|
||||
plankSeconds: 0,
|
||||
hangups: 0,
|
||||
runKm: 0
|
||||
};
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
const result = await getTodaysWorkout();
|
||||
|
|
@ -36,7 +37,7 @@
|
|||
<form {...saveWorkout}>
|
||||
<!-- Exercise Fields -->
|
||||
{#each exercises as { config, key }}
|
||||
<ExerciseField {...config} bind:value={form[key]} defaultValue={form[key]} />
|
||||
<ExerciseField {...config} bind:value={form[key]} />
|
||||
{/each}
|
||||
|
||||
<!-- Action Buttons -->
|
||||
|
|
@ -57,6 +58,7 @@
|
|||
<!-- Message Display -->
|
||||
{#if saveWorkout.result?.success}
|
||||
<div
|
||||
transition:fade={{ duration: 300 }}
|
||||
class="mb-4 rounded-md border border-green-200 bg-green-100 p-3 text-sm font-medium text-green-800"
|
||||
role="alert"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue