finished front and backend

This commit is contained in:
2025-06-10 20:29:49 +02:00
parent fb4f641197
commit 5e05db0d6e
8 changed files with 360 additions and 162 deletions

View File

@@ -3,140 +3,154 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Add Recipe</title>
<script src="addRecipe.js" defer></script>
<style>
html {
font-family: -apple-system, BlinkMacSystemFont, "San Francisco",
"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
</style>
<title>Add recipe</title>
</head>
<body>
<main class="container">
<h1>Add a New Recipe</h1>
<h1>Add a new recipe</h1>
<form action="/add/create-recipe" method="POST">
<label for="title">Recipe Title</label>
<input
type="text"
name="filename"
required
id="title"
placeholder="e.g. Grandma's Apple Pie"
/>
<label for="title">Recipe Title</label>
<input type="text" id="title" placeholder="e.g. Grandma's Apple Pie" />
<label for="recipe">Recipe instructions</label>
<textarea
required
name="content"
id="recipe"
placeholder="Write your recipe here… You can use markdown!"
></textarea>
<small>You can use Markdown syntax for formatting.</small>
<label for="recipe">Recipe Instructions</label>
<textarea
id="recipe"
placeholder="Write your recipe here… You can use markdown!"
></textarea>
<div class="button-group">
<button id="saveBtn" onclick="saveRecipe()">Save Recipe</button>
<a href="/" class="back-btn">Back to Recipes</a>
</div>
<div class="button-group">
<button type="submit">Save recipe</button>
<a href="/" class="back-btn">Back to recipes</a>
</div>
</form>
</main>
</body>
</html>
<style>
/* Reset basic styles */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-family: -apple-system, BlinkMacSystemFont, "San Francisco",
"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body {
background-color: #f5f5f7;
color: #1d1d1f;
font-size: 16px;
line-height: 1.5;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.container {
background-color: #ffffff;
padding: 2rem;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
width: 100%;
max-width: 600px;
}
body {
background-color: #f5f5f7;
color: #1d1d1f;
font-size: 16px;
line-height: 1.5;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
}
h1 {
font-size: 1.8rem;
margin-bottom: 1.5rem;
font-weight: 600;
text-align: center;
}
.container {
background-color: #ffffff;
padding: 2.5rem;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
width: 100%;
max-width: 600px;
}
label {
display: block;
margin-top: 1.2rem;
margin-bottom: 0.5rem;
font-weight: 500;
}
h1 {
font-size: 1.8rem;
margin-bottom: 1.5rem;
font-weight: 600;
text-align: center;
}
input[type="text"],
textarea {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid #d1d1d6;
border-radius: 12px;
background-color: #f9f9fa;
font-size: 1rem;
transition: border 0.2s ease;
}
label {
display: block;
margin-top: 1.2rem;
margin-bottom: 0.5rem;
font-weight: 500;
}
input[type="text"]:focus,
textarea:focus {
border-color: #007aff;
outline: none;
background-color: #fff;
}
input[type="text"],
textarea {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid #d1d1d6;
border-radius: 12px;
background-color: #f9f9fa;
font-size: 1rem;
transition: border 0.2s ease;
}
textarea {
resize: vertical;
min-height: 150px;
}
input[type="text"]:focus,
textarea:focus {
border-color: #007aff;
outline: none;
background-color: #fff;
}
.button-group {
margin-top: 2rem;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
textarea {
resize: vertical;
min-height: 150px;
}
button,
.back-btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 12px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease-in-out;
text-decoration: none;
text-align: center;
}
small {
display: block;
margin-top: 0.4rem;
color: #6e6e73;
font-size: 0.875rem;
}
button#saveBtn {
background-color: #007aff;
color: white;
}
.button-group {
margin-top: 2rem;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
button#saveBtn:hover {
background-color: #005ecb;
}
button,
.back-btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 12px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease-in-out;
text-decoration: none;
text-align: center;
}
.back-btn {
background-color: #e5e5ea;
color: #1d1d1f;
}
button[type="submit"] {
background-color: #007aff;
color: white;
}
.back-btn:hover {
background-color: #d1d1d6;
}
</style>
button[type="submit"]:hover {
background-color: #005ecb;
}
.back-btn {
background-color: #e5e5ea;
color: #1d1d1f;
}
.back-btn:hover {
background-color: #d1d1d6;
}
</style>

View File

@@ -4,7 +4,6 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cookbook</title>
<script src="index.js" defer></script>
<!-- Apple-Style: San Francisco Font und Styling -->
</head>
@@ -13,10 +12,8 @@
<header>
<h1>Cookbook</h1>
<div class="button-group">
<button onclick="syncRecipes()">🔄 Sync Recipes</button>
<a href="/add" class="secondary-button"
> Add Recipe</a
>
<a href="/"><button>🔄 Sync Recipes</button></a>
<a href="/add" class="secondary-button"> Add Recipe</a>
<a
href="https://git.the1s.de/theis.gaedigk/Cookbook/src/branch/main/helpSite.md"
class="secondary-button"
@@ -28,7 +25,12 @@
</header>
<section id="recipes" class="recipes-list">
<!-- Recipes will be dynamically loaded here -->
<% recipes.forEach(recipe => { %>
<div class="recipe-card">
<h2><%= recipe.title %></h2>
<pre><%= recipe.content %></pre>
</div>
<% }) %>
</section>
</main>
</body>

114
backend/views/success.ejs Normal file
View File

@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Success!</title>
<style>
/* San Francisco / Apple System Font */
html {
font-family: -apple-system, BlinkMacSystemFont, "San Francisco",
"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #f5f5f7;
color: #1d1d1f;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
}
.container {
background-color: #fff;
border-radius: 20px;
padding: 2.5rem;
max-width: 500px;
width: 100%;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
text-align: center;
}
h1 {
font-size: 2rem;
margin-bottom: 1rem;
font-weight: 600;
}
p {
margin: 0.5rem 0;
font-size: 1rem;
}
strong {
color: #007aff;
}
.buttons {
margin-top: 2rem;
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
}
button,
.btn-link {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 12px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
text-decoration: none;
text-align: center;
transition: background-color 0.2s ease;
}
button {
background-color: #007aff;
color: white;
}
button:hover {
background-color: #005ecb;
}
.btn-secondary {
background-color: #e5e5ea;
color: #1d1d1f;
}
.btn-secondary:hover {
background-color: #d1d1d6;
}
a {
text-decoration: none;
}
</style>
</head>
<body>
<div class="container">
<h1>✅ Recipe created successfully!</h1>
<p>Filename: <strong><%= filename %></strong></p>
<p>File path: <strong><%= path %></strong></p>
<div class="buttons">
<a href="/add"
><button class="btn-secondary"> Add more recipes</button></a
>
<a href="/"><button>📖 View all recipes</button></a>
</div>
</div>
</body>
</html>