diff --git a/app/Livewire/Web/Recipes/RecipeShow.php b/app/Livewire/Web/Recipes/RecipeShow.php index 6ffcb38b..9eadfdde 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-card.blade.php b/resources/views/web/components/recipes/recipe-card.blade.php index a5d8772e..44f288b5 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/components/recipes/recipe-grid.blade.php b/resources/views/web/components/recipes/recipe-grid.blade.php new file mode 100644 index 00000000..54bb38d2 --- /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 b1f26101..f6c1ddf1 100644 --- a/resources/views/web/livewire/recipes/recipe-show.blade.php +++ b/resources/views/web/livewire/recipes/recipe-show.blade.php @@ -95,34 +95,17 @@ 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 }}). @endif - {{-- Variant Recipes --}} - @if ($recipe->variants->isNotEmpty()) -
- {{ __('Variants of this Recipe') }} -
- @foreach ($recipe->variants as $variant) - - - - {{ $variant->name ?: $variant->getFirstTranslation('name') }} - - - @endforeach -
-
- @endif - {{-- Description --}} @if ($recipe->description) -
+
{{ $recipe->description }}
@endif @@ -262,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