Skip to main content

Phase 8: Frontend Development - KICKOFF 🎨

Started: October 26, 2025
Estimated Time: 120 hours (3 weeks)
Status: IN PROGRESS πŸš€


🎯 Frontend Development Plan​

Overview​

Build a beautiful, intuitive UI for managing recipient groups and rules in the frontend PWA app.

Target App: apps/frontend-pwa
Tech Stack: React + TypeScript + Tailwind + React Query
Pages to Build: 2 main pages + supporting components


πŸ“‹ Sprint Breakdown​

Sprint 1: API Integration Layer (Week 1 - 40h)​

Goal: Connect to backend APIs with error handling and state management

Day 1-2: API Client Setup (16h)​

  • Create RecipientGroupsAPI service
  • Create RecipientRulesAPI service
  • Set up React Query hooks
  • Error handling utilities
  • Loading state management
  • Success/error toast notifications

Day 3-4: Core Hooks (16h)​

  • useRecipientGroups() - List & CRUD
  • useGroupMembers() - Member management
  • useRecipientRules() - List & CRUD
  • usePreviewRecipients() - Preview functionality
  • Query invalidation strategies
  • Optimistic updates

Day 5: Testing & Documentation (8h)​

  • API integration tests
  • Hook usage examples
  • Error scenario handling
  • Documentation

Sprint 2: Core Components (Week 2 - 40h)​

Goal: Build reusable components for groups and rules

Day 1-2: Group Components (16h)​

  • RecipientGroupCard - Display group info
  • GroupMemberCard - Display member info
  • AddMemberForm - Add member modal
  • GroupFormFields - Reusable form fields
  • Empty states
  • Loading skeletons

Day 3-4: Rule Components (16h)​

  • RecipientRuleCard - Display rule info
  • RuleFormFields - Reusable form fields
  • TargetingTypeSelector - Radio/dropdown for targeting
  • PreviewRecipientsModal - Show who will receive
  • Priority indicators
  • Status badges

Day 5: Shared Components (8h)​

  • MemberTypeIcon - Icon for email/phone/user
  • ChannelBadge - Badge for email/sms/whatsapp
  • ValidationFeedback - Error/success messages
  • SearchFilter - Filter groups/rules
  • SortControls - Sort options

Sprint 3: Main Pages (Week 3 - 40h)​

Goal: Complete pages for managing groups and rules

Day 1-2: Groups Management Page (16h)​

  • /settings/recipient-groups route
  • List all groups with filters
  • Create new group modal
  • Edit group modal
  • Delete group confirmation
  • Member management section
  • Add member modal
  • Remove member confirmation
  • Search and sort functionality

Day 3-4: Rules Management Page (16h)​

  • /settings/recipient-rules route
  • List all rules with filters
  • Create new rule modal
  • Edit rule modal
  • Delete rule confirmation
  • Deactivate/activate toggle
  • Preview recipients button
  • Priority reordering (drag & drop optional)

Day 5: Polish & Integration (8h)​

  • i18n (English + Spanish)
  • Responsive design (mobile/tablet)
  • Loading states
  • Error states
  • Empty states
  • Success notifications
  • Integration with settings menu

🎨 Design System​

Color Scheme​

// Tailwind classes to use
groups: "bg-blue-50 border-blue-200 text-blue-900"
rules: "bg-purple-50 border-purple-200 text-purple-900"
members: "bg-green-50 border-green-200 text-green-900"
preview: "bg-orange-50 border-orange-200 text-orange-900"

Component Patterns​

  • Cards for entities (groups, rules, members)
  • Modals for create/edit forms
  • Toasts for notifications
  • Tables for lists
  • Badges for status/types

πŸ“ File Structure​

apps/frontend-pwa/src/
β”œβ”€β”€ api/
β”‚ β”œβ”€β”€ recipient-groups.api.ts (NEW)
β”‚ └── recipient-rules.api.ts (NEW)
β”œβ”€β”€ hooks/
β”‚ β”œβ”€β”€ useRecipientGroups.ts (NEW)
β”‚ β”œβ”€β”€ useGroupMembers.ts (NEW)
β”‚ β”œβ”€β”€ useRecipientRules.ts (NEW)
β”‚ └── usePreviewRecipients.ts (NEW)
β”œβ”€β”€ components/
β”‚ β”œβ”€β”€ recipient-groups/
β”‚ β”‚ β”œβ”€β”€ RecipientGroupCard.tsx (NEW)
β”‚ β”‚ β”œβ”€β”€ GroupMemberCard.tsx (NEW)
β”‚ β”‚ β”œβ”€β”€ AddMemberForm.tsx (NEW)
β”‚ β”‚ └── GroupFormFields.tsx (NEW)
β”‚ └── recipient-rules/
β”‚ β”œβ”€β”€ RecipientRuleCard.tsx (NEW)
β”‚ β”œβ”€β”€ RuleFormFields.tsx (NEW)
β”‚ β”œβ”€β”€ TargetingTypeSelector.tsx(NEW)
β”‚ └── PreviewRecipientsModal.tsx(NEW)
β”œβ”€β”€ pages/
β”‚ β”œβ”€β”€ RecipientGroupsPage.tsx (NEW)
β”‚ └── RecipientRulesPage.tsx (NEW)
└── i18n/
β”œβ”€β”€ locales/en.json (UPDATE)
└── locales/es.json (UPDATE)

Estimated: ~30 new files, 2 updates


πŸš€ Immediate Next Steps (First 4 Hours)​

Step 1: API Integration Layer (2h)​

  1. Create RecipientGroupsAPI service
  2. Create RecipientRulesAPI service
  3. Add error handling
  4. Add TypeScript types

Step 2: React Query Hooks (2h)​

  1. Create useRecipientGroups() hook
  2. Create useGroupMembers() hook
  3. Test with backend API
  4. Handle loading/error states

✨ Success Criteria​

Week 1​

  • βœ… API client fully functional
  • βœ… React Query integrated
  • βœ… Can fetch groups/rules from backend
  • βœ… Can create/update/delete groups
  • βœ… Error handling working

Week 2​

  • βœ… All core components built
  • βœ… Components are reusable
  • βœ… Styled with Tailwind
  • βœ… Responsive design

Week 3​

  • βœ… Both pages complete
  • βœ… Full CRUD functionality
  • βœ… i18n (EN + ES)
  • βœ… Tested on mobile/tablet
  • βœ… Integrated in settings

🎯 Key Features to Build​

  1. Recipient Groups Management

    • List all groups for business
    • Create custom groups
    • Edit group details
    • Delete groups
    • Add members (users, emails, phones)
    • Remove members
    • View member details
  2. Recipient Rules Management

    • List all rules for business
    • Create targeting rules
    • Select targeting type (role/group/ad-hoc)
    • Set priority
    • Preview recipients
    • Activate/deactivate rules
    • Edit rules
    • Delete rules
  3. Preview Functionality

    • See who will receive communications
    • Filter by communication type
    • Filter by channel
    • Show source (rule/group/role)
    • Display contact info

πŸ“Š Technical Requirements​

API Integration​

  • βœ… Use Axios (already in project)
  • βœ… Use React Query for state
  • βœ… Handle errors gracefully
  • βœ… Show loading states
  • βœ… Optimistic updates

Forms​

  • βœ… Use react-hook-form (check if installed)
  • βœ… Validate on client side
  • βœ… Match backend validation rules
  • βœ… Show helpful error messages

UI/UX​

  • βœ… Use existing Tailwind theme
  • βœ… Match existing app design
  • βœ… Responsive (mobile-first)
  • βœ… Accessible (ARIA labels)
  • βœ… Loading skeletons
  • βœ… Empty states

πŸŽ‰ Let's Build!​

Ready to create the first API service and hook! πŸš€

Starting with: RecipientGroupsAPI service


Next: Create API integration layer (2h)