// frontend/src/modals/bellcloud/devices/EditClockSettingsModal.jsx
// Edits: master switch, ODD/EVEN outputs, pulse and pause durations (sliders), and the
// face sync policy (firmware 3.2.0+: force = run a full lap when the face is ahead,
// smart = wait if it is at most N minutes ahead).
import { useState } from 'react'
import Modal from '@/components/ui/Modal'
import Button from '@/components/ui/Button'
import FormField from '@/components/ui/FormField'
import SegmentedControl from '@/components/ui/SegmentedControl'
import api from '@/lib/api'
// Pulse options in milliseconds — shown as sliders with labelled steps
const PULSE_STEPS = [200, 300, 400, 500, 600, 800, 1000, 1200, 1500, 2000]
const PAUSE_STEPS = [500, 1000, 1500, 2000, 3000, 4000, 5000]
function msLabel(ms) {
if (!ms) return '—'
return ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${ms}ms`
}
// Slider that snaps to a fixed array of allowed values
function StepSlider({ steps, value, onChange, label }) {
const idx = steps.indexOf(value)
const currentIdx = idx >= 0 ? idx : 0
return (
The hands only move forward. When they are ahead (e.g. after DST ends), Force runs a full
lap to catch up; Smart stops them until real time catches up.
{faceSync === 'smart' && (
setMaxWait(e.target.value)}
inputProps={{ min: 1, max: 359, step: 1 }}
hint="Default 61 covers the DST change. Further ahead than this, the face runs the lap."
/>
)}