feat: refactor whole bunch of stuff

This commit is contained in:
Max Richter
2025-11-02 19:03:11 +01:00
parent 81ebc8f5e0
commit e6b90cb785
56 changed files with 753 additions and 360 deletions

View File

@@ -1,5 +1,5 @@
import { MainLayout } from "@components/layouts/main.tsx";
import { Movie } from "@lib/resource/movies.ts";
import { ReviewResource } from "@lib/marka/schema.ts";
import { ResourceCard } from "@components/Card.tsx";
import { Grid } from "@components/Grid.tsx";
import { IconArrowLeft } from "@components/icons.tsx";
@@ -7,15 +7,15 @@ 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 { fetchResource } from "@lib/marka.ts";
import { listResources } from "@lib/marka/index.ts";
import { parseResourceUrl, searchResource } from "@lib/search.ts";
export default async function Greet(
export default async function MovieIndex(
props: PageProps<
{ movies: Movie[] | null; searchResults: GenericResource[] }
{ movies: ReviewResource[] | null; searchResults: GenericResource[] }
>,
) {
const { content: allMovies } = await fetchResource("movies");
const allMovies = await listResources("movies");
const searchParams = parseResourceUrl(props.url);
const searchResults = searchParams &&
await searchResource({ ...searchParams, types: ["movie"] });
@@ -47,8 +47,8 @@ export default async function Greet(
<h3 class="text-2xl text-white font-light">🍿 Movies</h3>
</header>
<Grid>
{movies?.map((doc) => {
return <ResourceCard res={doc} />;
{movies?.map((doc, i) => {
return <ResourceCard key={i} res={doc} />;
})}
</Grid>
</MainLayout>