From ec106d743d4cf8cf6aa0dfdb8d4dc3fbbc440c3c Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Mon, 5 Aug 2024 19:24:39 +0530 Subject: [PATCH] Use file icon associated with search page results. Improve search bar --- src/interface/web/app/search/page.tsx | 31 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/interface/web/app/search/page.tsx b/src/interface/web/app/search/page.tsx index a6972d80..a49f0268 100644 --- a/src/interface/web/app/search/page.tsx +++ b/src/interface/web/app/search/page.tsx @@ -20,8 +20,6 @@ import { ArrowRight, FileDashed, FileMagnifyingGlass, - Folder, - FolderOpen, GithubLogo, Lightbulb, LinkSimple, @@ -31,6 +29,7 @@ import { } from "@phosphor-icons/react"; import { Button } from "@/components/ui/button"; import Link from "next/link"; +import { getIconFromFilename } from "../common/iconUtils"; interface AdditionalData { file: string; @@ -87,14 +86,15 @@ function Note(props: NoteResultProps) { const fileName = isFileNameURL ? note.additional.heading : note.additional.file.split("/").pop(); + const fileIcon = getIconFromFilename(fileName || ".txt", "h-4 w-4 inline mr-2"); return ( - + {getNoteTypeIcon(note.additional.source)} - - {fileName} + {fileName} +
{note.entry}
@@ -118,8 +118,8 @@ function Note(props: NoteResultProps) { {note.additional.file} ) : ( -
- +
+ {fileIcon} {note.additional.file}
)} @@ -133,6 +133,8 @@ function focusNote(note: SearchResult) { const fileName = isFileNameURL ? note.additional.heading : note.additional.file.split("/").pop(); + const fileIcon = getIconFromFilename(fileName || ".txt", "h-4 w-4 inline mr-2"); + return ( @@ -150,7 +152,7 @@ function focusNote(note: SearchResult) { ) : (
- + {fileIcon} {note.additional.file}
)} @@ -243,18 +245,21 @@ export default function Search() {
-
- +
setSearchQuery(e.currentTarget.value)} onKeyDown={(e) => e.key === "Enter" && search()} type="search" placeholder="Search Documents" /> -
{focusSearchResult && (