Sfoglia il codice sorgente

Added imagages to week planner

Axel Nordh 5 mesi fa
parent
commit
1a1a05f380

+ 23 - 6
Views/WeekPlanner/ConfigureDay.cshtml

@@ -163,12 +163,29 @@
                             <div class="card-body">
                                 @foreach (var recipe in Model.SuggestedRecipes.Take(5))
                                 {
-                                    <div class="d-flex justify-content-between align-items-center mb-2">
-                                        <span class="small">@recipe.Title</span>
-                                        @if (!string.IsNullOrEmpty(recipe.Time))
-                                        {
-                                            <span class="badge bg-info">@recipe.Time min</span>
-                                        }
+                                    <div class="d-flex align-items-center mb-3">
+                                        <!-- Recipe thumbnail -->
+                                        <div class="flex-shrink-0 me-3">
+                                            <img src="@Url.Action("GetImage", "Recipe", new { recipeId = recipe.Id })" 
+                                                 class="rounded shadow-sm" 
+                                                 alt="@recipe.Title"
+                                                 style="width: 60px; height: 60px; object-fit: cover;"
+                                                 onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';" />
+                                            <div class="rounded bg-light shadow-sm d-none" 
+                                                 style="width: 60px; height: 60px; display: none; align-items: center; justify-content: center;">
+                                                <i class="fas fa-utensils text-muted"></i>
+                                            </div>
+                                        </div>
+                                        <!-- Recipe info -->
+                                        <div class="flex-grow-1">
+                                            <div class="d-flex justify-content-between align-items-center">
+                                                <span class="small fw-bold">@recipe.Title</span>
+                                                @if (!string.IsNullOrEmpty(recipe.Time))
+                                                {
+                                                    <span class="badge bg-info">@recipe.Time min</span>
+                                                }
+                                            </div>
+                                        </div>
                                     </div>
                                 }
                                 @if (Model.SuggestedRecipes.Count > 5)

+ 34 - 0
Views/WeekPlanner/Index.cshtml

@@ -83,6 +83,29 @@
                                 <div class="card-body">
                                     @if (dayPlan.Recipe != null)
                                     {
+                                        <!-- Recipe Image -->
+                                        <div class="recipe-image-container mb-3 position-relative">
+                                            <img src="@Url.Action("GetImage", "Recipe", new { recipeId = dayPlan.Recipe.Id })" 
+                                                 class="card-img-top rounded" 
+                                                 alt="@dayPlan.Recipe.Title"
+                                                 style="height: 180px; object-fit: contain; width: 100%; 
+                                                        filter: brightness(1.1) contrast(1.2) saturate(1.1);
+                                                        border: 2px solid #e9ecef; background-color: #f8f9fa;"
+                                                 onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';" />
+                                            <!-- Gradient overlay for better text readability if needed -->
+                                            <div class="position-absolute bottom-0 start-0 end-0 bg-gradient-to-top" 
+                                                 style="height: 60px; background: linear-gradient(transparent, rgba(0,0,0,0.3)); border-radius: 0 0 6px 6px; pointer-events: none;"></div>
+                                            
+                                            <div class="card-img-placeholder text-center p-3 rounded border" 
+                                                 style="height: 180px; display: none; align-items: center; justify-content: center; border: 2px solid #e9ecef; background-color: #f8f9fa;">
+                                                <div>
+                                                    <i class="fas fa-utensils text-primary fa-3x mb-2"></i>
+                                                    <p class="text-muted mb-0 fw-bold">No image available</p>
+                                                    <p class="text-muted mb-0 small">Recipe without photo</p>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        
                                         <h6 class="card-title">
                                             <a href="/Recipe/Details/@dayPlan.Recipe.Id" class="text-decoration-none">
                                                 @dayPlan.Recipe.Title
@@ -99,6 +122,17 @@
                                     }
                                     else
                                     {
+                                        <!-- Placeholder when no recipe is selected -->
+                                        <div class="recipe-image-placeholder mb-3">
+                                            <div class="card-img-placeholder text-center p-4 rounded bg-light shadow-sm" 
+                                                 style="height: 140px; display: flex; align-items: center; justify-content: center;">
+                                                <div>
+                                                    <i class="fas fa-plus-circle text-muted fa-2x mb-2"></i>
+                                                    <p class="text-muted mb-0 small">Click Configure or Random Recipe</p>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        
                                         <p class="text-muted mb-2">No recipe selected</p>
                                         @if (!string.IsNullOrEmpty(dayPlan.MainIngredient))
                                         {

BIN
bin/Debug/net8.0/Recepie.dll


BIN
bin/Debug/net8.0/Recepie.exe


BIN
bin/Debug/net8.0/Recepie.pdb


+ 1 - 1
obj/Debug/net8.0/Recepie.AssemblyInfo.cs

@@ -13,7 +13,7 @@ using System.Reflection;
 [assembly: System.Reflection.AssemblyCompanyAttribute("Recepie")]
 [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
 [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+64e0d20f6867c4640e4a374d6a278d3457291c01")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2e2da4c58e1a174324ce03f56a09b5a41cc46997")]
 [assembly: System.Reflection.AssemblyProductAttribute("Recepie")]
 [assembly: System.Reflection.AssemblyTitleAttribute("Recepie")]
 [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

+ 1 - 1
obj/Debug/net8.0/Recepie.AssemblyInfoInputs.cache

@@ -1 +1 @@
-9088b951b9a73c7a5bf830e1a9f853bb866a50ba37110dbee116f72bd1c9c8dc
+36a95b2151d8e4c7a3558efd3bd1673366f709b38f3e80ad975d42b53502ced6

BIN
obj/Debug/net8.0/Recepie.dll


BIN
obj/Debug/net8.0/Recepie.pdb


BIN
obj/Debug/net8.0/apphost.exe


BIN
obj/Debug/net8.0/ref/Recepie.dll


BIN
obj/Debug/net8.0/refint/Recepie.dll