From 03707d06d3a843b3879784de828d570888187753 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 18 Sep 2024 08:41:08 -0500 Subject: [PATCH] tooltips --- web/src/components/input/InputWithTags.tsx | 102 ++++++++++++++------- web/src/views/search/SearchView.tsx | 7 +- 2 files changed, 71 insertions(+), 38 deletions(-) diff --git a/web/src/components/input/InputWithTags.tsx b/web/src/components/input/InputWithTags.tsx index a8cd2bce3..0ed5faab8 100644 --- a/web/src/components/input/InputWithTags.tsx +++ b/web/src/components/input/InputWithTags.tsx @@ -1,6 +1,11 @@ import { useState, useRef, useEffect, useMemo, useCallback } from "react"; -import { Button } from "@/components/ui/button"; -import { LuX, LuFilter, LuImage } from "react-icons/lu"; +import { + LuX, + LuFilter, + LuImage, + LuChevronDown, + LuChevronUp, +} from "react-icons/lu"; import { FilterType, SearchFilter, SearchSource } from "@/types/search"; import useSuggestions from "@/hooks/use-suggestions"; import { @@ -11,6 +16,8 @@ import { CommandItem, } from "@/components/ui/command"; import { cn } from "@/lib/utils"; +import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip"; +import { TooltipPortal } from "@radix-ui/react-tooltip"; const convertMMDDYYToTimestamp = (dateString: string): number => { const match = dateString.match(/^(\d{2})(\d{2})(\d{2})$/); @@ -338,50 +345,81 @@ export default function InputWithTags({ onFocus={handleInputFocus} onBlur={handleInputBlur} onKeyDown={handleInputKeyDown} - className="text-md h-10 pr-20" + className="text-md h-10 pr-24" placeholder="Search..." /> -
- {(Object.keys(filters).length > 0 || isSimilaritySearch) && ( - - )} +
{(search || Object.keys(filters).length > 0) && ( - + + + + + + Clear search + + + )} + + {isSimilaritySearch && ( + + + + + + Similarity search active + + + )} + + + + 0 + ? "text-selected" + : "text-secondary-foreground", + )} + /> + + + + Filters{" "} + {Object.keys(filters).length > 0 ? "active" : "inactive"} + + + + + {inputFocused ? ( + setInputFocused(false)} + className="size-4 cursor-pointer text-secondary-foreground" + /> + ) : ( + setInputFocused(true)} + className="size-4 cursor-pointer text-secondary-foreground" + /> )}
{(Object.keys(filters).length > 0 || isSimilaritySearch) && ( -
+
{isSimilaritySearch && ( Similarity Search diff --git a/web/src/views/search/SearchView.tsx b/web/src/views/search/SearchView.tsx index 673374d4b..c310ed399 100644 --- a/web/src/views/search/SearchView.tsx +++ b/web/src/views/search/SearchView.tsx @@ -268,12 +268,7 @@ export default function SearchView({ )} > {config?.semantic_search?.enabled && ( -
+