feat: make author clickable

This commit is contained in:
2023-08-12 18:32:56 +02:00
parent d2a02fcf34
commit 2b4173d759
27 changed files with 257 additions and 174 deletions

View File

@ -29,7 +29,13 @@ export default function Greet(
<KMenu type="main" context={movie} />
<RecipeHero
data={movie}
subline={[author, date.toString()]}
subline={[
author && {
title: author,
href: `/movies?q=${encodeURIComponent(author)}`,
},
date.toString(),
]}
editLink={session
? `https://notes.max-richter.dev/Media/movies/${movie.id}`
: ""}

View File

@ -1,7 +1,7 @@
import { Handlers, PageProps } from "$fresh/server.ts";
import { MainLayout } from "@components/layouts/main.tsx";
import { getAllMovies, Movie } from "@lib/resource/movies.ts";
import { MovieCard } from "@components/MovieCard.tsx";
import { ResourceCard } from "@components/Card.tsx";
import { Grid } from "@components/Grid.tsx";
import { IconArrowLeft } from "@components/icons.tsx";
import { KMenu } from "@islands/KMenu.tsx";
@ -9,7 +9,9 @@ import { RedirectSearchHandler } from "@islands/Search.tsx";
import { parseResourceUrl, searchResource } from "@lib/search.ts";
import { SearchResult } from "@lib/types.ts";
export const handler: Handlers<Movie[] | null> = {
export const handler: Handlers<
{ movies: Movie[] | null; searchResults?: SearchResult }
> = {
async GET(req, ctx) {
const movies = await getAllMovies();
const searchParams = parseResourceUrl(req.url);
@ -46,7 +48,7 @@ export default function Greet(
</header>
<Grid>
{movies?.map((doc) => {
return <MovieCard movie={doc} />;
return <ResourceCard res={doc} />;
})}
</Grid>
</MainLayout>