"use client"; import { Label } from "@/components/ui/label"; import { Switch } from "@/components/ui/switch"; import { Input } from "@/components/ui/input"; import type { PopWorkDetailConfig } from "../types"; interface PopWorkDetailConfigPanelProps { config?: PopWorkDetailConfig; onChange?: (config: PopWorkDetailConfig) => void; } const DEFAULT_PHASE_LABELS: Record = { PRE: "작업 전", IN: "작업 중", POST: "작업 후", }; export function PopWorkDetailConfigPanel({ config, onChange, }: PopWorkDetailConfigPanelProps) { const cfg: PopWorkDetailConfig = { showTimer: config?.showTimer ?? true, showQuantityInput: config?.showQuantityInput ?? true, phaseLabels: config?.phaseLabels ?? { ...DEFAULT_PHASE_LABELS }, }; const update = (partial: Partial) => { onChange?.({ ...cfg, ...partial }); }; return (
update({ showTimer: v })} />
update({ showQuantityInput: v })} />
{(["PRE", "IN", "POST"] as const).map((phase) => (
{phase} update({ phaseLabels: { ...cfg.phaseLabels, [phase]: e.target.value }, }) } />
))}
); }