Files
bot-pontos/web/components/WindowFields.tsx
2026-10-23 22:31:02 -03:00

41 lines
1.2 KiB
TypeScript

"use client";
import type { QueryWindow } from "@/lib/types";
const FIELDS: { key: keyof QueryWindow; label: string; hint: string }[] = [
{ key: "query_window_start", label: "Início da janela", hint: "Primeira consulta do dia" },
{ key: "day_check_deadline", label: "Confirmação sem pontos", hint: "2ª verificação sem pontos" },
{ key: "no_points_recheck_until", label: "Fim das reverificações", hint: "Depois disso, dia sem pontos é encerrado" },
{ key: "query_window_end", label: "Fim da janela", hint: "Última consulta do dia" },
];
/** Os quatro horários da janela de consulta (ARQUITETURA.md 9.12). */
export function WindowFields({
value,
onChange,
disabled,
}: {
value: QueryWindow;
onChange: (w: QueryWindow) => void;
disabled?: boolean;
}) {
return (
<div className="grid-4">
{FIELDS.map((f) => (
<label key={f.key} className="field">
<span>{f.label}</span>
<input
type="time"
step={900}
value={value[f.key]}
disabled={disabled}
onChange={(e) => onChange({ ...value, [f.key]: e.target.value })}
required
/>
<small className="muted">{f.hint}</small>
</label>
))}
</div>
);
}