feat: remove typesense

This commit is contained in:
2025-01-05 23:14:19 +01:00
parent d0d49b217d
commit 709fb2d7be
21 changed files with 128 additions and 381 deletions

View File

@ -6,23 +6,25 @@ import { IconArrowLeft } from "@components/icons.tsx";
import { KMenu } from "@islands/KMenu.tsx";
import { RedirectSearchHandler } from "@islands/Search.tsx";
import { parseResourceUrl, searchResource } from "@lib/search.ts";
import { SearchResult } from "@lib/types.ts";
import { GenericResource } from "@lib/types.ts";
import { ResourceCard } from "@components/Card.tsx";
export const handler: Handlers<
{ recipes: Recipe[] | null; searchResults?: SearchResult }
{ recipes: Recipe[] | null; searchResults?: GenericResource[] }
> = {
async GET(req, ctx) {
const recipes = await getAllRecipes();
const searchParams = parseResourceUrl(req.url);
const searchResults = searchParams &&
await searchResource({ ...searchParams, type: "recipe" });
await searchResource({ ...searchParams, types: ["recipe"] });
return ctx.render({ recipes, searchResults });
},
};
export default function Greet(
props: PageProps<{ recipes: Recipe[] | null; searchResults: SearchResult }>,
props: PageProps<
{ recipes: Recipe[] | null; searchResults: GenericResource[] }
>,
) {
const { recipes, searchResults } = props.data;
return (