Add routes for daily weekly and the rest

This commit is contained in:
2024-08-09 22:32:58 +02:00
parent 8119775084
commit fce5b8416e
19 changed files with 472 additions and 27 deletions

View File

@@ -0,0 +1,8 @@
<script lang="ts">
import AggregatedFoodTable from '$components/Energy/AggregatedFood/AggregatedFoodTable.svelte'
import { dailyFoodStore } from '$lib/store/Energy/dailyFoodStore'
</script>
<template>
<AggregatedFoodTable items="{$dailyFoodStore}" />
</template>

View File

@@ -0,0 +1,24 @@
<script lang="ts">
import { foodStore } from "$lib/store/Energy/foodStore";
import FoodTable from "$lib/components/Energy/Food/FoodTable.svelte";
// Fuck this hacky shit
// Svelte won't re-render FoodTable when using the store directly
// It won't do it when using a variable and subscribing to the store
// It won't do it when reassigning the store
// Not when pushing unshifting the store
// This is the only thing that works
// Hacky ass shit
let forceUpdate = false;
foodStore.subscribe(() => {
forceUpdate = !forceUpdate;
});
</script>
<template>
{#if forceUpdate}
<FoodTable items={$foodStore} />
{:else}
<FoodTable items={$foodStore} />
{/if}
</template>

View File

@@ -0,0 +1,8 @@
<script lang="ts">
import AggregatedFoodTable from '$components/Energy/AggregatedFood/AggregatedFoodTable.svelte'
import { monthlyFoodStore } from '$lib/store/Energy/monthlyFoodStore'
</script>
<template>
<AggregatedFoodTable items="{$monthlyFoodStore}" />
</template>

View File

@@ -0,0 +1,8 @@
<script lang="ts">
import AggregatedFoodTable from '$components/Energy/AggregatedFood/AggregatedFoodTable.svelte'
import { weeklyFoodStore } from '$lib/store/Energy/weeklyFoodStore'
</script>
<template>
<AggregatedFoodTable items="{$weeklyFoodStore}" />
</template>

View File

@@ -0,0 +1,8 @@
<script lang="ts">
import AggregatedFoodTable from '$components/Energy/AggregatedFood/AggregatedFoodTable.svelte'
import { yearlyFoodStore } from '$lib/store/Energy/yearlyFoodStore'
</script>
<template>
<AggregatedFoodTable items="{$yearlyFoodStore}" />
</template>