Revert "Implement secure client-side favorites loading to fix nginx 502 issues"
All checks were successful
CI / update (push) Successful in 16s

This reverts commit 48b94e3aef.
This commit is contained in:
2025-09-04 12:26:27 +02:00
parent 48b94e3aef
commit 55a4e6a262
4 changed files with 35 additions and 195 deletions

View File

@@ -1,26 +1,12 @@
<script lang="ts">
import type { PageData } from './$types';
import { onMount } from 'svelte';
import { favorites, addFavoriteStatusToRecipes } from '$lib/stores/favorites';
import { page } from '$app/stores';
import MediaScroller from '$lib/components/MediaScroller.svelte';
import AddButton from '$lib/components/AddButton.svelte';
import Card from '$lib/components/Card.svelte';
import Search from '$lib/components/Search.svelte';
export let data: PageData;
export let current_month = new Date().getMonth() + 1
const categories = ["Hauptspeise", "Nudel", "Brot", "Dessert", "Suppe", "Beilage", "Salat", "Kuchen", "Frühstück", "Sauce", "Zutat", "Getränk", "Aufstrich", "Guetzli", "Snack"];
// Load favorites when component mounts and user is authenticated
onMount(() => {
if ($page.data.session?.user) {
favorites.load();
}
});
// Reactively add favorite status to recipes
$: seasonWithFavorites = addFavoriteStatusToRecipes(data.season, $favorites.favorites);
$: allBriefWithFavorites = addFavoriteStatusToRecipes(data.all_brief, $favorites.favorites);
const categories = ["Hauptspeise", "Nudel", "Brot", "Dessert", "Suppe", "Beilage", "Salat", "Kuchen", "Frühstück", "Sauce", "Zutat", "Getränk", "Aufstrich", "Guetzli", "Snack"]
</script>
<style>
h1{
@@ -49,15 +35,15 @@ h1{
<Search></Search>
<MediaScroller title="In Saison">
{#each seasonWithFavorites as recipe}
<Card {recipe} {current_month} loading_strat={"eager"} do_margin_right={true} isFavorite={recipe.isFavorite} showFavoriteIndicator={!!$page.data.session?.user}></Card>
{#each data.season as recipe}
<Card {recipe} {current_month} loading_strat={"eager"} do_margin_right={true} isFavorite={recipe.isFavorite} showFavoriteIndicator={!!data.session?.user}></Card>
{/each}
</MediaScroller>
{#each categories as category}
<MediaScroller title={category}>
{#each allBriefWithFavorites.filter(recipe => recipe.category == category) as recipe}
<Card {recipe} {current_month} do_margin_right={true} isFavorite={recipe.isFavorite} showFavoriteIndicator={!!$page.data.session?.user}></Card>
{#each data.all_brief.filter(recipe => recipe.category == category) as recipe}
<Card {recipe} {current_month} do_margin_right={true} isFavorite={recipe.isFavorite} showFavoriteIndicator={!!data.session?.user}></Card>
{/each}
</MediaScroller>
{/each}