Implement the Letters page under /letters.
Priority: P2
API endpoints used
| Method |
Endpoint |
Description |
| POST |
/letters/mail |
Send an HTML email to all members |
| POST |
/letters/pdf |
Generate a PDF from an HTML template (returns binary) |
Tasks
- Add
src/features/letters/api/mutations.ts with useSendMail and useGetPdf hooks using TanStack Query mutations
- Add Zod schema to validate the HTML template body is non-empty before submission
- Build a simple HTML template editor (shadcn/ui Textarea) for composing letter content
- Add a "Send Mail" Button that calls
useSendMail, disables during submission, and shows a success/error Toast on completion
- Add a "Preview PDF" Button that calls
useGetPdf, receives the binary application/pdf response, creates a blob URL, and opens it in a new browser tab
- Both actions should show an error Toast if the request fails
Acceptance criteria
- Composing and sending a mail completes with a visible success Toast
- Clicking "Preview PDF" opens the generated PDF in a new browser tab
- Both buttons are disabled and show a loading state while the request is in flight
- An error Toast is shown if either request fails
- Invalid/non-PDF preview responses are handled with a user-facing error state
Implement the Letters page under
/letters.Priority: P2
API endpoints used
Tasks
src/features/letters/api/mutations.tswithuseSendMailanduseGetPdfhooks using TanStack Query mutationsuseSendMail, disables during submission, and shows a success/error Toast on completionuseGetPdf, receives the binaryapplication/pdfresponse, creates a blob URL, and opens it in a new browser tabAcceptance criteria