Add routes for daily weekly and the rest
This commit is contained in:
8
frontend/src/lib/router/routes/Daily.svelte
Normal file
8
frontend/src/lib/router/routes/Daily.svelte
Normal 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>
|
||||
24
frontend/src/lib/router/routes/Energy.svelte
Normal file
24
frontend/src/lib/router/routes/Energy.svelte
Normal 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>
|
||||
8
frontend/src/lib/router/routes/Monthly.svelte
Normal file
8
frontend/src/lib/router/routes/Monthly.svelte
Normal 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>
|
||||
8
frontend/src/lib/router/routes/Weekly.svelte
Normal file
8
frontend/src/lib/router/routes/Weekly.svelte
Normal 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>
|
||||
8
frontend/src/lib/router/routes/Yearly.svelte
Normal file
8
frontend/src/lib/router/routes/Yearly.svelte
Normal 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>
|
||||
Reference in New Issue
Block a user