diff --git a/frontend/src/components/kanban/TaskEditForm.tsx b/frontend/src/components/kanban/TaskEditForm.tsx index 91226ada..595b5237 100644 --- a/frontend/src/components/kanban/TaskEditForm.tsx +++ b/frontend/src/components/kanban/TaskEditForm.tsx @@ -71,13 +71,30 @@ export function TaskEditForm({ const { t } = useTranslation("kanban"); const { t: tc } = useTranslation("common"); + // Cross-field check: a snooze date past the deadline + // is incoherent (the deadline badge would fire before + // the snooze even surfaces). Lex compare agrees with + // chronological order on ``YYYY-MM-DD``. The API + // mirrors this rule and returns 400 if it slips + // through, so this is purely instant-feedback UX. + const datesOutOfOrder = !!( + editScheduled + && editDeadline + && editDeadline < editScheduled + ); + + function handleSave() { + if (datesOutOfOrder) return; + onSave(); + } + function handleKeyDown(e: React.KeyboardEvent) { if ( (e.metaKey || e.ctrlKey) && e.key === "Enter" ) { e.preventDefault(); - onSave(); + handleSave(); } if (e.key === "Escape") { onCancel(); @@ -155,6 +172,11 @@ export function TaskEditForm({ /> + {datesOutOfOrder && ( +

+ {t("datesOutOfOrder")} +

+ )}
e.stopPropagation()} > @@ -177,8 +199,8 @@ export function TaskEditForm({