fix: make recipe ingredinets interactive
This commit is contained in:
@@ -24,10 +24,10 @@ export default async function Greet(
|
||||
return ctx.renderNotFound();
|
||||
}
|
||||
|
||||
const { author = "", datePublished = "" } = movie.content;
|
||||
const { author = "", datePublished = "",reviewBody } = movie.content;
|
||||
|
||||
const content = renderMarkdown(
|
||||
removeImage(movie.content.reviewBody || "", movie.content.image),
|
||||
removeImage(reviewBody || "", movie.content.image),
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -57,7 +57,7 @@ export default async function Greet(
|
||||
title: author?.name,
|
||||
href: `/?q=${encodeURIComponent(author?.name)}`,
|
||||
},
|
||||
datePublished.toString(),
|
||||
date.toString(),
|
||||
]}
|
||||
>
|
||||
{movie.content.reviewRating && (
|
||||
|
||||
@@ -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<number>; portion: number }) {
|
||||
}: { recipe: RecipeResource; amount: Signal<number>; portion: number }) {
|
||||
const ingredients = parseIngredients(
|
||||
recipe.content.recipeIngredient?.join("\n"),
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div class="flex items-center gap-8">
|
||||
@@ -39,7 +46,7 @@ function ValidRecipe({
|
||||
{portion && <Counter count={amount} />}
|
||||
</div>
|
||||
<IngredientsList
|
||||
ingredients={recipe.content.recipeIngredient}
|
||||
ingredients={ingredients}
|
||||
amount={amount}
|
||||
portion={portion}
|
||||
/>
|
||||
|
||||
@@ -23,14 +23,14 @@ export const handler: Handlers<{ serie: ReviewResource; session: unknown }> = {
|
||||
};
|
||||
|
||||
export default function Greet(
|
||||
props: PageProps<{ serie: Series; session: Record<string, string> }>,
|
||||
props: PageProps<{ serie: ReviewResource; session: Record<string, string> }>,
|
||||
) {
|
||||
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 (
|
||||
|
||||
Reference in New Issue
Block a user