Skip to content

Commit

Permalink
additional minor nits
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Nov 2, 2024
1 parent 27bcfe7 commit fa51494
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function LLMProviderDisplay({

<div className="ml-auto">
<Button
variant={existingLlmProvider ? "outline" : "next"}
variant={existingLlmProvider ? "success-reverse" : "navigate"}
onClick={() => setFormIsVisible(true)}
>
{existingLlmProvider ? "Edit" : "Set up"}
Expand Down
21 changes: 14 additions & 7 deletions web/src/components/admin/connectors/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ export function SelectorFormField({
label,
options,
subtext,
includeDefault = false,
side = "bottom",
maxHeight,
onSelect,
Expand All @@ -615,26 +614,34 @@ export function SelectorFormField({
{subtext && <SubLabel>{subtext}</SubLabel>}
<div className="mt-2">
<Select
value={field.value}
value={field.value || defaultValue}
onValueChange={
onSelect || ((selected) => setFieldValue(name, selected))
}
defaultValue={defaultValue}
>
<SelectTrigger>
<SelectValue
placeholder={includeDefault ? "Select..." : undefined}
/>
<SelectValue placeholder="Select...">
{field.value || defaultValue || ""}
</SelectValue>
</SelectTrigger>
<SelectContent
side={side}
className={maxHeight ? `max-h-[${maxHeight}]` : undefined}
>
{includeDefault && (
{options.length == 0 && (
<SelectItem value="default">Select...</SelectItem>
)}
{defaultValue && (
<SelectItem value={defaultValue}>{defaultValue}</SelectItem>
)}
{options.map((option) => (
<SelectItem key={option.value} value={String(option.value)}>
<SelectItem
icon={option.icon}
key={option.value}
value={String(option.value)}
selected={field.value === option.value}
>
{option.name}
</SelectItem>
))}
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const buttonVariants = cva(
success:
"bg-green-100 text-green-600 hover:bg-green-500/90 dark:bg-blue-500 dark:text-neutral-50 dark:hover:bg-green-900/90",
"success-reverse":
"bg-green-500 text-green-100 hover:bg-green-600/90 dark:bg-neutral-50 dark:text-blue-500 dark:hover:bg-green-100/90",
"bg-green-500 text-white hover:bg-green-600/90 dark:bg-neutral-50 dark:text-blue-500 dark:hover:bg-green-100/90",

default:
"bg-neutral-900 border-border text-neutral-50 hover:bg-neutral-900/90 dark:bg-neutral-50 dark:text-neutral-900 dark:hover:bg-neutral-50/90",
Expand Down
10 changes: 8 additions & 2 deletions web/src/components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ const SelectItem = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {
icon?: React.ElementType;
selected?: boolean;
}
>(({ className, children, icon: Icon, ...props }, ref) => (
>(({ className, children, icon: Icon, selected, ...props }, ref) => (
<SelectPrimitive.Item
ref={ref}
className={cn(
Expand All @@ -127,9 +128,14 @@ const SelectItem = React.forwardRef<
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
{Icon ? <Icon className="h-4 w-4" /> : <Check className="h-4 w-4" />}
<Check className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
{!selected && Icon && (
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<Icon className="h-4 w-4" />
</span>
)}

<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
Expand Down

0 comments on commit fa51494

Please sign in to comment.