diff --git a/src/components/settings.tsx b/src/components/settings.tsx index 6fb7383..d885626 100644 --- a/src/components/settings.tsx +++ b/src/components/settings.tsx @@ -18,6 +18,7 @@ import { Button } from './ui/button'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './ui/select'; import { FormNumericInput } from './ui/form-numeric-input'; +import { FormSelect } from './ui/form-select'; import CollapsibleCardHeader from './ui/collapsible-card-header'; import { Info } from 'lucide-react'; import { getDefaultState } from '../constants/defaults'; @@ -37,6 +38,7 @@ const getDefaultsForTranslation = (pkParams: any, therapeuticRange: any, uiSetti yAxisMax: defaults.uiSettings.yAxisMax, therapeuticRangeMin: defaults.therapeuticRange.min, therapeuticRangeMax: defaults.therapeuticRange.max, + showDayTimeOnXAxis: defaults.uiSettings.showDayTimeOnXAxis, // PK Parameters damphHalfLife: defaults.pkParams.damph.halfLife, @@ -52,6 +54,9 @@ const getDefaultsForTranslation = (pkParams: any, therapeuticRange: any, uiSetti fOral: defaults.pkParams.advanced.fOral, fOralPercent: String((parseFloat(defaults.pkParams.advanced.fOral) * 100).toFixed(1)), steadyStateDays: defaults.pkParams.advanced.steadyStateDays, + urinePh: defaults.pkParams.advanced.urinePh.mode, + ageGroup: defaults.pkParams.advanced.ageGroup?.preset || 'adult', + renalFunctionSeverity: defaults.pkParams.advanced.renalFunction?.severity || 'normal', }; }; @@ -525,13 +530,13 @@ const Settings = ({
- +
)} @@ -834,20 +839,20 @@ const Settings = ({ - + {pkParams.advanced.standardVd?.preset === 'weight-based' && (
ⓘ {t('weightBasedVdInfo')} @@ -967,21 +972,21 @@ const Settings = ({
- +
@@ -1008,21 +1013,21 @@ const Settings = ({ - + @@ -1065,24 +1070,24 @@ const Settings = ({
- + )} diff --git a/src/components/ui/form-select.tsx b/src/components/ui/form-select.tsx new file mode 100644 index 0000000..25a6ac8 --- /dev/null +++ b/src/components/ui/form-select.tsx @@ -0,0 +1,64 @@ +/** + * Custom Form Component: Select with Reset Button + * + * A select/combobox field with an optional reset to default button. + * Built on top of shadcn/ui Select component. + * + * @author Andreas Weyer + * @license MIT + */ + +import * as React from "react" +import { RotateCcw } from "lucide-react" +import { IconButtonWithTooltip } from "./icon-button-with-tooltip" +import { Select, SelectTrigger, SelectValue, SelectContent } from "./select" +import { cn } from "../../lib/utils" +import { useTranslation } from "react-i18next" + +interface FormSelectProps { + value: string + onValueChange: (value: string) => void + showResetButton?: boolean + defaultValue?: string + children: React.ReactNode + triggerClassName?: string + placeholder?: string +} + +export const FormSelect: React.FC = ({ + value, + onValueChange, + showResetButton = false, + defaultValue, + children, + triggerClassName, + placeholder, +}) => { + const { t } = useTranslation() + + return ( +
+ + {showResetButton && ( + } + tooltip={t('buttonResetToDefault')} + variant="outline" + size="icon" + className="h-9 w-9 rounded-l-none border-l-0" + onClick={() => onValueChange(defaultValue || '')} + tabIndex={-1} + /> + )} +
+ ) +}