feat: schedule modal validation + time range guard

- Validate trainer, type, and time before saving
- Show overlap warnings for conflicting classes
- Reset end time when start time exceeds it
- Block setting end time earlier than start
- Remove day change hints from modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 14:14:33 +03:00
parent 9d0b4b0fba
commit 21f3887bc9
2 changed files with 95 additions and 21 deletions

View File

@@ -140,6 +140,21 @@ export function TimeRangeField({ label, value, onChange, onBlur }: TimeRangeFiel
}
}
function handleStartChange(newStart: string) {
// Reset end if start >= end
if (newStart && end && newStart >= end) {
update(newStart, "");
} else {
update(newStart, end);
}
}
function handleEndChange(newEnd: string) {
// Ignore if end <= start
if (start && newEnd && newEnd <= start) return;
update(start, newEnd);
}
return (
<div>
<label className="block text-sm text-neutral-400 mb-1.5">{label}</label>
@@ -147,7 +162,7 @@ export function TimeRangeField({ label, value, onChange, onBlur }: TimeRangeFiel
<input
type="time"
value={start}
onChange={(e) => update(e.target.value, end)}
onChange={(e) => handleStartChange(e.target.value)}
onBlur={onBlur}
className="flex-1 rounded-lg border border-white/10 bg-neutral-800 px-3 py-2.5 text-white outline-none focus:border-gold transition-colors"
/>
@@ -155,7 +170,7 @@ export function TimeRangeField({ label, value, onChange, onBlur }: TimeRangeFiel
<input
type="time"
value={end}
onChange={(e) => update(start, e.target.value)}
onChange={(e) => handleEndChange(e.target.value)}
onBlur={onBlur}
className="flex-1 rounded-lg border border-white/10 bg-neutral-800 px-3 py-2.5 text-white outline-none focus:border-gold transition-colors"
/>