feat: add initial recommendation data

This commit is contained in:
2023-09-08 13:33:29 +02:00
parent 517b1ba23d
commit cc112b7554
19 changed files with 289 additions and 170 deletions

View File

@@ -1,4 +1,4 @@
import { Handlers, PageProps } from "$fresh/server.ts";
import { Handlers, PageProps, RouteContext } from "$fresh/server.ts";
import { MainLayout } from "@components/layouts/main.tsx";
import { getMovie, Movie } from "@lib/resource/movies.ts";
import { RecipeHero } from "@components/RecipeHero.tsx";
@@ -7,17 +7,12 @@ import { renderMarkdown } from "@lib/documents.ts";
import { KMenu } from "@islands/KMenu.tsx";
import { RedirectSearchHandler } from "@islands/Search.tsx";
export const handler: Handlers<Movie | null> = {
async GET(_, ctx) {
const movie = await getMovie(ctx.params.name);
return ctx.render({ movie, session: ctx.state.session });
},
};
export default function Greet(
export default async function Greet(
props: PageProps<{ movie: Movie; session: Record<string, string> }>,
ctx: RouteContext,
) {
const { movie, session } = props.data;
const movie = await getMovie(ctx.params.name);
const session = ctx.state.session;
const { author = "", date = "" } = movie.meta;