Update combined static Vd and weight-based settings

This commit is contained in:
2026-02-07 10:12:06 +00:00
parent b7a585a223
commit 199872d742
7 changed files with 73 additions and 77 deletions

View File

@@ -44,7 +44,7 @@ const getDefaultsForTranslation = (pkParams: any, therapeuticRange: any, uiSetti
// Advanced Settings
standardVdValue: defaults.pkParams.advanced.standardVd?.preset === 'adult' ? '377' : defaults.pkParams.advanced.standardVd?.preset === 'child' ? '175' : defaults.pkParams.advanced.standardVd?.customValue || '377',
standardVdPreset: defaults.pkParams.advanced.standardVd?.preset || 'adult',
bodyWeight: defaults.pkParams.advanced.weightBasedVd.bodyWeight,
bodyWeight: defaults.pkParams.advanced.standardVd.bodyWeight,
tmaxDelay: defaults.pkParams.advanced.foodEffect.tmaxDelay,
fOral: defaults.pkParams.advanced.fOral,
fOralPercent: String((parseFloat(defaults.pkParams.advanced.fOral) * 100).toFixed(1)),
@@ -374,7 +374,7 @@ const Settings = ({
</Tooltip>
</div>
{showTherapeuticRange && (
<div className="ml-8 space-y-2">
<div className="space-y-2">
<div className="flex items-center gap-2">
<Label className="font-medium">
{t('therapeuticRange')}
@@ -645,7 +645,7 @@ const Settings = ({
</Tooltip>
</div>
{steadyStateDaysEnabled && (
<div className="ml-8 space-y-2">
<div className="space-y-2">
<FormNumericInput
value={pkParams.advanced.steadyStateDays}
onChange={val => updateAdvancedDirect('steadyStateDays', val)}
@@ -827,7 +827,7 @@ const Settings = ({
</div>
<Select
value={pkParams.advanced.standardVd?.preset || 'adult'}
onValueChange={(value: 'adult' | 'child' | 'custom') => updateAdvanced('standardVd', 'preset', value)}
onValueChange={(value: 'adult' | 'child' | 'custom' | 'weight-based') => updateAdvanced('standardVd', 'preset', value)}
>
<SelectTrigger className="w-[360px]">
<SelectValue />
@@ -836,15 +836,16 @@ const Settings = ({
<SelectItem value="adult">{t('standardVdPresetAdult')}</SelectItem>
<SelectItem value="child">{t('standardVdPresetChild')}</SelectItem>
<SelectItem value="custom">{t('standardVdPresetCustom')}</SelectItem>
<SelectItem value="weight-based">{t('standardVdPresetWeightBased')}</SelectItem>
</SelectContent>
</Select>
{pkParams.advanced.weightBasedVd.enabled && (
{pkParams.advanced.standardVd?.preset === 'weight-based' && (
<div className="ml-0 mt-2 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded text-xs text-blue-800 dark:text-blue-200">
Weight-based Vd is enabled below. This setting is currently overridden.
{t('weightBasedVdInfo')}
</div>
)}
{pkParams.advanced.standardVd?.preset === 'custom' && (
<div className="ml-8 mt-2">
<div className="mt-2">
<Label className="text-sm font-medium">{t('customVdValue')}</Label>
<FormNumericInput
value={pkParams.advanced.standardVd?.customValue || '377'}
@@ -857,67 +858,30 @@ const Settings = ({
/>
</div>
)}
</div>
<Separator className="my-4" />
{/* Weight-Based Vd */}
<div className="space-y-3">
{pkParams.advanced.weightBasedVd.enabled && (
<div className="p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded text-xs text-blue-800 dark:text-blue-200 mb-3">
When enabled, this overrides the Standard Vd setting above. Disable to use Standard Vd presets (Adult/Child/Custom).
</div>
)}
<div className="flex items-center gap-3">
<Switch
id="weightBasedVdEnabled"
checked={pkParams.advanced.weightBasedVd.enabled}
onCheckedChange={checked => updateAdvanced('weightBasedVd', 'enabled', checked)}
/>
<Label htmlFor="weightBasedVdEnabled" className="font-medium">
{t('weightBasedVdScaling')}
</Label>
<Tooltip open={openTooltipId === 'weightBasedVd'} onOpenChange={(open) => setOpenTooltipId(open ? 'weightBasedVd' : null)}>
<TooltipTrigger asChild>
<button
type="button"
onClick={handleTooltipToggle('weightBasedVd')}
onTouchStart={handleTooltipToggle('weightBasedVd')}
className="inline-flex items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
aria-label={t('weightBasedVdTooltip')}
>
<Info className="h-4 w-4" />
</button>
</TooltipTrigger>
<TooltipContent side={tooltipSide}>
<p className="text-xs max-w-xs">{tWithDefaults(t, 'weightBasedVdTooltip', defaultsForT)}</p>
</TooltipContent>
</Tooltip>
</div>
{pkParams.advanced.weightBasedVd.enabled && (
<div className="ml-8 space-y-2">
{pkParams.advanced.standardVd?.preset === 'weight-based' && (
<div className="mt-2">
<div className="flex items-center gap-2">
<Label className="text-sm font-medium">{t('bodyWeight')}</Label>
<Tooltip open={openTooltipId === 'bodyWeight'} onOpenChange={(open) => setOpenTooltipId(open ? 'bodyWeight' : null)}>
<TooltipTrigger asChild>
<button
type="button"
onClick={handleTooltipToggle('bodyWeight')}
onTouchStart={handleTooltipToggle('bodyWeight')}
className="inline-flex items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
aria-label={t('bodyWeightTooltip')}
>
<Info className="h-4 w-4" />
</button>
</TooltipTrigger>
<TooltipContent side={tooltipSide}>
<p className="text-xs max-w-xs">{renderTooltipWithLinks(tWithDefaults(t, 'bodyWeightTooltip', defaultsForT))}</p>
</TooltipContent>
</Tooltip>
<Tooltip open={openTooltipId === 'bodyWeight'} onOpenChange={(open) => setOpenTooltipId(open ? 'bodyWeight' : null)}>
<TooltipTrigger asChild>
<button
type="button"
onClick={handleTooltipToggle('bodyWeight')}
onTouchStart={handleTooltipToggle('bodyWeight')}
className="inline-flex items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
aria-label={t('bodyWeightTooltip')}
>
<Info className="h-4 w-4" />
</button>
</TooltipTrigger>
<TooltipContent side={tooltipSide}>
<p className="text-xs max-w-xs">{renderTooltipWithLinks(tWithDefaults(t, 'bodyWeightTooltip', defaultsForT))}</p>
</TooltipContent>
</Tooltip>
</div>
<FormNumericInput
value={pkParams.advanced.weightBasedVd.bodyWeight}
onChange={val => updateAdvanced('weightBasedVd', 'bodyWeight', val)}
value={pkParams.advanced.standardVd?.bodyWeight || '70'}
onChange={val => updateAdvanced('standardVd', 'bodyWeight', val)}
increment={1}
min={20}
max={300}
@@ -930,8 +894,6 @@ const Settings = ({
<Separator className="my-4" />
<Separator className="my-4" />
{/* Food Effect Absorption Delay */}
<div className="space-y-3">
<div className="flex items-center gap-2">
@@ -1084,7 +1046,7 @@ const Settings = ({
</Tooltip>
</div>
{(pkParams.advanced.renalFunction?.enabled) && (
<div className="ml-8 space-y-2">
<div className="space-y-2">
<div className="flex items-center gap-2">
<Label className="text-sm font-medium">{t('renalFunctionSeverity')}</Label>
</div>