From 9c110abf464e1121946d27aa90649ff1776f0c08 Mon Sep 17 00:00:00 2001 From: BOHA Date: Fri, 5 Jun 2026 13:21:06 +0200 Subject: [PATCH] fix(plan): narrow mode in EditForm IIFE and style plan-banner --- src/admin/components/PlanCellModal.tsx | 12 ++++++++++++ src/admin/plan.css | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/admin/components/PlanCellModal.tsx b/src/admin/components/PlanCellModal.tsx index 618b96d..aeca740 100644 --- a/src/admin/components/PlanCellModal.tsx +++ b/src/admin/components/PlanCellModal.tsx @@ -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, diff --git a/src/admin/plan.css b/src/admin/plan.css index a62eace..d6dfd80 100644 --- a/src/admin/plan.css +++ b/src/admin/plan.css @@ -123,3 +123,22 @@ margin-bottom: 12px; flex-wrap: wrap; } + +.plan-banner { + padding: 10px 14px; + margin-bottom: 16px; + background: var(--info-soft, #eff6ff); + border: 1px solid var(--info-light, #bfdbfe); + border-left: 4px solid var(--info, #3b82f6); + border-radius: var(--border-radius-sm, 6px); + color: var(--info, #1e40af); + font-size: 14px; + display: flex; + align-items: center; + gap: 8px; +} + +.plan-banner code { + background: transparent; + padding: 0; +}