Heftig rekatorering
This commit is contained in:
parent
3261e4c3bf
commit
1e32dd67c4
5 changed files with 13 additions and 12 deletions
1
.env
1
.env
|
|
@ -1 +0,0 @@
|
||||||
DATABASE_URL=postgres://postgres:voHMlrqwwzlZcqWW3oCYvkmWnmOAFntc4nYJmTRVsr7bm8CiOoxqAKv1zVn5Opsq@192.168.0.133:5432/postgres
|
|
||||||
|
|
@ -11,6 +11,7 @@ RUN npm ci
|
||||||
|
|
||||||
# Copy source code and build the application
|
# Copy source code and build the application
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN npx svelte-kit sync
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage - clean runtime environment
|
# Production stage - clean runtime environment
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
interface Props extends ExerciseConfig {
|
interface Props extends ExerciseConfig {
|
||||||
value: number;
|
value: number;
|
||||||
defaultValue: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
|
@ -16,7 +15,7 @@
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
// Destructure the remaining props for easier access
|
// Destructure the remaining props for easier access
|
||||||
const { icon, name, quickAddOptions, defaultValue, unit } = restProps;
|
const { icon, name, quickAddOptions, unit } = restProps;
|
||||||
|
|
||||||
const label = unit ? `${icon} ${name} (${unit})` : `${icon} ${name}`;
|
const label = unit ? `${icon} ${name} (${unit})` : `${icon} ${name}`;
|
||||||
|
|
||||||
|
|
@ -47,7 +46,6 @@
|
||||||
{min}
|
{min}
|
||||||
{max}
|
{max}
|
||||||
{step}
|
{step}
|
||||||
{defaultValue}
|
|
||||||
required={true}
|
required={true}
|
||||||
class="flex-1 rounded-md border border-gray-300 px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
class="flex-1 rounded-md border border-gray-300 px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,18 @@
|
||||||
import ExerciseField from './ExerciseField.svelte';
|
import ExerciseField from './ExerciseField.svelte';
|
||||||
import { getTodayDateString, exampleWorkout, type WorkoutData, exercises } from '$lib/workout';
|
import { getTodayDateString, exampleWorkout, type WorkoutData, exercises } from '$lib/workout';
|
||||||
import { getTodaysWorkout, saveWorkout } from './workout.remote';
|
import { getTodaysWorkout, saveWorkout } from './workout.remote';
|
||||||
|
import { fade } from 'svelte/transition';
|
||||||
|
|
||||||
let todayDate = getTodayDateString();
|
let todayDate = getTodayDateString();
|
||||||
|
|
||||||
// Form state
|
// Form state
|
||||||
let form: WorkoutData = {
|
let form: WorkoutData = $state({
|
||||||
pushups: 0,
|
pushups: 0,
|
||||||
situps: 0,
|
situps: 0,
|
||||||
plankSeconds: 0,
|
plankSeconds: 0,
|
||||||
hangups: 0,
|
hangups: 0,
|
||||||
runKm: 0
|
runKm: 0
|
||||||
};
|
});
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const result = await getTodaysWorkout();
|
const result = await getTodaysWorkout();
|
||||||
|
|
@ -36,7 +37,7 @@
|
||||||
<form {...saveWorkout}>
|
<form {...saveWorkout}>
|
||||||
<!-- Exercise Fields -->
|
<!-- Exercise Fields -->
|
||||||
{#each exercises as { config, key }}
|
{#each exercises as { config, key }}
|
||||||
<ExerciseField {...config} bind:value={form[key]} defaultValue={form[key]} />
|
<ExerciseField {...config} bind:value={form[key]} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
<!-- Action Buttons -->
|
<!-- Action Buttons -->
|
||||||
|
|
@ -57,6 +58,7 @@
|
||||||
<!-- Message Display -->
|
<!-- Message Display -->
|
||||||
{#if saveWorkout.result?.success}
|
{#if saveWorkout.result?.success}
|
||||||
<div
|
<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"
|
class="mb-4 rounded-md border border-green-200 bg-green-100 p-3 text-sm font-medium text-green-800"
|
||||||
role="alert"
|
role="alert"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@ import { command, form, query } from '$app/server';
|
||||||
import { db } from '$lib/db';
|
import { db } from '$lib/db';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { WorkoutData } from '../lib/workout/types';
|
import type { WorkoutData } from '../lib/workout/types';
|
||||||
|
import { exerciseConfigs, exercises } from '$lib/workout';
|
||||||
|
|
||||||
export const saveWorkout = form(async (data) => {
|
export const saveWorkout = form(async (data) => {
|
||||||
let pushups = Number(data.get('pushups'));
|
let pushups = Number(data.get(exerciseConfigs.pushups.name));
|
||||||
let situps = Number(data.get('situps'));
|
let situps = Number(data.get(exerciseConfigs.situps.name));
|
||||||
let plankSeconds = Number(data.get('plankSeconds'));
|
let plankSeconds = Number(data.get(exerciseConfigs.plankSeconds.name));
|
||||||
let hangups = Number(data.get('hangups'));
|
let hangups = Number(data.get(exerciseConfigs.hangups.name));
|
||||||
let runKm = Number(data.get('runKm'));
|
let runKm = Number(data.get(exerciseConfigs.runKm.name));
|
||||||
|
|
||||||
// Validate input data
|
// Validate input data
|
||||||
if (typeof pushups !== 'number' || isNaN(pushups) || pushups < 0) {
|
if (typeof pushups !== 'number' || isNaN(pushups) || pushups < 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue