Skip to content

Commit

Permalink
fix: use tagsDetailed from rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel-Develops committed Jan 7, 2025
1 parent 6711a5b commit 9cdd69e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/app/search/useSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/components/common/Pill.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -40,7 +42,7 @@ const PillActionContainer = (props: React.PropsWithChildren<PillProps>) => {
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 (
<div {...prop} onClick={handleClick}>
Expand All @@ -51,9 +53,9 @@ const PillActionContainer = (props: React.PropsWithChildren<PillProps>) => {

const defaultOnClick = (e: React.MouseEvent) => {e.stopPropagation()}
return (
<a href={props.slug || ""} {...prop} onClick={defaultOnClick}>
<Link href={props.slug || ""} {...prop} onClick={defaultOnClick} prefetch={false}>
{props.children}
</a>
</Link>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/TranscriptDetailsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const TranscriptDetailsCard = ({ data, pillCountLimit = 3 }: { data: ContentTree
<div className='flex gap-[9px] flex-wrap'>
<div className='flex flex-wrap gap-[9px] max-md:gap-2'>
{tagsToDisplay?.map((tag, idx) => (
<Pill key={idx} kind="button" name={tag.name} type={"tags"} toggleFilter={toggleFilter} isSelected={selectedTags.includes(tag.slug)}/>
<Pill key={idx} kind="button" name={tag.name} value={tag.slug} type={"tags"} toggleFilter={toggleFilter} isSelected={selectedTags.includes(tag.slug)}/>
))}

{calculateRemaining(tagsDetailed) === 0 ? null : (
Expand Down
3 changes: 2 additions & 1 deletion src/components/search/SearchResultCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"];

Expand All @@ -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 (
Expand Down

0 comments on commit 9cdd69e

Please sign in to comment.