From 0b1334d5087bba4b786340759f48cf7fe4d17cc0 Mon Sep 17 00:00:00 2001 From: june Date: Fri, 15 Aug 2025 16:12:02 +1200 Subject: [PATCH] [PIE-13] New recipe page (!11) Add `/recipe/new` path with form to add new recipe Mostly designed but not fully: steps and ingredients are inputtable with final styling but it cannot be submitted yet, and other crucial components like description, rating, etc are not yet implemented. Many design changes too cos i couldnt help myself More additions will certainly be required but this PR is huge so I will split it out into more Reviewed-on: https://git.breadone.xyz/breadone/Recipie/pulls/11 Co-authored-by: june Co-committed-by: june --- .../Detail/StepIngredientSideView.astro | 2 +- src/components/Detail/StepView.astro | 6 +- src/components/Header.astro | 6 +- src/pages/recipe/[recipeid].astro | 12 +- src/pages/recipe/new.astro | 94 +++++++++ src/script/newRecipe.ts | 185 ++++++++++++++++++ tsconfig.json | 1 + 7 files changed, 292 insertions(+), 14 deletions(-) create mode 100644 src/pages/recipe/new.astro create mode 100644 src/script/newRecipe.ts diff --git a/src/components/Detail/StepIngredientSideView.astro b/src/components/Detail/StepIngredientSideView.astro index 5b6c7dd..b4cdc49 100644 --- a/src/components/Detail/StepIngredientSideView.astro +++ b/src/components/Detail/StepIngredientSideView.astro @@ -10,7 +10,7 @@ const ings = await Promise.all(
{ings.map(i => ( -
+

• {i.quantity} {i.unit || " "} {i.name}

))} diff --git a/src/components/Detail/StepView.astro b/src/components/Detail/StepView.astro index a7652b6..1860721 100644 --- a/src/components/Detail/StepView.astro +++ b/src/components/Detail/StepView.astro @@ -3,10 +3,10 @@ import { record } from "astro:schema" import client from "@/data/pocketbase" import StepIngredientSideView from "./StepIngredientSideView.astro" -const { steps } = Astro.props +const { steps, class: className } = Astro.props --- -
+

Steps

{ steps.map(s => (
@@ -15,7 +15,7 @@ const { steps } = Astro.props

{s.instruction}

{s.ingredients && s.ingredients.length > 0 && ( -
+
)} diff --git a/src/components/Header.astro b/src/components/Header.astro index 5ffff2c..28dd602 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -7,8 +7,8 @@
- new - tags - search + new + tags + search
\ No newline at end of file diff --git a/src/pages/recipe/[recipeid].astro b/src/pages/recipe/[recipeid].astro index 052862f..d123a91 100644 --- a/src/pages/recipe/[recipeid].astro +++ b/src/pages/recipe/[recipeid].astro @@ -28,10 +28,10 @@ const ingredients = await Promise.all( --- -
-
+
+
-

{re.name}

+

{re.name}

@@ -40,11 +40,9 @@ const ingredients = await Promise.all(
-
- - +
- +
diff --git a/src/pages/recipe/new.astro b/src/pages/recipe/new.astro new file mode 100644 index 0000000..605314b --- /dev/null +++ b/src/pages/recipe/new.astro @@ -0,0 +1,94 @@ +--- +import SiteLayout from "@/layouts/base"; + +const { recipeid } = Astro.params; + +// Actually post the recipe with the stored variables +async function submitRecipe() { + +} + +--- +