web: more details in search results

This commit is contained in:
2026-05-25 22:56:24 +02:00
parent af8c3fe768
commit 433c88c921
6 changed files with 232 additions and 55 deletions
+35 -7
View File
@@ -1,6 +1,9 @@
import { graphql } from "@/gql";
import { getClient } from "@/app/client";
import { SearchContainer } from "@/components/search/SearchContainer";
import {
SearchContainer,
type SearchResult,
} from "@/components/search/SearchContainer";
import { Suspense } from "react";
// TODO: seo metadata?
@@ -13,7 +16,7 @@ export default async function Page({
}>;
}) {
const { q: query } = (await searchParams) ?? {};
let results = [];
let results: SearchResult[] = [];
if (query) {
const searchQuery = graphql(`
@@ -25,18 +28,43 @@ export default async function Page({
title
url
}
... on NewsPage {
excerpt
featuredImage {
...Image
}
firstPublishedAt
}
... on EventPage {
subtitle
featuredImage {
...Image
}
occurrences {
start
}
}
... on GenericPage {
lead
}
... on VenuePage {
featuredImage {
...Image
}
}
... on AssociationPage {
excerpt
associationType
logo {
...Image
}
}
}
}
`);
const { data, error } = await getClient().query(searchQuery, {
query: query,
});
results = (data?.results ?? []) as any;
const { data } = await getClient().query(searchQuery, { query });
results = (data?.results ?? []) as SearchResult[];
}
return (