From dcec6f141c0811761309f8cbaebd34d6ae661a67 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 22 Jan 2024 11:19:15 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20dropdown=20icons=20for=20s?= =?UTF-8?q?lash=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui/src/components/mainInput/MentionList.tsx | 31 ++++++++------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index c639320f9..45c8d3872 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -43,7 +43,7 @@ import { } from "../../redux/slices/uiStateSlice"; import FileIcon from "../FileIcon"; import AddDocsDialog from "../dialogs/AddDocsDialog"; -import { ComboBoxItem, ComboBoxItemType } from "./types"; +import { ComboBoxItem } from "./types"; const ICONS_FOR_DROPDOWN: { [key: string]: any } = { file: FolderIcon, @@ -69,21 +69,24 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = { "/issue": ExclamationCircleIcon, }; -function DropdownIcon(props: { - provider: string; - className?: string; - type: ComboBoxItemType; -}) { - if (props.type === "action") { +function DropdownIcon(props: { className?: string; item: ComboBoxItem }) { + if (props.item.type === "action") { return ( ); } - const Icon = ICONS_FOR_DROPDOWN[props.provider]; + const provider = + props.item.type === "contextProvider" + ? props.item.id + : props.item.type === "slashCommand" + ? props.item.id + : props.item.type; + + const Icon = ICONS_FOR_DROPDOWN[provider]; const iconClass = `${props.className} flex-shrink-0`; if (!Icon) { - return props.type === "contextProvider" ? ( + return props.item.type === "contextProvider" ? ( ) : ( { )} {item.type !== "file" && ( <> - + )} {item.title}