fix: add checkmark icon to indicate selected model in dropdown

This commit is contained in:
Sahil 2025-03-21 15:52:18 +05:30
parent 5833d36fac
commit 98a321939e

View file

@ -5,6 +5,7 @@ import {
CubeIcon,
PlusIcon,
TrashIcon,
CheckIcon,
} from "@heroicons/react/24/outline";
import { useContext, useEffect, useRef, useState } from "react";
import { useDispatch } from "react-redux";
@ -29,6 +30,7 @@ interface ModelOptionProps {
idx: number;
showMissingApiKeyMsg: boolean;
showDelete?: boolean;
isSelected?: boolean;
}
interface Option {
@ -132,6 +134,7 @@ function ModelOption({
idx,
showDelete,
showMissingApiKeyMsg,
isSelected,
}: ModelOptionProps) {
const ideMessenger = useContext(IdeMessengerContext);
@ -199,6 +202,9 @@ function ModelOption({
{showDelete && (
<StyledTrashIcon $hovered={hovered} onClick={onClickDelete} />
)}
{isSelected && (
<CheckIcon className="ml-1 h-4 w-4" />
)}
</div>
</div>
</div>
@ -338,6 +344,7 @@ function ModelSelect() {
key={idx}
showDelete={options.length > 1}
showMissingApiKeyMsg={option.apiKey === ""}
isSelected={option.value === defaultModel?.title}
/>
))}
</div>