Update 13 files

- /src/main/java/com/example/demo/service/Impl/UserServiceImpl.java
- /src/main/java/com/example/demo/service/Impl/RecipeServiceImpl.java
- /src/main/java/com/example/demo/service/UserService.java
- /src/main/java/com/example/demo/controller/SiteController.java
- /src/main/java/com/example/demo/controller/RecipeUploadForm.java
- /src/main/java/com/example/demo/controller/ProfileController.java
- /src/main/java/com/example/demo/config/SecurityConfig.java
- /src/main/java/com/example/demo/config/WebConfig.java
- /src/main/resources/templates/explore.html
- /src/main/resources/templates/view-recipe.html
- /src/main/resources/templates/public-profile.html
- /src/main/resources/templates/my-profile.html
- /src/main/resources/templates/home.html
This commit is contained in:
Madeleine Stamp
2026-04-23 12:33:42 -06:00
parent 2ed5f11b21
commit 339cbbdf6e
13 changed files with 556 additions and 304 deletions
+49 -40
View File
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Thyme Crunch Home</title>
<title>Thyme Crunch Favorites</title>
<link rel="stylesheet" th:href="@{css/home.css}">
<link href="https://fonts.googleapis.com/css2?family=Delius+Swash+Caps&family=Mali:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,200;1,300;1,400;1,500;1,600;1,700" rel="stylesheet">
</head>
@@ -15,73 +15,82 @@
</header>
<div class="body">
<!--Navigation Bar -->
<div class="body-left">
<nav class="sidebar-left">
<ul>
<li><a href="/">Home</a></li>
<li><a th:href="@{/explore}">Explore</a></li>
<li><a th:href="${guest} ? @{/login} : @{/}">Favorites</a></li>
<li><a th:href="@{/my-profile}">Profile</a></li>
<li>
<li th:if="${guest}">
<a th:href="@{/login}" class="login-link">Login</a>
</li>
<li th:unless="${guest}">
<form th:action="@{/logout}" method="post">
<input type="image" th:src="@{images/logout_icon.png}" alt="Logout button" class="nav_icon"/>
</form>
</li>
</ul>
</nav>
<a th:href="@{/create}" target="_blank" class="create_icon">
<img th:src="@{images/create_icon.png}" alt="Create New Recipe Icon (Red mixing bowl with a spoon and yellow addition symbol.">
<a th:href="@{/create}" class="create_icon">
<img th:src="@{images/create_icon.png}" alt="Create New Recipe Icon (Red mixing bowl with a spoon and yellow addition symbol.)">
</a>
</div>
<!-- Main Content -->
<main class="main-content">
<div class="recipe-card">
<p th:if="${#lists.isEmpty(recipes)}">You have not saved any recipes.</p>
<div th:if="${guest}" style="text-align:center; padding: 20px 0;">
<p style="margin-bottom:16px;">Log in to view and save your favorite recipes.</p>
<a th:href="@{/login}" style="display:inline-block; padding:10px 18px; background:#850000; color:white; text-decoration:none; border-radius:8px;">
Login
</a>
</div>
<div class="recipe-card" th:unless="${#lists.isEmpty(recipes)}">
<a th:href="@{/recipes/{id}(id=${recipe.id})}" class="card" th:each="recipe : ${recipes}">
<div class="card-text">
<h2 th:text="${recipe.title}">Recipe Title</h2>
<p th:text="${recipe.description}">Description</p>
</div>
<div class="card-right">
<div th:if="${recipe.images != null and !#lists.isEmpty(recipe.images)}">
<img th:src="${recipe.images[0].imageUrl}" alt="Recipe Image">
</div>
<p class="card-cost" th:text="${recipe.cost}">Cost</p>
</div>
</a>
<div th:unless="${guest}">
<p th:if="${#lists.isEmpty(recipes)}">You have not saved any recipes.</p>
<div class="recipe-card" th:unless="${#lists.isEmpty(recipes)}">
<a th:href="@{/recipes/{id}(id=${recipe.id})}" class="card" th:each="recipe : ${recipes}">
<div class="card-text">
<h2 th:text="${recipe.title}">Recipe Title</h2>
<p th:text="${recipe.description}">Description</p>
</div>
<div class="card-right">
<div th:if="${recipe.images != null and !#lists.isEmpty(recipe.images)}">
<img th:src="${recipe.images[0].imageUrl}" alt="Recipe Image">
</div>
<p class="card-cost" th:text="${recipe.cost}">Cost</p>
</div>
</a>
</div>
</div>
</div>
</main>
<!--New Bar -->
<div class="body-right">
<div class="sidebar-right">
<h1> NEW </h1>
<div class="new-recipes">
<a th:each="recipe : ${newestRecipes}"
th:href="@{/recipes/{id}(id=${recipe.id})}"
class="new-recipe-item">
<p th:text="${recipe.title}">Title</p>
<div th:if="${recipe.images != null and !#lists.isEmpty(recipe.images)}">
<img th:src="${recipe.images[0].imageUrl}" alt="Recipe Image">
</div>
</a>
</div>
<h1>FAVES</h1>
<p style="text-align:center; padding:0 16px;">
Your saved recipes appear here.
</p>
</div>
</div>
</div>
<script>
// For cost display
document.querySelectorAll('.card-cost').forEach(el => {
const num = parseInt(el.textContent);
el.textContent = num === 0 ? '' : '$'.repeat(num);
});
function renderCost(cost) {
const num = parseInt(cost, 10);
if (!num || num <= 0) return '';
if (num >= 4) return '$$$$';
return '$'.repeat(num);
}
document.querySelectorAll('.card-cost').forEach(el => {
el.textContent = renderCost(el.textContent);
});
</script>
</body>
</html>
</html>