HandleSendMail
Function: handleSendMail()
[object Object]
Defined in: app/components/Activity/Edit/SendActivityMailComponent/SendActivityMailComponent.handlers.tsx:35
Handles the logic for sending a broadcast email to activity participants.
Features:
- Content Validation: Prevents sending if the content is empty or contains only empty HTML tags.
- Toast Feedback: Uses
toast.promiseto provide real-time loading, success, and error notifications. - State Management: Controls a loading spinner state and clears the form inputs upon a successful send.
Parameters
args
The configuration object.
activityId
[object Object]
The unique identifier of the activity whose participants should receive the mail.
clearForm
() => void
Callback to reset the email form inputs after a successful operation.
content
[object Object]
The HTML content string (usually from a rich text editor).
includeWaitingList
[object Object]
Whether members on the activity's waiting list should also receive the email.
setLoading
(loading) => void
Callback to toggle the UI's loading/submitting state.
subject
[object Object]
The subject line of the email.
Returns
Promise<void>
Example
handleSendMail({
activityId: 42,
subject: "Important Update",
content: htmlString,
includeWaitingList: true,
setLoading: setIsSending,
clearForm: () => setContent("")
});