fix(plan): narrow mode in EditForm IIFE and style plan-banner
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user