diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 530144e4a..323b586d0 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -155,7 +155,6 @@ const ItemDiv = styled.div` text-align: left; width: 100%; color: ${vscForeground}; - cursor: pointer; &.is-selected { background-color: ${vscListActiveBackground}; @@ -203,6 +202,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { const [querySubmenuItem, setQuerySubmenuItem] = useState< ComboBoxItem | undefined >(undefined); + const [loadingSubmenuItem, setLoadingSubmenuItem] = useState< + ComboBoxItem | undefined + >(undefined); const [allItems, setAllItems] = useState([]); @@ -245,8 +247,8 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { description: "Create a new .prompt file", }); } - - setAllItems(items); + setLoadingSubmenuItem(items.find((item) => item.id === "loading")); + setAllItems(items.filter((item) => item.id !== "loading")); }, [subMenuTitle, props.items, props.editor]); const queryInputRef = useRef(null); @@ -403,78 +405,98 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { ) : ( <> {subMenuTitle && {subMenuTitle}} - {allItems.length ? ( - allItems.map((item, index) => ( - (itemRefs.current[index] = el)} - className={`item ${ - index === selectedIndex ? "is-selected" : "" - }`} - key={index} - onClick={() => selectItem(index)} - onMouseEnter={() => setSelectedIndex(index)} - data-testid="context-provider-dropdown-item" - > - -
- {showFileIconForItem(item) && ( - - )} - {!showFileIconForItem(item) && ( - <> - - - )} - {item.title} - {" "} -
- - {item.description} - {item.type === "contextProvider" && - item.contextProvider?.type === "submenu" && ( - - )} - {item.subActions?.map((subAction) => { - const Icon = getIconFromDropdownItem( - subAction.icon, - "action", - ); - return ( - { - subAction.action(item); - e.stopPropagation(); - e.preventDefault(); - props.onClose(); - }} - text={undefined} - > - - - ); - })} - + {loadingSubmenuItem && ( + + +
+ + {loadingSubmenuItem.title} + {" "} +
+ + {loadingSubmenuItem.description} -
- )) +
+
+ )} + {allItems.length ? ( + allItems.map((item, index) => { + const isSelected = index === selectedIndex; + return ( + (itemRefs.current[index] = el)} + className={`item cursor-pointer ${isSelected ? "is-selected" : ""}`} + key={index} + onClick={() => selectItem(index)} + onMouseEnter={() => setSelectedIndex(index)} + data-testid="context-provider-dropdown-item" + > + +
+ {showFileIconForItem(item) ? ( + + ) : ( + + )} + {item.title} + {" "} +
+ + {item.description} + {item.type === "contextProvider" && + item.contextProvider?.type === "submenu" && ( + + )} + {item.subActions?.map((subAction) => { + const Icon = getIconFromDropdownItem( + subAction.icon, + "action", + ); + return ( + { + subAction.action(item); + e.stopPropagation(); + e.preventDefault(); + props.onClose(); + }} + text={undefined} + > + + + ); + })} + +
+
+ ); + }) ) : ( No results )}