fix: update ux recemmend backend label into desc setting (#6088)

This commit is contained in:
Faisal Amir 2025-08-07 22:14:23 +07:00 committed by GitHub
parent 469d787888
commit 4d67418b0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 42 deletions

View File

@ -5,12 +5,6 @@ import {
DropdownMenuTrigger, DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu' } from '@/components/ui/dropdown-menu'
import {
Tooltip,
TooltipTrigger,
TooltipContent,
} from '@/components/ui/tooltip'
import { IconStarFilled } from '@tabler/icons-react'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
// Dropdown component // Dropdown component
@ -24,7 +18,6 @@ type DropdownControlProps = {
export function DropdownControl({ export function DropdownControl({
value, value,
options = [], options = [],
recommended,
onChange, onChange,
}: DropdownControlProps) { }: DropdownControlProps) {
const isSelected = const isSelected =
@ -48,18 +41,6 @@ export function DropdownControl({
)} )}
> >
<span>{option.name}</span> <span>{option.name}</span>
{recommended === option.value && (
<Tooltip>
<TooltipTrigger asChild>
<div className="cursor-pointer">
<IconStarFilled className="text-accent" />
</div>
</TooltipTrigger>
<TooltipContent side="top" sideOffset={8} className="z-50">
Recommended
</TooltipContent>
</Tooltip>
)}
</DropdownMenuItem> </DropdownMenuItem>
))} ))}
</DropdownMenuContent> </DropdownMenuContent>

View File

@ -384,6 +384,7 @@ function ProviderDetail() {
: false : false
} }
description={ description={
<>
<RenderMarkdown <RenderMarkdown
className="![>p]:text-main-view-fg/70 select-none" className="![>p]:text-main-view-fg/70 select-none"
content={setting.description} content={setting.description}
@ -407,6 +408,19 @@ function ProviderDetail() {
), ),
}} }}
/> />
{setting.key === 'version_backend' &&
setting.controller_props?.recommended && (
<div className="mt-1 text-sm text-main-view-fg/60">
<span className="font-medium">
{setting.controller_props.recommended
?.split('/')
.pop() ||
setting.controller_props.recommended}
</span>
<span> is the recommended backend.</span>
</div>
)}
</>
} }
actions={actionComponent} actions={actionComponent}
/> />

View File

@ -7,6 +7,7 @@ type ControllerProps = {
type?: string type?: string
options?: Array<{ value: number | string; name: string }> options?: Array<{ value: number | string; name: string }>
input_actions?: string[] input_actions?: string[]
recommended?: string
} }
/** /**