Skip to content

Feature: Letters page #47

@FadyGergesRezk

Description

@FadyGergesRezk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    clientIssue regarding the client frontendenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions