Feature: Admin Broadcast Notification Panel
Description
Create an administrative UI panel/form to compose and dispatch broadcast messages to signed-up camp volunteers via email and/or push notifications.
Technical Requirements
- Create a form component inside the Admin dashboard directory.
-
UI Elements Required:
- Title/Subject input field.
- Message body textarea.
- "Send Emails" toggle/checkbox.
- "Send Push Notifications" toggle/checkbox.
- Submit button.
-
Validation & State:
- Disable submit button if both toggles are false or fields are empty.
- Show loading state while the API call is in flight.
-
API Integration: Connect to
POST /api/v1/admin/notifications/broadcast.
Test Cases (Frontend Validation)
-
TC-FE-01 (RBAC Route Guard): Verify that navigating directly to the notification dashboard URL redirects non-admin users back to their home portal. -
TC-FE-02 (Form Validation - Empty State): Verify that the "Send Announcement" button remains disabled until both the Title and Message fields contain text. -
TC-FE-03 (Form Validation - Toggle Enforcement): Fill out the text fields but leave both "Send Emails" and "Send Push Notifications" unchecked. Verify that the submit button is disabled (or throws a clear form warning). -
TC-FE-04 (Loading UI State): Verify that upon clicking submit, the button text switches to "Broadcasting..." and becomes unclickable to prevent double-submitting while waiting for the API response. -
TC-FE-05 (Success/Error Handling): Mock a successful API response and verify a success Toast appears and resets the form. Mock a 500 error response and verify an error alert is safely caught and displayed.
Acceptance Criteria
-
UI is responsive and accessible only to authorized admin/coordinator roles. -
Form blocks submission if no communication channel (email or push) is selected. -
Displays a success toast notification once the backend accepts the broadcast task.