Merge pull request #4749 from 0x23d11/fix-4084

fix: add checkmark icon to indicate selected model in dropdown
This commit is contained in:
Patrick Erichsen 2025-03-21 09:36:04 -07:00 • committed by GitHub
commit b533742bb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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>