From 056680999c56b81e92168d047ca6c79c4ee8a961 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Sun, 26 Jul 2026 09:17:22 +0000 Subject: [PATCH] Collapse Departments and Assignees pickers in the event form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both lists grow with staff/department count and were always fully expanded — matches the History section's existing collapsible pattern, showing a summary of the current selection when closed. --- frontend/src/components/EventForm.tsx | 100 ++++++++++++++++---------- 1 file changed, 64 insertions(+), 36 deletions(-) diff --git a/frontend/src/components/EventForm.tsx b/frontend/src/components/EventForm.tsx index bf4fe1d..227c412 100644 --- a/frontend/src/components/EventForm.tsx +++ b/frontend/src/components/EventForm.tsx @@ -64,6 +64,8 @@ export default function EventForm({ eventId, initialDate, occurrenceStart, scope const [historyOpen, setHistoryOpen] = useState(false) const [history, setHistory] = useState(null) + const [deptsOpen, setDeptsOpen] = useState(false) + const [assigneesOpen, setAssigneesOpen] = useState(false) useEffect(() => { fetchCalendars().then(setCalendars).catch(() => {}) @@ -303,51 +305,77 @@ export default function EventForm({ eventId, initialDate, occurrenceStart, scope )}
- {editingOccurrence ? ( -
- {selectedDepts.length === 0 && None} - {selectedDepts.map(d => {d.name})} -
+ <> + +
+ {selectedDepts.length === 0 && None} + {selectedDepts.map(d => {d.name})} +
+ ) : ( -
- {departments.map(dept => ( - - ))} - {departments.length === 0 && No departments configured.} +
+
setDeptsOpen(v => !v)}> + Departments + + {selectedDepts.length === 0 ? 'None selected' : selectedDepts.map(d => d.name).join(', ')} + + +
+ {deptsOpen && ( +
+ {departments.map(dept => ( + + ))} + {departments.length === 0 && No departments configured.} +
+ )}
)}
- {editingOccurrence ? ( -
- {selectedAssignees.length === 0 && None} - {selectedAssignees.map(a => {a.name})} -
+ <> + +
+ {selectedAssignees.length === 0 && None} + {selectedAssignees.map(a => {a.name})} +
+ ) : ( -
- {users.map(u => ( - - ))} - {users.length === 0 && No staff available.} +
+
setAssigneesOpen(v => !v)}> + Assignees + + {selectedAssignees.length === 0 ? 'None selected' : selectedAssignees.map(a => a.name).join(', ')} + + +
+ {assigneesOpen && ( +
+ {users.map(u => ( + + ))} + {users.length === 0 && No staff available.} +
+ )}
)}