feat(web): show recording_date on search rows; flag estimated count as approximate (#61)

This commit is contained in:
2026-06-08 13:45:35 +02:00
parent 1cdfa21259
commit 30da072d96
5 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -28,8 +28,8 @@
"loadError": "Search is unavailable", "loadError": "Search is unavailable",
"unavailable": "Search is not available on this server", "unavailable": "Search is not available on this server",
"loadMore": "Load more", "loadMore": "Load more",
"resultCount_one": "{{count}} result", "resultCount_one": "~{{count}} result",
"resultCount_other": "{{count}} results", "resultCount_other": "~{{count}} results",
"selectPrompt": "Select a result to see the full record" "selectPrompt": "Select a result to see the full record"
}, },
"fields": { "fields": {
+2 -2
View File
@@ -28,8 +28,8 @@
"loadError": "Sök är inte tillgängligt", "loadError": "Sök är inte tillgängligt",
"unavailable": "Sök är inte tillgängligt på den här servern", "unavailable": "Sök är inte tillgängligt på den här servern",
"loadMore": "Visa fler", "loadMore": "Visa fler",
"resultCount_one": "{{count}} träff", "resultCount_one": "~{{count}} träff",
"resultCount_other": "{{count}} träffar", "resultCount_other": "~{{count}} träffar",
"selectPrompt": "Välj en träff för att se hela posten" "selectPrompt": "Välj en träff för att se hela posten"
}, },
"fields": { "fields": {
+1
View File
@@ -18,6 +18,7 @@ export function SearchResultRow({ hit }: { hit: SearchHitView }) {
<div className="text-sm font-semibold">{hit.object_name}</div> <div className="text-sm font-semibold">{hit.object_name}</div>
<div className="mt-0.5 flex items-center gap-2 text-xs text-muted-foreground"> <div className="mt-0.5 flex items-center gap-2 text-xs text-muted-foreground">
<span>{hit.object_number}</span> <span>{hit.object_number}</span>
{hit.recording_date && <span>· {hit.recording_date}</span>}
<VisibilityBadge visibility={hit.visibility} /> <VisibilityBadge visibility={hit.visibility} />
</div> </div>
{hit.snippet && ( {hit.snippet && (
+2 -1
View File
@@ -60,7 +60,8 @@ test("typing searches and renders highlighted rich rows", async () => {
expect(await screen.findByText("Bronze figurine")).toBeInTheDocument(); expect(await screen.findByText("Bronze figurine")).toBeInTheDocument();
const mark = await screen.findByText("bronze"); const mark = await screen.findByText("bronze");
expect(mark.tagName).toBe("MARK"); expect(mark.tagName).toBe("MARK");
expect(screen.getByText(/25 results/i)).toBeInTheDocument(); expect(screen.getByText(/~\s*25 results/i)).toBeInTheDocument();
expect(screen.getByText(/1962-04-03/)).toBeInTheDocument();
}); });
test("Load more appends the next page", async () => { test("Load more appends the next page", async () => {
+2
View File
@@ -73,6 +73,7 @@ export const searchHits: SearchHitView[] = [
object_number: "2019.4.12", object_number: "2019.4.12",
object_name: "Bronze figurine", object_name: "Bronze figurine",
brief_description: "A small cast figure.", brief_description: "A small cast figure.",
recording_date: "1962-04-03",
visibility: "public", visibility: "public",
snippet: "cast bronze with green patina", snippet: "cast bronze with green patina",
}, },
@@ -81,6 +82,7 @@ export const searchHits: SearchHitView[] = [
object_number: `N-${i + 2}`, object_number: `N-${i + 2}`,
object_name: `Object ${i + 2}`, object_name: `Object ${i + 2}`,
brief_description: null, brief_description: null,
recording_date: null,
visibility: "internal" as const, visibility: "internal" as const,
snippet: null, snippet: null,
})), })),