diff --git a/package-lock.json b/package-lock.json index 5ec3525f..9d26e70c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "myfit", "version": "0.0.3", + "hasInstallScript": true, "dependencies": { "@auth/prisma-adapter": "^2.4.1", "@auth/sveltekit": "^1.4.1", @@ -22,7 +23,7 @@ "mode-watcher": "^0.4.0", "paneforge": "^0.0.5", "posthog-js": "^1.160.3", - "svelte-infinite": "^0.3.2", + "svelte-infinite-loading": "^1.4.0", "svelte-sonner": "^0.3.26", "tailwind-merge": "^2.4.0", "tailwind-variants": "^0.2.1", @@ -9178,14 +9179,11 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/svelte-infinite": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/svelte-infinite/-/svelte-infinite-0.3.2.tgz", - "integrity": "sha512-i69pdc1Q+YNdALHrVSoZIbvgKDuZf9UihOhrhGLekSkjNLwr6d57osrNnywKltYwg/n1r84hV8IGnSk7Jo03Qg==", - "license": "MIT", - "peerDependencies": { - "svelte": "^5.0.0-0" - } + "node_modules/svelte-infinite-loading": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/svelte-infinite-loading/-/svelte-infinite-loading-1.4.0.tgz", + "integrity": "sha512-Jo+f/yr/HmZQuIiiKKzAHVFXdAUWHW2RBbrcQTil8JVk1sCm/riy7KTJVzjBgQvHasrFQYKF84zvtc9/Y4lFYg==", + "license": "MIT" }, "node_modules/svelte-sonner": { "version": "0.3.28", diff --git a/package.json b/package.json index 6a51c923..a3ccd583 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "mode-watcher": "^0.4.0", "paneforge": "^0.0.5", "posthog-js": "^1.160.3", - "svelte-infinite": "^0.3.2", + "svelte-infinite-loading": "^1.4.0", "svelte-sonner": "^0.3.26", "tailwind-merge": "^2.4.0", "tailwind-variants": "^0.2.1", diff --git a/src/lib/components/DefaultInfiniteLoader.svelte b/src/lib/components/DefaultInfiniteLoader.svelte new file mode 100644 index 00000000..07237151 --- /dev/null +++ b/src/lib/components/DefaultInfiniteLoader.svelte @@ -0,0 +1,25 @@ + + + +
+ + That's all + +
+
No {entityPlural} found
+
+ +
+
diff --git a/src/routes/exercise-splits/+page.server.ts b/src/routes/exercise-splits/+page.server.ts deleted file mode 100644 index 75e8bc37..00000000 --- a/src/routes/exercise-splits/+page.server.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { createCaller } from '$lib/trpc/router'; -import { createContext } from '$lib/trpc/context'; - -export const load = async (event) => { - event.depends('exerciseSplits:all'); - const trpc = createCaller(await createContext(event)); - const searchString = event.url.searchParams.get('search') ?? undefined; - - const exerciseSplits = trpc.exerciseSplits.load({ searchString }); - return { exerciseSplits }; -}; diff --git a/src/routes/exercise-splits/+page.svelte b/src/routes/exercise-splits/+page.svelte index 595421bf..95128f41 100644 --- a/src/routes/exercise-splits/+page.svelte +++ b/src/routes/exercise-splits/+page.svelte @@ -1,52 +1,50 @@ @@ -80,70 +105,41 @@
- {#if workouts !== 'loading'} - {#await data.filterData} - TODO: skeleton - {:then filterData} - {#if filterData} - - {:else} - - {/if} - {/await} - {/if} + {#await data.filterData} + TODO: skeleton + {:then filterData} + {#if filterData} + + {:else} + + {/if} + {/await}
- {#if workouts === 'loading'} - {#each Array(10) as _} -
- - -
- {/each} - {:else} - - {#each workouts as workout} - {@const { workoutOfMesocycle } = workout} - - {:else} -
No workouts found
- {/each} - {#snippet loading()} - - {/snippet} - {#snippet error(load)} - - {/snippet} - {#snippet noData()} - {#if workouts.length > 0} -
- - That's all! - -
- {/if} - {/snippet} -
- {/if} + {#each workouts as workout} + {@const { workoutOfMesocycle } = workout} + + {/each} +
diff --git a/src/routes/workouts/manage/exercises/(components)/ExerciseHistorySheet.svelte b/src/routes/workouts/manage/exercises/(components)/ExerciseHistorySheet.svelte index c675300d..58355e16 100644 --- a/src/routes/workouts/manage/exercises/(components)/ExerciseHistorySheet.svelte +++ b/src/routes/workouts/manage/exercises/(components)/ExerciseHistorySheet.svelte @@ -1,26 +1,24 @@ @@ -44,52 +46,31 @@ {workoutRunes.exerciseHistorySheetName} -
- - {#each exercisesFound as exercise} - {@const wm = exercise.workout.workoutOfMesocycle} -
- -
- {wm?.mesocycle.mesocycleExerciseSplitDays[wm.splitDayIndex].name} - {wm?.mesocycle.name} -
- - {exercise.workout.startedAt.toLocaleDateString(undefined, { - day: 'numeric', - month: 'short' - })} - +
+ {#each exercisesFound as exercise} + {@const wm = exercise.workout.workoutOfMesocycle} +
+ +
+ {wm?.mesocycle.mesocycleExerciseSplitDays[wm.splitDayIndex].name} + {wm?.mesocycle.name}
- - {/each} - {#snippet loading()} - - {/snippet} - {#snippet error(load)} - - {/snippet} - {#snippet noData()} - {#if exercisesFound.length > 0} -
- - That's all! - -
- {:else} -
No exercise history found
- {/if} - {/snippet} - + + {exercise.workout.startedAt.toLocaleDateString(undefined, { + day: 'numeric', + month: 'short' + })} + +
+ + {/each} +
diff --git a/tests/models/mesocycles.spec.ts b/tests/models/mesocycles.spec.ts index 92254121..87ca0ebd 100644 --- a/tests/models/mesocycles.spec.ts +++ b/tests/models/mesocycles.spec.ts @@ -126,7 +126,7 @@ test('start and stop a mesocycle', async ({ page }) => { }); await expect(page.getByRole('tabpanel')).toContainText(`MesoName ${new Date().toLocaleDateString()} Active`); await page.getByRole('link', { name: 'Mesocycles' }).click(); - await expect(page.getByRole('main')).toContainText("Active MesoName Active All MesoName Active That's all!"); + await expect(page.getByRole('main')).toContainText("Active MesoName Active All MesoName Active That's all"); await page.getByRole('link', { name: 'MesoName Active' }).first().click(); await page.getByRole('button', { name: 'Stop mesocycle' }).click(); await expect(page.getByRole('status').filter({ hasText: 'Mesocycle stopped successfully' })).toBeVisible({ @@ -136,7 +136,7 @@ test('start and stop a mesocycle', async ({ page }) => { `MesoName ${new Date().toLocaleDateString()} to ${new Date().toLocaleDateString()} Completed` ); await page.getByRole('link', { name: 'Mesocycles' }).click(); - await expect(page.getByRole('main')).toContainText("Active No active mesocycle All MesoName Completed That's all!"); + await expect(page.getByRole('main')).toContainText("Active No active mesocycle All MesoName Completed That's all"); }); test("edit mesocycle's exercise split", async ({ page }) => {