finished frontend

This commit is contained in:
2025-06-09 22:32:25 +02:00
parent 51c0d7155c
commit 3f4de2266c
10 changed files with 298 additions and 59 deletions

12
backend/routes/users.js Normal file
View File

@@ -0,0 +1,12 @@
const express = require('express')
const router = express.Router()
router.get("/", (req, res) => {
res.send("User List")
})
router.get("/new", (req, res) => {
res.send("User New Form")
})
module.exports = router

View File

@@ -1,10 +1,18 @@
const express = require('express')
const app = express()
const express = require("express");
const app = express();
app.set('view engine', 'ejs')
app.set("view engine", "ejs");
app.get('/', (req, res) => {
res.render('views/index.html')
})
app.get("/", (req, res) => {
res.render("index");
});
app.listen(3000)
app.get("/add", (req, res) => {
res.render("addRecipe/index");
});
const userRouter = require("./routes/users");
app.use("/users", userRouter);
app.listen(3000);

View File

@@ -33,4 +33,4 @@ function throwError(message) {
document.body.appendChild(element);
console.error(message);
}
}

View File

@@ -0,0 +1,142 @@
<!DOCTYPE html>
<html lang="en">
<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>
</head>
<body>
<main class="container">
<h1>Add a New Recipe</h1>
<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
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>
</main>
</body>
</html>
<style>
/* Reset basic styles */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
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;
}
.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;
}
h1 {
font-size: 1.8rem;
margin-bottom: 1.5rem;
font-weight: 600;
text-align: center;
}
label {
display: block;
margin-top: 1.2rem;
margin-bottom: 0.5rem;
font-weight: 500;
}
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;
}
input[type="text"]:focus,
textarea:focus {
border-color: #007aff;
outline: none;
background-color: #fff;
}
textarea {
resize: vertical;
min-height: 150px;
}
.button-group {
margin-top: 2rem;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
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;
}
button#saveBtn {
background-color: #007aff;
color: white;
}
button#saveBtn:hover {
background-color: #005ecb;
}
.back-btn {
background-color: #e5e5ea;
color: #1d1d1f;
}
.back-btn:hover {
background-color: #d1d1d6;
}
</style>

View File

@@ -1,11 +1,130 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cookbook</title>
<!-- San Francisco System Font -->
<style>
html {
font-family: -apple-system, BlinkMacSystemFont, "San Francisco",
"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
</style>
</head>
<body>
<main class="container">
<header>
<h1>Cookbook</h1>
<div class="button-group">
<button onclick="syncRecipes()">🔄 Sync Recipes</button>
<a href="/add" class="secondary-button"> Add Recipe</a>
</div>
</header>
<section id="recipes" class="recipes-list"></section>
</main>
</body>
</html>
<style>
/* Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #f5f5f7;
color: #1d1d1f;
font-size: 16px;
line-height: 1.5;
padding: 2rem;
display: flex;
justify-content: center;
min-height: 100vh;
}
/* Main container */
.container {
width: 100%;
max-width: 800px;
background-color: #fff;
border-radius: 20px;
padding: 2rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}
/* Header */
header {
display: flex;
flex-direction: column;
gap: 1.5rem;
margin-bottom: 2rem;
text-align: center;
}
h1 {
font-size: 2rem;
font-weight: 600;
}
/* Button group */
.button-group {
display: flex;
justify-content: center;
gap: 1rem;
flex-wrap: wrap;
}
button,
.secondary-button {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 12px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
text-decoration: none;
display: inline-block;
text-align: center;
}
/* Primary button */
button {
background-color: #007aff;
color: #fff;
}
button:hover {
background-color: #005ecb;
}
/* Secondary button (styled link) */
.secondary-button {
background-color: #e5e5ea;
color: #1d1d1f;
}
.secondary-button:hover {
background-color: #d1d1d6;
}
/* Recipe list */
.recipes-list {
display: flex;
flex-direction: column;
gap: 1rem;
}
/* Placeholder for recipe cards (can be enhanced later) */
.recipe-card {
padding: 1rem;
border-radius: 16px;
background-color: #f9f9fa;
border: 1px solid #e0e0e0;
}
</style>

View File

@@ -1,23 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add recipe</title>
<link rel="stylesheet" href="addRecipe.css">
<script src="addRecipe.js"></script>
</head>
<body>
<div class="addRecipe">
<label for="title">Recipe title:</label>
<input type="text" id="title">
<label for="recipe">Here you can write your recipe:</label>
<textarea name="recipe" placeholder="You can use markdown!" id="recipe"></textarea>
<button id="saveBtn" onclick="saveRecipe()">Save</button>
</div>
<a href="../index.html"><button>Go back to recipes</button></a>
</body>
</html>

View File

@@ -1,16 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cookbook</title>
<script src="index.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button onclick="syncRecipes()">Sync recipes</button>
<a href="addRecipe/addRecipe.html"><button>Add recipe</button></a>
<div id="recipes"></div>
</body>
</html>

View File

@@ -1,3 +0,0 @@
function syncRecipes() {
};

View File