-
+
do_on_key(event, 'Enter', false , edit_step_and_close_modal)}>
-
-
diff --git a/src/lib/components/RecipeEditor.svelte b/src/lib/components/RecipeEditor.svelte
new file mode 100644
index 0000000..f056c6d
--- /dev/null
+++ b/src/lib/components/RecipeEditor.svelte
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
console.log(season)}>PRINTOUT season
+
+
Zutaten
+
+
Zubereitung
+
+
diff --git a/src/lib/components/Search.svelte b/src/lib/components/Search.svelte
index 8138300..17ed7d0 100644
--- a/src/lib/components/Search.svelte
+++ b/src/lib/components/Search.svelte
@@ -1,11 +1,10 @@
diff --git a/src/lib/components/SeasonLayout.svelte b/src/lib/components/SeasonLayout.svelte
index 905ba63..e3f4f96 100644
--- a/src/lib/components/SeasonLayout.svelte
+++ b/src/lib/components/SeasonLayout.svelte
@@ -1,12 +1,15 @@
+
+
+
+{#each months as month}
+
+
+
+{/each}
+
+
+
+
console.log("season", season)}> PRINT SEASON FROM SEASON_SELECT
diff --git a/src/lib/components/do_on_key.js b/src/lib/components/do_on_key.js
new file mode 100644
index 0000000..c892737
--- /dev/null
+++ b/src/lib/components/do_on_key.js
@@ -0,0 +1,8 @@
+export function do_on_key(event, key, needsctrl, fn){
+ if(event.key == key){
+ if(needsctrl && !event.ctrlKey){
+ return
+ }
+ fn()
+ }
+}
diff --git a/src/lib/css/action_button.css b/src/lib/css/action_button.css
new file mode 100644
index 0000000..8c08183
--- /dev/null
+++ b/src/lib/css/action_button.css
@@ -0,0 +1,56 @@
+.action_button{
+ all: unset;
+ cursor: pointer;
+ background-color: var(--red);
+ transition: 200ms;
+ box-shadow: 0 0 1em 0.2em rgba(0,0,0,0.3);
+ padding: 1rem;
+ border-radius: 1000px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+.action_button:hover,
+.action_button:focus
+{
+ background-color: var(--nord0);
+ transform: scale(1.2,1.2);
+ box-shadow: 0 0 1em 0.4em rgba(0,0,0,0.3);
+ animation: shake 0.5s ease forwards;
+}
+
+.action_button:active{
+ transition: 50ms;
+ scale: 0.8 0.8;
+ rotate: 30deg;
+}
+
+
+@keyframes shake{
+ 0%{
+ transform: rotate(0)
+ scale(1,1);
+ }
+ 25%{
+ box-shadow: 0em 0em 1em 0.2em rgba(0, 0, 0, 0.6);
+ transform: rotate(15deg)
+ scale(1.2,1.2)
+ ;
+ }
+ 50%{
+
+ box-shadow: 0em 0em 1em 0.2em rgba(0, 0, 0, 0.6);
+ transform: rotate(-15deg)
+ scale(1.2,1.2);
+ }
+ 74%{
+
+ box-shadow: 0em 0em 1em 0.2em rgba(0, 0, 0, 0.6);
+ transform: rotate(15deg)
+ scale(1.2, 1.2);
+ }
+ 100%{
+ transform: rotate(0)
+ scale(1.2, 1.2);
+ }
+ }
diff --git a/src/lib/css/nordtheme.css b/src/lib/css/nordtheme.css
new file mode 100644
index 0000000..7feacda
--- /dev/null
+++ b/src/lib/css/nordtheme.css
@@ -0,0 +1,25 @@
+:root{
+ --nord0: #2E3440;
+ --nord1: #3B4252;
+ --nord2: #434C5E;
+ --nord3: #4C566A;
+ --nord4: #D8DEE9;
+ --nord5: #E5E9F0;
+ --nord6: #ECEFF4;
+ --nord7: #8FBCBB;
+ --nord8: #88C0D0;
+ --nord9: #81A1C1;
+ --nord10: #5E81AC;
+ --nord11: #BF616A;
+ --nord12: #D08770;
+ --nord13: #EBCB8B;
+ --nord14: #A3BE8C;
+ --nord15: #B48EAD;
+ --lightblue: var(--nord9);
+ --blue: var(--nord10);
+ --red: var(--nord11);
+ --orange: var(--nord12);
+ --yellow: var(--nord13);
+ --green: var(--nord14);
+ --purple: var(--nord15);
+}
diff --git a/src/models/Recipe.ts b/src/models/Recipe.ts
index 93eb1d6..660f632 100644
--- a/src/models/Recipe.ts
+++ b/src/models/Recipe.ts
@@ -2,7 +2,7 @@ import mongoose from 'mongoose';
const RecipeSchema = new mongoose.Schema(
{
- short_name: {type: String, required: true},
+ short_name: {type: String, required: true, unique: true},
name : {type: String, required: true,},
category : {type: String, required: true,},
icon: {type: String, required: true},
diff --git a/src/routes/api/add/+server.ts b/src/routes/api/add/+server.ts
index 990ec83..8f0389b 100644
--- a/src/routes/api/add/+server.ts
+++ b/src/routes/api/add/+server.ts
@@ -12,12 +12,14 @@ export const POST: RequestHandler = async ({request}) => {
console.log("RECIPE:", recipe_json)
console.log("BEARER:", bearer_token)
if(bearer_token === BEARER_TOKEN){
+ console.log("PASSWORD CORRECT")
await dbConnect();
await Recipe.create(recipe_json);
await dbDisconnect();
- return {status: 400}
+ return {status: 400} //TODO: cleanup error throwing
}
else{
+ console.log("PASSWORD INCORRECT")
return {status: 403}
}
};
diff --git a/src/routes/api/edit/+server.ts b/src/routes/api/edit/+server.ts
new file mode 100644
index 0000000..c06b814
--- /dev/null
+++ b/src/routes/api/edit/+server.ts
@@ -0,0 +1,25 @@
+import type { RequestHandler } from '@sveltejs/kit';
+import { Recipe } from '../../../models/Recipe';
+import { dbConnect, dbDisconnect } from '../../../utils/db';
+import type {RecipeModelType} from '../../../types/types';
+import { BEARER_TOKEN } from '$env/static/private'
+// header: use for bearer token for now
+// recipe json in body
+export const POST: RequestHandler = async ({request}) => {
+ console.log("AT EDIT API")
+ let message = await request.json()
+ const recipe_json = message.recipe
+ const bearer_token = message.headers.bearer
+ console.log("RECIPE:", recipe_json)
+ console.log("BEARER:", bearer_token)
+ if(bearer_token === BEARER_TOKEN){
+ await dbConnect();
+ await Recipe.findOneAndUpdate({short_name: message.old_short_name }, recipe_json);
+ await dbDisconnect();
+ return {status: 400} //TODO: cleanup error throwing
+ }
+ else{
+ console.log("PASSWORD INCORRECT")
+ return {status: 403}
+ }
+};
diff --git a/src/routes/rezepte/+page.svelte b/src/routes/rezepte/+page.svelte
index 5f441ca..5226dd8 100644
--- a/src/routes/rezepte/+page.svelte
+++ b/src/routes/rezepte/+page.svelte
@@ -8,30 +8,17 @@
export let data: PageData;
export let current_month = new Date().getMonth() + 1
-
+
Rezepte
In Saison
{#each data.season as recipe}
-
+
{/each}
-
+
Alle Rezepte
{#each data.all_brief as recipe}
diff --git a/src/routes/rezepte/add/+page.svelte b/src/routes/rezepte/add/+page.svelte
index 4c09ffd..73d66fe 100644
--- a/src/routes/rezepte/add/+page.svelte
+++ b/src/routes/rezepte/add/+page.svelte
@@ -1,41 +1,43 @@
Rezept hinzufügen
-
+
+
+
+
+
+
-
Zutaten
-
+
Zubereitung
-
+
+
+ADD RECIPE
diff --git a/src/routes/rezepte/category/[category]/+page.svelte b/src/routes/rezepte/category/[category]/+page.svelte
index ea98201..fa42ba5 100644
--- a/src/routes/rezepte/category/[category]/+page.svelte
+++ b/src/routes/rezepte/category/[category]/+page.svelte
@@ -1,12 +1,14 @@
Rezepte
In Kategorie {data.category}
+
{#each data.recipes as recipe}
diff --git a/src/routes/rezepte/edit/.jukit/.jukit_info.json b/src/routes/rezepte/edit/.jukit/.jukit_info.json
new file mode 100644
index 0000000..92c7342
--- /dev/null
+++ b/src/routes/rezepte/edit/.jukit/.jukit_info.json
@@ -0,0 +1 @@
+{"terminal": "nvimterm"}
\ No newline at end of file
diff --git a/src/routes/rezepte/edit/[name]/+page.svelte b/src/routes/rezepte/edit/[name]/+page.svelte
new file mode 100644
index 0000000..26af762
--- /dev/null
+++ b/src/routes/rezepte/edit/[name]/+page.svelte
@@ -0,0 +1,102 @@
+
+
+
+Rezept hinzufügen
+
+
+Printout Ingredients
+Printout Instructions
+Prinout Card Data
+
+Zutaten
+
+Zubereitung
+
+
+EDIT RECIPE
diff --git a/src/routes/rezepte/edit/[name]/+page.ts b/src/routes/rezepte/edit/[name]/+page.ts
new file mode 100644
index 0000000..786ac8f
--- /dev/null
+++ b/src/routes/rezepte/edit/[name]/+page.ts
@@ -0,0 +1,8 @@
+import type { PageLoad } from "./$types";
+
+export async function load({ fetch, params}) {
+ let current_month = new Date().getMonth() + 1
+ const res = await fetch(`/api/items/${params.name}`);
+ const recipe = await res.json();
+ return {recipe};
+};
diff --git a/src/routes/rezepte/edit/[name]/.jukit/.jukit_info.json b/src/routes/rezepte/edit/[name]/.jukit/.jukit_info.json
new file mode 100644
index 0000000..92c7342
--- /dev/null
+++ b/src/routes/rezepte/edit/[name]/.jukit/.jukit_info.json
@@ -0,0 +1 @@
+{"terminal": "nvimterm"}
\ No newline at end of file
diff --git a/src/routes/rezepte/season/+page.svelte b/src/routes/rezepte/season/+page.svelte
index 4b22371..cb6c1dc 100644
--- a/src/routes/rezepte/season/+page.svelte
+++ b/src/routes/rezepte/season/+page.svelte
@@ -11,9 +11,7 @@
-
Rezepte des Monats
-
{#each data.season as recipe}
diff --git a/src/routes/rezepte/tag/[tag]/+page.svelte b/src/routes/rezepte/tag/[tag]/+page.svelte
index b8901bc..ba40020 100644
--- a/src/routes/rezepte/tag/[tag]/+page.svelte
+++ b/src/routes/rezepte/tag/[tag]/+page.svelte
@@ -4,9 +4,11 @@
export let data: PageData;
export let current_month = new Date().getMonth() + 1;
import Card from '$lib/components/Card.svelte'
+ import Search from '$lib/components/Search.svelte';
Rezepte
In Tag {data.tag}
+
{#each data.recipes as recipe}