From f7e6891884ea5a049f0425419772ffa94894acdf Mon Sep 17 00:00:00 2001 From: Norman Huth Date: Sun, 25 Jan 2026 04:07:33 +0100 Subject: [PATCH 1/2] refactor(components): update recipe card and show layouts for improved structure and styling adjustments --- .../components/recipes/recipe-card.blade.php | 9 ++++++--- .../web/livewire/recipes/recipe-show.blade.php | 17 +++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/resources/views/web/components/recipes/recipe-card.blade.php b/resources/views/web/components/recipes/recipe-card.blade.php index a5d8772..44f288b 100644 --- a/resources/views/web/components/recipes/recipe-card.blade.php +++ b/resources/views/web/components/recipes/recipe-card.blade.php @@ -1,5 +1,5 @@ @if ($viewMode === \App\Enums\ViewModeEnum::Grid) - +
@if ($recipe->card_image_url) -
- +
+ {{ $recipe->name }} @@ -66,6 +66,9 @@ class="absolute bottom-2 left-2 rounded px-2 py-1 text-xs font-semibold" {{ $recipe->headline }} @endif +
+
+
@if ($recipe->total_time) diff --git a/resources/views/web/livewire/recipes/recipe-show.blade.php b/resources/views/web/livewire/recipes/recipe-show.blade.php index b1f2610..135926a 100644 --- a/resources/views/web/livewire/recipes/recipe-show.blade.php +++ b/resources/views/web/livewire/recipes/recipe-show.blade.php @@ -95,8 +95,8 @@ class="rounded-full p-2 transition-colors bg-zinc-100 text-zinc-700 hover:bg-zin {{ __('Based on Canonical Recipe') }} {{ __('This recipe is based on') }} - - {{ $recipe->canonical->name ?: $recipe->canonical->getFirstTranslation('name') }} + + {{ $recipe->canonical->name }} ({{ $recipe->canonical->country->code }}). @@ -105,16 +105,13 @@ class="rounded-full p-2 transition-colors bg-zinc-100 text-zinc-700 hover:bg-zin {{-- Variant Recipes --}} @if ($recipe->variants->isNotEmpty()) -
- {{ __('Variants of this Recipe') }} +
+ {{ __('Variants of this Recipe') }}
@foreach ($recipe->variants as $variant) - - - - {{ $variant->name ?: $variant->getFirstTranslation('name') }} - - + + {{ $variant->name }} + @endforeach
From 6177d5d91cb0291e48b23de69f00241f37f8d607 Mon Sep 17 00:00:00 2001 From: Norman Huth Date: Sun, 25 Jan 2026 04:30:23 +0100 Subject: [PATCH 2/2] feat(variants): enhance recipe variant handling and layout - Load additional relationships for variants (`label` and `tags`) - Refactor recipes display using reusable `recipe-grid` component - Improve variant and similar recipes sections with collapsible layout in `RecipeShow` --- app/Livewire/Web/Recipes/RecipeShow.php | 3 ++ .../components/recipes/recipe-grid.blade.php | 7 +++ .../livewire/recipes/recipe-show.blade.php | 50 ++++++------------- 3 files changed, 25 insertions(+), 35 deletions(-) create mode 100644 resources/views/web/components/recipes/recipe-grid.blade.php diff --git a/app/Livewire/Web/Recipes/RecipeShow.php b/app/Livewire/Web/Recipes/RecipeShow.php index 6ffcb38..9eadfdd 100644 --- a/app/Livewire/Web/Recipes/RecipeShow.php +++ b/app/Livewire/Web/Recipes/RecipeShow.php @@ -39,6 +39,8 @@ public function mount(Recipe $recipe): void 'ingredients', 'canonical.country', 'variants.country', + 'variants.label', + 'variants.tags', ]); // Set default yield based on available yields @@ -229,6 +231,7 @@ public function similarRecipes(): Collection )) ->withCount(['tags' => fn (Builder $query): Builder => $query->whereIn('tags.id', $tagIds)]) ->orderByDesc('tags_count') + ->with(['label', 'tags', 'country']) ->limit(4) ->get(); } diff --git a/resources/views/web/components/recipes/recipe-grid.blade.php b/resources/views/web/components/recipes/recipe-grid.blade.php new file mode 100644 index 0000000..54bb38d --- /dev/null +++ b/resources/views/web/components/recipes/recipe-grid.blade.php @@ -0,0 +1,7 @@ +@props(['recipes']) + +
+ @foreach ($recipes as $recipe) + + @endforeach +
diff --git a/resources/views/web/livewire/recipes/recipe-show.blade.php b/resources/views/web/livewire/recipes/recipe-show.blade.php index 135926a..f6c1ddf 100644 --- a/resources/views/web/livewire/recipes/recipe-show.blade.php +++ b/resources/views/web/livewire/recipes/recipe-show.blade.php @@ -103,23 +103,9 @@ class="rounded-full p-2 transition-colors bg-zinc-100 text-zinc-700 hover:bg-zin @endif - {{-- Variant Recipes --}} - @if ($recipe->variants->isNotEmpty()) -
- {{ __('Variants of this Recipe') }} -
- @foreach ($recipe->variants as $variant) - - {{ $variant->name }} - - @endforeach -
-
- @endif - {{-- Description --}} @if ($recipe->description) -
+
{{ $recipe->description }}
@endif @@ -259,30 +245,24 @@ class="h-32 rounded object-cover shrink-0"
@endif + {{-- Variant Recipes --}} + @if ($recipe->variants->isNotEmpty()) +
+ +
+ +
+
+ @endif + {{-- Similar Recipes --}} @if ($this->similarRecipes->isNotEmpty())
{{ __('Similar Recipes') }} -
- @foreach ($this->similarRecipes as $similarRecipe) - - @if ($similarRecipe->card_image_url) - {{ $similarRecipe->name }} - @endif -
- - - {{ $similarRecipe->name }} - - -
-
- @endforeach -
+
@endif