b66a5ef9b6
Add a single global "تحرير/Edit" toggle button to the schedule toolbar that hides every editing affordance by default and reveals them only when the user (with edit permission) explicitly opts in. Affordances now gated behind `effectiveCanMutate = canMutate && editMode`: - "+ Add row" button - Per-row delete, color swatch, merge trigger, drag grip - Inline cell editors (EditableCell, TimeRangeCell) - Column drag-reorder (SortableHeader.dragEnabled) - Column resize handles - "+ Add attendee" button AND its pending ghost row Persistence: - Toggle state is stored in localStorage under a per-user key `em-schedule-edit-mode-v1:<userId>`, so a shared browser cannot leak one editor's last toggle into another account that signs in. Falls back to view mode when userId is unavailable. - Always starts in view mode for users without edit permission. Toggle-off safety: - EditableCell + TimeRangeCell discard any in-progress draft and exit edit mode when their `disabled` / `canMutate` prop flips. - ScheduleSection clears `pendingAttendee` in a useEffect when effectiveCanMutate becomes false, so the ghost "+ Add attendee" row unmounts immediately. - AttendeeFlow also gates the pending render on `canMutate` as defense in depth. i18n: 4 new keys under `executiveMeetings.schedule` (editToggle / editToggleAria / editToggleOn / editToggleOff) in both en.json and ar.json. Tests: tests/executive-meetings-edit-toggle.spec.mjs covers default-hidden affordances, toggle-on reveal, reload persistence, and toggle-off re-hide. Cleanup wipes all `em-schedule-edit-mode-v1*` keys to handle the user-namespaced storage. Full e2e suite (12 tests) passes. Code review: PASS on the second pass after the per-user key + ghost row fixes. Pre-existing TS errors in admin.tsx and use-notifications-socket.ts are codegen drift from earlier tasks and are not touched by this change.
2.5 KiB
327x94px
2.5 KiB
327x94px