web: more details in search results
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user