Skip to content

Commit 321f553

Browse files
densumeshskeptrunedev
authored andcommitted
bugfix: fix regressions in other modes
1 parent 58b47ff commit 321f553

File tree

6 files changed

+34
-42
lines changed

6 files changed

+34
-42
lines changed

clients/search-component/example/src/routes/inline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function Inline() {
3030
import.meta.env.VITE_DEFAULT_TAGS ?? "[]",
3131
);
3232
const defaultSearchMode =
33-
import.meta.env.VITE_DEFAULT_SEARCH_MODE ?? "search";
33+
import.meta.env.VITE_DEFAULT_SEARCH_MODE ?? "chat`";
3434
const defaultAIQuestions = (
3535
import.meta.env.VITE_DEFAULT_AI_QUESTIONS ?? ""
3636
).split(",");

clients/search-component/src/TrieveModal/Search/ProductItem.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export const ProductItem = ({
179179
</div>
180180
)}
181181
{title ? (
182-
<div className="tv-w-full tv-pt-2">
182+
<div>
183183
<h4
184184
className={`chunk-title ${props.type}`}
185185
dangerouslySetInnerHTML={{
@@ -253,9 +253,8 @@ export const ProductItem = ({
253253
}}
254254
/>
255255
)}
256-
{/* <div className="tv-flex-1" /> */}
257-
<AddToCartButton item={item} />
258256
<div className="tv-flex-1" />
257+
<AddToCartButton item={item} />
259258
</div>
260259
</a>
261260
</li>

clients/search-component/src/TrieveModal/Search/SearchInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const SearchInput = () => {
2222

2323
return (
2424
<div className={`input-wrapper ${props.type} tv-pt-2 trieve-mode-${mode}`}>
25-
<div className="input-flex group-focus:tv-border has-[:focus]:tv-border has-[:focus]:tv-border-[var(--tv-prop-brand-color)] sm:tv-text-sm sm:tv-leading-6 tv-py-1.5 tv-px-4 tv-items-center tv-flex tv-justify-between tv-w-full tv-rounded-lg tv-border-[1px]">
25+
<div className="input-flex group-focus:tv-border has-[:focus]:tv-border has-[:focus]:tv-border-[var(--tv-prop-brand-color)] sm:tv-text-sm sm:tv-leading-6 tv-py-1.5 tv-px-4 tv-items-center tv-flex tv-justify-between tv-w-full tv-rounded-lg tv-border-[1px] tv-mb-2">
2626
<input
2727
ref={inputRef}
2828
value={audioBase64 && query.length == 0 ? "Searching..." : query}

clients/search-component/src/TrieveModal/Search/SearchMode.tsx

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -125,39 +125,35 @@ export const SearchMode = () => {
125125
</div>
126126
)}
127127
<SearchInput />
128-
<div className="tv-flex tv-flex-grow">
129-
<SearchPage />
130-
<ul
131-
className={cn(
132-
`trieve-elements-${props.type} tv-grow`,
133-
"tv-max-w-[70vw]",
134-
props.type === "ecommerce" && !props.inline &&
135-
"tv-grid tv-grid-cols-2 sm:tv-grid-cols-3 md:tv-grid-cols-4 lg:tv-grid-cols-5 tv-gap-2 tv-mt-0.5 tv-py-2 tv-pr-0.5",
136-
props.type === "ecommerce" && props.inline && props.defaultSearchMode === "search" &&
137-
"tv-grid tv-grid-cols-2 sm:tv-grid-cols-3 md:tv-grid-cols-4 tv-gap-4 tv-mt-0.5 tv-py-2 tv-pr-0.5 ",
138-
props.type === "ecommerce" && props.inline && props.defaultSearchMode !== "search" && "tv-grid tv-grid-cols-1",
139-
"tv-overflow-y-auto",
140-
)}
141-
>
142-
{resultsLength && props.chat && imageUrl.length == 0 && props.defaultSearchMode !== "search" ? (
143-
<GoToChatPrompt />
144-
) : null}
145-
{props.type === "pdf" ? (
146-
<div className="tv-grid md:tv-grid-cols-3">{resultsDisplay}</div>
147-
) : (
148-
resultsDisplay
149-
)}
150-
</ul>
151-
152-
{hasQuery && !resultsLength && !loadingResults && (
153-
<NoResults props={props} query={query} />
154-
)}
155-
{hasQuery && !resultsLength && loadingResults && (
156-
<div className="tv-text-sm tv-animate-pulse tv-text-center tv-my-8 tv-flex tv-flex-col tv-gap-2 tv-col-span-full">
157-
<p className="">Searching...</p>
158-
</div>
159-
)}
128+
<SearchPage />
129+
<ul
130+
className={cn(
131+
`trieve-elements-${props.type} tv-grow`,
132+
props.type === "ecommerce" && !props.inline &&
133+
"tv-grid tv-grid-cols-2 sm:tv-grid-cols-3 md:tv-grid-cols-4 lg:tv-grid-cols-5 tv-gap-2 tv-mt-0.5 tv-py-2 tv-pr-0.5",
134+
props.type === "ecommerce" && props.inline && props.defaultSearchMode === "search" &&
135+
"tv-grid tv-grid-cols-2 sm:tv-grid-cols-3 md:tv-grid-cols-4 tv-gap-4 tv-mt-0.5 tv-py-2 tv-pr-0.5 tv-max-w-[70vw]",
136+
props.type === "ecommerce" && props.inline && props.defaultSearchMode !== "search" && "tv-grid tv-grid-cols-1",
137+
"tv-overflow-y-auto",
138+
)}
139+
>
140+
{resultsLength && props.chat && imageUrl.length == 0 && props.defaultSearchMode !== "search" ? (
141+
<GoToChatPrompt />
142+
) : null}
143+
{props.type === "pdf" ? (
144+
<div className="tv-grid md:tv-grid-cols-3">{resultsDisplay}</div>
145+
) : (
146+
resultsDisplay
147+
)}
148+
</ul>
149+
{hasQuery && !resultsLength && !loadingResults && (
150+
<NoResults props={props} query={query} />
151+
)}
152+
{hasQuery && !resultsLength && loadingResults && (
153+
<div className="tv-text-sm tv-animate-pulse tv-text-center tv-my-8 tv-flex tv-flex-col tv-gap-2 tv-col-span-full">
154+
<p className="">Searching...</p>
160155
</div>
156+
)}
161157
</>
162158
);
163159
};

clients/search-component/src/TrieveModal/Search/SuggestedQueries.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export const SuggestedQueries = () => {
1111
SuggestedQueriesResponse["queries"]
1212
>([]);
1313

14-
console.log(props.suggestedQueries && query);
15-
1614
const getQueries = useCallback(
1715
(abortController: AbortController) => {
1816
setIsLoading(true);

clients/search-component/src/TrieveModal/index.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ body {
106106
}
107107

108108
.trieve-elements-ecommerce {
109-
@apply tv-h-fit;
110109
> li > .product > div {
111-
@apply tv-flex tv-flex-col tv-h-fit;
110+
@apply tv-flex tv-flex-col;
112111
}
113112
}
114113

@@ -767,7 +766,7 @@ body {
767766
}
768767

769768
.item {
770-
@apply tv-select-none tv-cursor-pointer tv-py-2 tv-text-left tv-flex tv-flex-col tv-items-center tv-gap-2 tv-w-full tv-h-full tv-text-sm tv-outline-none tv-rounded-lg tv-px-5 tv-overflow-ellipsis;
769+
@apply tv-select-none tv-cursor-pointer tv-py-2 tv-text-left tv-flex tv-items-start tv-gap-2 tv-w-full tv-h-full tv-text-sm tv-outline-none tv-rounded-lg tv-px-5 tv-overflow-ellipsis;
771770

772771
background-color: white;
773772

0 commit comments

Comments
 (0)