|
|
|
@ -7,6 +7,22 @@ const AnalysisSimulatorSlider = ({
|
|
|
|
|
playCount, |
|
|
|
|
setSliderCount |
|
|
|
|
}) => { |
|
|
|
|
// hh:mm 형식으로 바꿔주는 코드
|
|
|
|
|
function convertToTimeFormat(number) { |
|
|
|
|
// 시간과 분 계산
|
|
|
|
|
const hours = Math.floor(number / 60); |
|
|
|
|
const minutes = Math.floor(number % 60); |
|
|
|
|
|
|
|
|
|
// 2자리 숫자로 포맷팅
|
|
|
|
|
const formattedHours = String(hours).padStart(2, '0'); |
|
|
|
|
const formattedMinutes = String(minutes).padStart(2, '0'); |
|
|
|
|
|
|
|
|
|
// 시간 문자열 생성
|
|
|
|
|
const timeString = `${formattedHours}:${formattedMinutes}`; |
|
|
|
|
|
|
|
|
|
return timeString; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const colorOptions = { |
|
|
|
|
start: [playCount ? playCount : 0], |
|
|
|
|
// connect: true,
|
|
|
|
@ -20,9 +36,10 @@ const AnalysisSimulatorSlider = ({
|
|
|
|
|
format: { |
|
|
|
|
// 'to' the formatted value. Receives a number.
|
|
|
|
|
to: function (value) { |
|
|
|
|
return Math.round(value); |
|
|
|
|
return convertToTimeFormat(value); |
|
|
|
|
}, |
|
|
|
|
// 'from' the formatted value.
|
|
|
|
|
|
|
|
|
|
// // 'from' the formatted value.
|
|
|
|
|
// Receives a string, should return a number.
|
|
|
|
|
from: function (value) { |
|
|
|
|
return Math.round(value); |
|
|
|
@ -34,7 +51,13 @@ const AnalysisSimulatorSlider = ({
|
|
|
|
|
density: 3 |
|
|
|
|
}, |
|
|
|
|
onChange: e => { |
|
|
|
|
setSliderCount(e); |
|
|
|
|
function timeStringToMinutes(timeString) { |
|
|
|
|
const [hours, minutes] = timeString.split(':').map(Number); |
|
|
|
|
const totalMinutes = hours * 60 + minutes; |
|
|
|
|
return totalMinutes.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setSliderCount(e.map(timeStringToMinutes)); |
|
|
|
|
}, |
|
|
|
|
direction |
|
|
|
|
}; |
|
|
|
|