From 9cdd69e606fb878acdb289ca78362b2c23bc2578 Mon Sep 17 00:00:00 2001 From: Emmanuel-Develops Date: Tue, 7 Jan 2025 14:43:48 +0100 Subject: [PATCH] fix: use tagsDetailed from rebase --- src/app/search/useSearch.tsx | 1 - src/components/common/Pill.tsx | 8 +++++--- src/components/common/TranscriptDetailsCard.tsx | 2 +- src/components/search/SearchResultCard.tsx | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/search/useSearch.tsx b/src/app/search/useSearch.tsx index 981f0c3..c3951ae 100644 --- a/src/app/search/useSearch.tsx +++ b/src/app/search/useSearch.tsx @@ -87,7 +87,6 @@ export const SearchContextProvider = ({ queryKey: ["query", searchQuery, sizeQuery, filterFields, page, sortFields], queryFn: () => buildQueryCall({ queryString: searchQuery, size: sizeQuery, page, filterFields, sortFields }), - // cacheTime: Infinity, staleTime: Infinity, refetchOnWindowFocus: false, placeholderData: (prev) => prev, diff --git a/src/components/common/Pill.tsx b/src/components/common/Pill.tsx index 641dd1e..438be8b 100644 --- a/src/components/common/Pill.tsx +++ b/src/components/common/Pill.tsx @@ -1,9 +1,11 @@ import { FacetKeys } from "@/app/search/types"; +import Link from "next/link"; import { twMerge } from "tailwind-merge"; type ButtonPillProp = { kind: "button" name: string; + value: string; isSelected?: boolean; type: FacetKeys; toggleFilter: ({ filterType, filterValue }: { filterType: FacetKeys; filterValue: string }) => void; @@ -40,7 +42,7 @@ const PillActionContainer = (props: React.PropsWithChildren) => { const handleClick = (e: React.MouseEvent) => { props.onClick ? props.onClick(e) - : props.toggleFilter({ filterType: props.type, filterValue: props.name }); + : props.toggleFilter({ filterType: props.type, filterValue: props.value }); } return (
@@ -51,9 +53,9 @@ const PillActionContainer = (props: React.PropsWithChildren) => { const defaultOnClick = (e: React.MouseEvent) => {e.stopPropagation()} return ( - + {props.children} - + ); }; diff --git a/src/components/common/TranscriptDetailsCard.tsx b/src/components/common/TranscriptDetailsCard.tsx index 9a044b1..254f621 100644 --- a/src/components/common/TranscriptDetailsCard.tsx +++ b/src/components/common/TranscriptDetailsCard.tsx @@ -87,7 +87,7 @@ const TranscriptDetailsCard = ({ data, pillCountLimit = 3 }: { data: ContentTree
{tagsToDisplay?.map((tag, idx) => ( - + ))} {calculateRemaining(tagsDetailed) === 0 ? null : ( diff --git a/src/components/search/SearchResultCard.tsx b/src/components/search/SearchResultCard.tsx index 0415d35..2a81cb1 100644 --- a/src/components/search/SearchResultCard.tsx +++ b/src/components/search/SearchResultCard.tsx @@ -4,6 +4,7 @@ import React from "react"; import TranscriptDetailsCard from "@/components/common/TranscriptDetailsCard"; import { ContentTreeArray } from "@/utils/data"; import { EsSearchResult } from "@/app/search/types"; +import { unsluggify } from "@/utils"; type Result = EsSearchResult["_source"]; @@ -16,11 +17,11 @@ export const SearchResultCard = ({ result }: { result: Result }) => { title, body, speakers: authors, - tags, sourceFilePath: transcript_source, flattenedPath, languageURL: flattenedPath, date: date as unknown as string, + tagsDetailed: tags.map((tag) => ({ name: unsluggify(tag), slug: tag })), } return (