diff --git a/src/admin/components/PlanCellModal.tsx b/src/admin/components/PlanCellModal.tsx index e910f59..bad9f29 100644 --- a/src/admin/components/PlanCellModal.tsx +++ b/src/admin/components/PlanCellModal.tsx @@ -122,7 +122,11 @@ function EditForm(props: Props) { date_to: mode.date, is_range: false, project_id: null as number | null, - category: "work", + // Default to "work" when it's active, otherwise the first active + // category, so a new entry never starts on a retired key. + category: activeCategories.some((c) => c.key === "work") + ? "work" + : (activeCategories[0]?.key ?? "work"), note: "", }; } @@ -294,6 +298,19 @@ function EditForm(props: Props) { value={category} onChange={(e) => setCategory(e.target.value)} > + {/* If the row's current category was retired/hidden, still show it + (marked) so the select reflects reality instead of silently + snapping to the first active option. The server only re-checks + the category if it changes, so keeping it saves fine. */} + {category && !activeCategories.some((c) => c.key === category) && ( + + )} {activeCategories.map((c) => (