diff --git a/data.jai b/data.jai
index 9a9ff8b..05de79f 100644
--- a/data.jai
+++ b/data.jai
@@ -8,8 +8,20 @@ get_id :: () -> string {
return sprint("REF-%", state.idTicker);
}
+Slot :: struct {
+ id : string;
+ tags : [..]string;
+}
+
+Ingredient :: struct {
+ name : string;
+ amount : float;
+}
+
Component :: struct {
-
+ isSlot : bool;
+ slot : Slot;
+ ingredient : Ingredient;
}
Recipe :: struct {
@@ -18,12 +30,27 @@ Recipe :: struct {
category : string = "Breakfast";
image : string = "https://images.unsplash.com/photo-1546069901-ba9599a7e63c?q=80&w=500&auto=format&fit=crop";
duration : int = 5;
+ components: [..]Component;
+ steps : [..]string;
}
state : State;
init_data :: () {
recipe := Recipe.{};
+
+ array_add(*recipe.steps, "Testi 1");
+ array_add(*recipe.steps, "Testi 2");
+ array_add(*recipe.steps, "Testi 3");
+
+ tags : [..]string;
+ array_add(*tags, "vegetable side");
+ array_add(*tags, "asia");
+
+
+ array_add(*recipe.components, .{false, .{}, .{"suola (g)", 5}});
+ array_add(*recipe.components, .{true, .{"", tags}, .{}});
+
recipe.id = get_id();
array_add(*state.recipes, recipe);
recipe.id = get_id();
diff --git a/pages/recipe.jai b/pages/recipe.jai
index ff8b72b..d6e6273 100644
--- a/pages/recipe.jai
+++ b/pages/recipe.jai
@@ -11,10 +11,82 @@ get_recipe_page :: (req: Request) -> string {
add_navbar(*builder);
print_to_builder(*builder, recipeHero, curRecipe.image);
+ print_to_builder(*builder, "
");
+ print_to_builder(*builder, recipeHeroCard, curRecipe.id, curRecipe.category, curRecipe.name, curRecipe.duration, curRecipe.duration);
+ print_to_builder(*builder, "
");
+ print_to_builder(*builder, "");
+ add_ingredients(curRecipe, *builder);
+ add_steps(curRecipe, *builder);
+ print_to_builder(*builder, "
");
+
return builder_to_string(*builder);
}
+add_ingredients :: (recipe: Recipe, builder: *String_Builder) {
+ print_to_builder(builder, "");
+ print_to_builder(builder, "
Ingredients
");
+
+ ingredientHtml : string = #string DONE
+
+ DONE
+
+ slotHtml : string = #string DONE
+
+ DONE
+
+ for recipe.components {
+ b : String_Builder;
+ if !it.isSlot {
+ print_to_builder(builder, ingredientHtml, it.ingredient.name, it.ingredient.amount);
+ } else {
+ for t : it.slot.tags {
+ print_to_builder(*b, "[%] ", t);
+ }
+ print_to_builder(builder, slotHtml, builder_to_string(*b));
+ }
+ }
+ print_to_builder(builder, "
");
+
+}
+
+add_steps :: (recipe: Recipe, builder: *String_Builder) {
+ stepHtml : string = #string DONE
+
+ DONE
+
+ print_to_builder(builder, "");
+ print_to_builder(builder, "
Steps
");
+ for it, i : recipe.steps {
+ print_to_builder(builder, stepHtml, i+1, it);
+ }
+ print_to_builder(builder, "
");
+}
+
+recipeHeroCard : string = #string DONE
+
+DONE
+
recipeHero : string = #string DONE

diff --git a/style.jai b/style.jai
index a9a7e17..f24ae2d 100644
--- a/style.jai
+++ b/style.jai
@@ -98,7 +98,7 @@ nav { padding: 1rem var(--space); display: flex; justify-content: space-between;
.specs { display: flex; gap: 3rem; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--gold-dim); }
.spec-val { font-family: 'Playfair Display', serif; font-size: 1.5rem; }
-.layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 5rem; max-width: 1200px; margin: 0 auto; padding-bottom: 100px; }
+.layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 5rem; max-width: 1200px; margin: 0 auto; padding-bottom: 100px; padding-left: 20px; padding-right: 20px; }
.component-row { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 0; border-bottom: 1px solid var(--gold-dim); }
.component-name { font-weight: 500; font-size: 1.1rem; }