From a6b678c6ae9cdf079919cdd4bb9730b8710fd932 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 20:23:35 +0100 Subject: [PATCH] Fix build issue with types returned by the Slider component --- app/ui/components/form/affinitySlider.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/ui/components/form/affinitySlider.tsx b/app/ui/components/form/affinitySlider.tsx index f541e4d..56ef3e7 100644 --- a/app/ui/components/form/affinitySlider.tsx +++ b/app/ui/components/form/affinitySlider.tsx @@ -4,6 +4,13 @@ import { Slider } from 'primereact/slider'; export default function AffinitySlider({ value, onChange }: { value: number, onChange: (value: number) => void }) { + const toNumber = (value : number | [number, number]) => { + if(value instanceof Array) { + return value[0]; + } + return value; + } + const label = (value: number) => { if (value < 0.2) { return 'Nemesis'; @@ -24,7 +31,7 @@ export default function AffinitySlider({ value, onChange }: { value: number, onC return ( <> - onChange(e.value)} className='w-80 bg-gray-400' /> + onChange(toNumber(e.value))} className='w-80 bg-gray-400' /> {label(value)} -- 2.47.1