diff --git a/components/Image.tsx b/components/Image.tsx index 7dd7c7b..abe7c2a 100644 --- a/components/Image.tsx +++ b/components/Image.tsx @@ -1,5 +1,5 @@ import { asset } from "$fresh/runtime.ts"; -import * as CSS from "https://esm.sh/csstype@3.1.2"; +import * as CSS from "csstype"; interface ResponsiveAttributes { srcset: string; diff --git a/deno.json b/deno.json index 154e946..85a66fb 100644 --- a/deno.json +++ b/deno.json @@ -26,11 +26,14 @@ "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1", "@std/http": "jsr:@std/http@^1.0.12", "@std/yaml": "jsr:@std/yaml@^1.0.5", + "csstype": "npm:csstype@^3.1.3", "defuddle": "npm:defuddle@^0.6.6", "drizzle-kit": "npm:drizzle-kit@^0.30.1", "drizzle-orm": "npm:drizzle-orm@^0.38.3", "fuzzysort": "npm:fuzzysort@^3.1.0", "jsdom": "npm:jsdom@^24.1.3", + "moviedb-promise": "npm:moviedb-promise@^4.0.7", + "parse-ingredient": "npm:parse-ingredient@^1.3.1", "playwright": "npm:playwright@^1.49.1", "playwright-extra": "npm:playwright-extra@^4.3.6", "preact": "https://esm.sh/preact@10.22.0", @@ -42,6 +45,7 @@ "tailwindcss/": "npm:/tailwindcss@^3.4.17/", "tailwindcss/plugin": "npm:/tailwindcss@^3.4.17/plugin.js", "camelcase-css": "npm:camelcase-css", + "thumbhash": "npm:thumbhash@^0.1.1", "tsx": "npm:tsx@^4.19.2", "yaml": "https://deno.land/std@0.197.0/yaml/mod.ts", "zod": "npm:zod@^3.24.1", diff --git a/islands/IngredientsList.tsx b/islands/IngredientsList.tsx index e37d49d..1239946 100644 --- a/islands/IngredientsList.tsx +++ b/islands/IngredientsList.tsx @@ -43,13 +43,13 @@ const Ingredient = ( return ( - + {formatAmount(finalAmount || 0)} {formatUnit(unit, finalAmount || 0)} - {name} + {name} ); }; @@ -66,14 +66,10 @@ export const IngredientsList: FunctionalComponent< return ( - {ingredients.filter((s) => !!s?.length).map((item) => { + {ingredients.map((item) => { return ( -
-
+ ); - // return ( - // - // ); })}
diff --git a/islands/Search.tsx b/islands/Search.tsx index d822eac..48c132a 100644 --- a/islands/Search.tsx +++ b/islands/Search.tsx @@ -69,7 +69,6 @@ export const SearchResultItem = ( ) => { const resourceType = resources[item?.content._type]; const href = item?.path.replace("/resources", "").replace(/\.md$/, ""); - console.log({ item, href }); return ( {movie.content.reviewRating && ( diff --git a/routes/recipes/[name].tsx b/routes/recipes/[name].tsx index 0327180..6624fbf 100644 --- a/routes/recipes/[name].tsx +++ b/routes/recipes/[name].tsx @@ -3,7 +3,6 @@ import { IngredientsList } from "@islands/IngredientsList.tsx"; import { MainLayout } from "@components/layouts/main.tsx"; import Counter from "@islands/Counter.tsx"; import { Signal, useSignal } from "@preact/signals"; -import { Recipe } from "@lib/recipeSchema.ts"; import { RedirectSearchHandler } from "@islands/Search.tsx"; import { KMenu } from "@islands/KMenu.tsx"; import PageHero from "@components/PageHero.tsx"; @@ -12,8 +11,12 @@ import { renderMarkdown } from "@lib/markdown.ts"; import { isValidRecipe } from "@lib/recipeSchema.ts"; import { MetaTags } from "@components/MetaTags.tsx"; import { fetchResource } from "@lib/marka/index.ts"; +import { RecipeResource } from "@lib/marka/schema.ts"; +import { parseIngredients } from "@lib/parseIngredient.ts"; -export const handler: Handlers<{ recipe: Recipe; session: unknown } | null> = { +export const handler: Handlers< + { recipe: RecipeResource; session: unknown } | null +> = { async GET(_, ctx) { try { const recipe = await fetchResource(`recipes/${ctx.params.name}.md`); @@ -31,7 +34,11 @@ function ValidRecipe({ recipe, amount, portion, -}: { recipe: Recipe; amount: Signal; portion: number }) { +}: { recipe: RecipeResource; amount: Signal; portion: number }) { + const ingredients = parseIngredients( + recipe.content.recipeIngredient?.join("\n"), + ); + return ( <>
@@ -39,7 +46,7 @@ function ValidRecipe({ {portion && }
diff --git a/routes/series/[name].tsx b/routes/series/[name].tsx index 3c039ce..5ed7d66 100644 --- a/routes/series/[name].tsx +++ b/routes/series/[name].tsx @@ -23,14 +23,14 @@ export const handler: Handlers<{ serie: ReviewResource; session: unknown }> = { }; export default function Greet( - props: PageProps<{ serie: Series; session: Record }>, + props: PageProps<{ serie: ReviewResource; session: Record }>, ) { const { serie, session } = props.data; - const { author = "", date = "" } = serie?.content || {}; + const { author = "", date = "", reviewBody } = serie?.content || {}; const content = renderMarkdown( - removeImage(serie.description || "", serie.content?.image), + removeImage(reviewBody, serie.image?.url), ); return (