fix: soo many lint errors

This commit is contained in:
Max Richter
2025-11-03 00:03:27 +01:00
parent c13420c3ab
commit 696082250d
41 changed files with 373 additions and 500 deletions

View File

@@ -1,29 +1,33 @@
import { MainLayout } from "@components/layouts/main.tsx";
import { ReviewResource } from "@lib/marka/schema.ts";
import { GenericResource, ReviewResource } from "@lib/marka/schema.ts";
import { ResourceCard } from "@components/Card.tsx";
import { Grid } from "@components/Grid.tsx";
import { IconArrowLeft } from "@components/icons.tsx";
import { KMenu } from "@islands/KMenu.tsx";
import { RedirectSearchHandler } from "@islands/Search.tsx";
import { GenericResource } from "@lib/types.ts";
import { PageProps } from "$fresh/server.ts";
import { listResources } from "@lib/marka/index.ts";
import { parseResourceUrl, searchResource } from "@lib/search.ts";
import { parseRating } from "@lib/helpers.ts";
function sortOptional(a: number | string = 0, b: number | string = 0) {
return (parseRating(a) > parseRating(b)) ? 1 : -1;
}
export default async function MovieIndex(
props: PageProps<
{ movies: ReviewResource[] | null; searchResults: GenericResource[] }
>,
) {
const allMovies = await listResources("movies");
const allMovies = await listResources<ReviewResource>("movies");
const searchParams = parseResourceUrl(props.url);
const searchResults = searchParams &&
await searchResource({ ...searchParams, types: ["movie"] });
const movies = allMovies.sort((a, b) =>
a?.content?.reviewRating?.ratingValue >
b?.content?.reviewRating?.ratingValue
? -1
: 1
sortOptional(
a.content.reviewRating?.ratingValue,
b.content.reviewRating?.ratingValue,
)
);
return (