feat: add initial model

This commit is contained in:
itsscb 2025-04-09 22:30:37 +02:00
parent 0e65b1a575
commit e0f0cca337
3 changed files with 22 additions and 2 deletions

5
src/app.d.ts vendored
View File

@ -1,10 +1,13 @@
import type { WorkoutEntry } from "$lib/types";
// See https://svelte.dev/docs/kit/types#app.d.ts // See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces // for information about these interfaces
declare global { declare global {
namespace App { namespace App {
// interface Error {} // interface Error {}
// interface Locals {} // interface Locals {}
// interface PageData {} interface PageData {
workouts?: WorkoutEntry[];
}
// interface PageState {} // interface PageState {}
// interface Platform {} // interface Platform {}
} }

10
src/lib/storage.ts Normal file
View File

@ -0,0 +1,10 @@
import type { WorkoutEntry } from '$lib/types';
export function getWorkouts(): WorkoutEntry[] {
if (typeof localStorage === 'undefined') return [];
return JSON.parse(localStorage.getItem('workouts') || '[]');
}
export function saveWorkouts(workouts: WorkoutEntry[]) {
localStorage.setItem('workouts', JSON.stringify(workouts));
}

7
src/lib/types/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export interface WorkoutEntry {
date: string;
workout_type: string;
duration_hours: number;
}