feat: initial refactor to use marka as backend
This commit is contained in:
@@ -3,6 +3,7 @@ import { IconBrandYoutube } from "@components/icons.tsx";
|
||||
import { GenericResource } from "@lib/types.ts";
|
||||
import { SmallRating } from "@components/Rating.tsx";
|
||||
import { Link } from "@islands/Link.tsx";
|
||||
import { parseRating } from "@lib/helpers.ts";
|
||||
|
||||
export function Card(
|
||||
{
|
||||
@@ -96,20 +97,21 @@ export function Card(
|
||||
export function ResourceCard(
|
||||
{ res, sublink = "movies" }: { sublink?: string; res: GenericResource },
|
||||
) {
|
||||
const { meta: { image } = {} } = res || {};
|
||||
const img = res?.content?.image || res?.content?.cover;
|
||||
|
||||
const imageUrl = image
|
||||
? `/api/images?image=${image}&width=200&height=200`
|
||||
const imageUrl = img
|
||||
? `/api/images?image=${img}&width=200&height=200`
|
||||
: "/placeholder.svg";
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={res.name}
|
||||
title={res.content?.name || res.content?.itemReviewed?.name || res.content?.headline ||
|
||||
res?.name}
|
||||
backgroundColor={res.meta?.average}
|
||||
rating={res.meta?.rating}
|
||||
thumbnail={res.meta?.thumbnail}
|
||||
rating={parseRating(res.content?.reviewRating?.ratingValue)}
|
||||
thumbnail={res.cover}
|
||||
image={imageUrl}
|
||||
link={`/${sublink}/${res.id}`}
|
||||
link={`/${sublink}/${res.name.replace(/\.md$/g, "")}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user