feat: initial refactor to use marka as backend

This commit is contained in:
Max Richter
2025-10-28 20:15:23 +01:00
parent 0beb3b1071
commit f680b5f832
39 changed files with 245 additions and 1012 deletions

View File

@@ -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, "")}`}
/>
);
}