feat: add initial model
This commit is contained in:
parent
0e65b1a575
commit
e0f0cca337
7
src/app.d.ts
vendored
7
src/app.d.ts
vendored
@ -1,13 +1,16 @@
|
||||
import type { WorkoutEntry } from "$lib/types";
|
||||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
interface PageData {
|
||||
workouts?: WorkoutEntry[];
|
||||
}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
export { };
|
||||
|
10
src/lib/storage.ts
Normal file
10
src/lib/storage.ts
Normal 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
7
src/lib/types/index.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
export interface WorkoutEntry {
|
||||
date: string;
|
||||
workout_type: string;
|
||||
duration_hours: number;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user