diff --git a/frontend/src/components/Dropdown.tsx b/frontend/src/components/Dropdown.tsx index d21f3a7b..a6776f58 100644 --- a/frontend/src/components/Dropdown.tsx +++ b/frontend/src/components/Dropdown.tsx @@ -1,7 +1,6 @@ +import { Check, ChevronDown, Pencil, Search, Trash2 } from 'lucide-react'; import React, { useEffect, useMemo, useRef, useState } from 'react'; -import { ChevronDown, Pencil, Search, Trash2 } from 'lucide-react'; - type OptionBase = { id?: string; type?: string }; type NameIdOption = { name: string; id: string } & OptionBase; type LabelValueOption = { label: string; value: string } & OptionBase; @@ -34,8 +33,10 @@ function optionMatches( selected: DropdownOption | null, ): boolean { if (!selected) return false; - if (typeof selected === 'string') return selected === option; - if (typeof option === 'string') return false; + if (typeof selected === 'string' && typeof option === 'string') + return selected === option; + if (typeof selected === 'string') return getOptionText(option) === selected; + if (typeof option === 'string') return getOptionText(selected) === option; const a = option as Record; const b = selected as Record; if ('name' in a && 'name' in b) return a.name === b.name; @@ -127,7 +128,7 @@ function Dropdown({ className={`border-border bg-card absolute inset-x-0 z-20 -mt-px overflow-hidden border border-t-0 shadow-lg ${radiusBottom}`} > {searchable && ( -
+
({
)} -
+
{filtered.length === 0 ? (
No results found @@ -157,7 +158,7 @@ function Dropdown({ return (
{ @@ -170,6 +171,10 @@ function Dropdown({ {getOptionText(option)} + {active && !showEdit && !showDelete && ( + + )} + {showEdit && onEdit && optObj &&