fix: update click handler logic in OptionCard

This commit is contained in:
twwu 2025-05-16 17:54:41 +08:00
parent f481075f8f
commit 8d4ced227e
3 changed files with 11 additions and 11 deletions

View File

@ -24,8 +24,8 @@ type Props = {
const ParamItem: FC<Props> = ({ className, id, name, noTooltip, tip, step = 0.1, min = 0, max, value, enable, onChange, hasSwitch, onSwitchChange }) => { const ParamItem: FC<Props> = ({ className, id, name, noTooltip, tip, step = 0.1, min = 0, max, value, enable, onChange, hasSwitch, onSwitchChange }) => {
return ( return (
<div className={className}> <div className={className}>
<div className="flex items-center justify-between"> <div className='flex items-center justify-between'>
<div className="flex h-6 items-center"> <div className='flex h-6 items-center'>
{hasSwitch && ( {hasSwitch && (
<Switch <Switch
size='md' size='md'
@ -36,20 +36,20 @@ const ParamItem: FC<Props> = ({ className, id, name, noTooltip, tip, step = 0.1,
}} }}
/> />
)} )}
<span className="system-sm-semibold mr-1 text-text-secondary">{name}</span> <span className='system-sm-semibold mr-1 text-text-secondary'>{name}</span>
{!noTooltip && ( {!noTooltip && (
<Tooltip <Tooltip
triggerClassName='w-4 h-4 shrink-0' triggerClassName='w-4 h-4 shrink-0'
popupContent={<div className="w-[200px]">{tip}</div>} popupContent={<div className='w-[200px]'>{tip}</div>}
/> />
)} )}
</div> </div>
</div> </div>
<div className="mt-1 flex items-center"> <div className='mt-1 flex items-center'>
<div className="mr-3 flex shrink-0 items-center"> <div className='mr-3 flex shrink-0 items-center'>
<InputNumber <InputNumber
disabled={!enable} disabled={!enable}
type="number" type='number'
min={min} min={min}
max={max} max={max}
step={step} step={step}
@ -62,7 +62,7 @@ const ParamItem: FC<Props> = ({ className, id, name, noTooltip, tip, step = 0.1,
className='w-[72px]' className='w-[72px]'
/> />
</div> </div>
<div className="flex grow items-center"> <div className='flex grow items-center'>
<Slider <Slider
className='w-full' className='w-full'
disabled={!enable} disabled={!enable}

View File

@ -202,7 +202,7 @@ const RetrievalParamConfig: FC<Props> = ({
option.value === RerankingModeEnum.WeightedScore option.value === RerankingModeEnum.WeightedScore
? ProgressIndicator ? ProgressIndicator
: Reranking : Reranking
} alt=''/>} } alt='' />}
title={option.label} title={option.label}
description={option.tips} description={option.tips}
className='flex-1' className='flex-1'

View File

@ -57,7 +57,7 @@ const OptionCard = <T,>({
disabled && 'cursor-not-allowed opacity-50', disabled && 'cursor-not-allowed opacity-50',
)} )}
onClick={() => { onClick={() => {
if (disabled) return if (isActive || disabled) return
onClick?.(id) onClick?.(id)
}} }}
> >
@ -70,7 +70,7 @@ const OptionCard = <T,>({
<div className={cn( <div className={cn(
'absolute left-[-2px] top-[-2px] h-14 w-14 rounded-full blur-[80px]', 'absolute left-[-2px] top-[-2px] h-14 w-14 rounded-full blur-[80px]',
`${HEADER_EFFECT_MAP[effectColor]}`, `${HEADER_EFFECT_MAP[effectColor]}`,
)}/> )} />
) )
} }
{ {