fix(plan): narrow mode in EditForm IIFE and style plan-banner

This commit is contained in:
BOHA
2026-06-05 13:21:06 +02:00
parent a0f351b0aa
commit 9c110abf46
2 changed files with 31 additions and 0 deletions

View File

@@ -100,6 +100,17 @@ function EditForm(props: Props) {
const [submitting, setSubmitting] = useState(false);
const [confirmDelete, setConfirmDelete] = useState(false);
// Narrow mode to the kinds EditForm actually handles. The call site in
// PlanCellModal only passes "create" | "edit-range" | "edit-override" but
// the parameter type is the full union, so we narrow explicitly here.
if (
mode.kind !== "create" &&
mode.kind !== "edit-range" &&
mode.kind !== "edit-override"
) {
return null;
}
const isOverride = mode.kind === "edit-override";
const initial = (() => {
@@ -123,6 +134,7 @@ function EditForm(props: Props) {
note: mode.range.note,
};
}
// mode.kind === "edit-override" (narrowed above)
return {
date_from: mode.date,
date_to: mode.date,