|
|
|
@ -86,7 +86,10 @@ export function QuestionSlider({ |
|
|
|
? Number(question.extras.placeHolder) |
|
|
|
: Math.round((min + max) / 2); |
|
|
|
|
|
|
|
const isDesiredAgeRange = false; |
|
|
|
const isDesiredAgeRange = |
|
|
|
question.type === "range" || |
|
|
|
(question.id || "").toLowerCase().includes("desired_age") || |
|
|
|
(question.id || "").toLowerCase().includes("age_range"); |
|
|
|
|
|
|
|
const thumbWidth = 18; |
|
|
|
|
|
|
|
@ -124,7 +127,7 @@ export function QuestionSlider({ |
|
|
|
})(); |
|
|
|
|
|
|
|
// Multi-state logic for Age Range Slider
|
|
|
|
let fromVal = 25; |
|
|
|
let fromVal = 20; |
|
|
|
let toVal = 30; |
|
|
|
if (isDesiredAgeRange) { |
|
|
|
if (typeof storedValue === "string" && storedValue.includes("-")) { |
|
|
|
@ -140,6 +143,12 @@ export function QuestionSlider({ |
|
|
|
} else if (typeof storedValue === "number") { |
|
|
|
fromVal = storedValue; |
|
|
|
toVal = Math.max(storedValue, max); |
|
|
|
} else if (typeof question.extras?.placeHolder === "string") { |
|
|
|
const match = question.extras.placeHolder.match(/(\d+)[^\d]+(\d+)/); |
|
|
|
if (match) { |
|
|
|
fromVal = Number(match[1]); |
|
|
|
toVal = Number(match[2]); |
|
|
|
} |
|
|
|
} |
|
|
|
fromVal = Math.max(min, Math.min(max, fromVal)); |
|
|
|
toVal = Math.max(min, Math.min(max, toVal)); |
|
|
|
|