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

@ -1,29 +1,30 @@
import { Handlers, PageProps } from "$fresh/server.ts";
import { MainLayout } from "@components/layouts/main.tsx";
import { Article, getAllArticles } from "@lib/resource/articles.ts";
import { Card } from "@components/Card.tsx";
import { KMenu } from "@islands/KMenu.tsx";
import { Grid } from "@components/Grid.tsx";
import { IconArrowLeft } from "@components/icons.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<
{ articles: Article[] | null; searchResults?: SearchResult }
{ articles: Article[] | null; searchResults?: GenericResource[] }
> = {
async GET(req, ctx) {
const articles = await getAllArticles();
const searchParams = parseResourceUrl(req.url);
const searchResults = searchParams &&
await searchResource({ ...searchParams, type: "article" });
await searchResource({ ...searchParams, types: ["article"] });
return ctx.render({ articles, searchResults });
},
};
export default function Greet(
props: PageProps<{ articles: Article[] | null; searchResults: SearchResult }>,
props: PageProps<
{ articles: Article[] | null; searchResults: GenericResource[] }
>,
) {
const { articles, searchResults } = props.data;
return (