# Maternal App - Development Backlog

**Last Updated**: October 3, 2025
**Status**: Active Development

This document tracks remaining tasks, future enhancements, and technical debt items for the Maternal App project.

---

## 🔴 High Priority (Pre-Launch)

### 1. Date/Time Localization Refinement
**Status**: 70% Complete
**Estimated Effort**: 1-2 hours
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 10

**Completed**:
- ✅ `useLocalizedDate` hook created and implemented
- ✅ Activity timestamps use `formatDistanceToNow`

**Remaining**:
- [ ] Apply date-fns locale to all remaining date displays
- [ ] Child birth dates formatting with proper locale
- [ ] Analytics date ranges with locale-specific formatting
- [ ] Ensure consistent date formatting across all components

**Files to Update**:
- `app/children/page.tsx` - Birth date display
- `app/insights/page.tsx` - Date range selectors
- `components/features/analytics/InsightsDashboard.tsx` - Chart date labels
- Any remaining hardcoded date formats

---

### 2. Number Formatting Consistency
**Status**: 70% Complete
**Estimated Effort**: 1-2 hours
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 11

**Completed**:
- ✅ `useFormatting` hook created with Intl.NumberFormat

**Remaining**:
- [ ] Apply number formatting throughout app
- [ ] Weight/height values with locale-specific formatting
- [ ] Activity counts and statistics with proper number separators
- [ ] Decimal formatting consistency (1,000.50 vs 1.000,50)

**Files to Update**:
- `app/children/page.tsx` - Weight/height display
- `app/insights/page.tsx` - Statistics and counts
- `components/features/analytics/InsightsDashboard.tsx` - Chart values
- All tracking forms with numeric inputs

---

### 3. Comprehensive Testing Suite
**Status**: Not Started
**Estimated Effort**: 2-4 hours
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 14

**Test Coverage Needed**:
- [ ] Translation coverage test (verify no missing keys)
- [ ] Language switching test (all 7 languages)
- [ ] Unit conversion test (ml↔oz, kg↔lb, cm↔in)
- [ ] Date/time formatting test across locales
- [ ] Layout stability test (ensure no UI breaks with long translations)
- [ ] Number formatting test per locale
- [ ] Measurement unit persistence test
- [ ] Language persistence test across sessions

**Test Files to Create**:
- `__tests__/i18n/translation-coverage.test.ts`
- `__tests__/i18n/language-switching.test.ts`
- `__tests__/utils/unit-conversion.test.ts`
- `__tests__/utils/date-formatting.test.ts`
- `__tests__/utils/number-formatting.test.ts`

---

## 🟡 Medium Priority (Post-Launch)

### 4. Dynamic HTML Lang Attribute
**Status**: Not Started
**Estimated Effort**: 30 minutes
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 1.4

**Description**: Update `<html lang="">` attribute dynamically when language changes for better SEO and accessibility.

**Files to Update**:
- `app/layout.tsx` - Add dynamic lang attribute based on i18n state

**Implementation**:
```typescript
// app/layout.tsx
export default function RootLayout({ children }) {
  const { i18n } = useTranslation();

  useEffect(() => {
    document.documentElement.lang = i18n.language;
  }, [i18n.language]);

  // ...
}
```

---

### 5. Redux State Integration for User Preferences
**Status**: Not Started
**Estimated Effort**: 1-2 hours
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 5.1

**Description**: Currently using localStorage and API calls. Should integrate with Redux for better state management.

**Files to Update**:
- `store/slices/userSlice.ts` - Add language and measurementUnit to state

**Implementation**:
```typescript
interface UserState {
  // ... existing fields
  language: string;
  measurementUnit: 'metric' | 'imperial';
}
```

---

### 6. Component Localization Review
**Status**: Partially Complete
**Estimated Effort**: 2-3 hours
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 9.2

**Components Completed**:
- ✅ AppShell, MobileNav, TabBar
- ✅ LanguageSelector, MeasurementUnitSelector
- ✅ Main pages (dashboard, track, children, family, settings, ai-assistant, insights)

**Components to Review**:
- [ ] `components/common/` - Common dialogs, buttons, alerts
- [ ] `components/features/` - Activity cards, forms
- [ ] `components/children/` - ChildDialog, DeleteConfirmDialog
- [ ] `components/family/` - Family member components
- [ ] Error boundaries and fallback UIs
- [ ] Loading states and skeletons

---

## 🟢 Low Priority (Future Enhancements)

### 7. Professional Translation Review
**Status**: All Translations Complete
**Estimated Effort**: External service, 1-2 weeks
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 13.2

**Description**: All 7 languages have been machine-translated with cultural context. Native speaker review recommended before production launch.

**Languages to Review**:
- [ ] Spanish (es-ES) - Native speaker validation
- [ ] French (fr-FR) - Native speaker validation
- [ ] Portuguese (pt-BR) - Native speaker validation
- [ ] Simplified Chinese (zh-CN) - Native speaker validation
- [ ] German (de-DE) - Native speaker validation
- [ ] Italian (it-IT) - Native speaker validation

**Deliverables**:
- Cultural appropriateness verification
- Grammar and syntax corrections
- Parenting terminology accuracy
- Regional variations (if needed)

---

### 8. Developer Documentation
**Status**: Not Started
**Estimated Effort**: 1-2 hours
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md Phase 15

**Documents to Create**:
- [ ] `docs/LOCALIZATION_GUIDE.md` - How to add translations, languages, best practices
- [ ] Update `docs/implementation-gaps.md` - Mark localization as complete
- [ ] `docs/UNIT_CONVERSION_GUIDE.md` - How unit conversions work

**Content Needed**:
```markdown
# LOCALIZATION_GUIDE.md
- How to add new translation keys
- How to add new languages
- Translation file structure
- Best practices (interpolation, pluralization)
- How to test translations

# UNIT_CONVERSION_GUIDE.md
- Storage strategy (always metric)
- Display strategy (user preference)
- How to use UnitInput component
- How to add new unit types
```

---

### 9. Additional Language Support
**Status**: Not Started
**Estimated Effort**: 2-3 hours per language
**Related**: Future enhancement

**Potential Languages**:
- [ ] Arabic (ar-SA) - Requires RTL support
- [ ] Hindi (hi-IN) - Large user base
- [ ] Japanese (ja-JP) - Advanced market
- [ ] Korean (ko-KR) - Advanced market
- [ ] Russian (ru-RU) - Large user base

**Technical Requirements for RTL**:
- RTL layout support in CSS
- Mirror UI components
- Text alignment adjustments
- Icon direction handling

---

### 10. Additional Unit Types
**Status**: Not Started
**Estimated Effort**: 2-3 hours
**Related**: LOCALIZATION_IMPLEMENTATION_PLAN.md - Future Enhancements

**Unit Types to Add**:
- [ ] Temperature (°C / °F) - For fever tracking
- [ ] Time format preference (12h / 24h)
- [ ] Date format preference (MM/DD/YYYY vs DD/MM/YYYY)
- [ ] Regional variations (UK vs US imperial)

**Implementation**:
- Update `lib/utils/unitConversion.ts`
- Update `components/forms/UnitInput.tsx`
- Add to user preferences schema
- Add to onboarding flow

---

### 11. Translation Management System
**Status**: Not Started
**Estimated Effort**: 4-6 hours
**Priority**: Low (Nice to have)

**Description**: Implement a system for managing translations outside of JSON files for easier collaboration with translators.

**Options**:
1. **Local Tool**: Custom admin panel for translation management
2. **Third-Party**: Integration with services like Lokalise, Crowdin, or POEditor

**Benefits**:
- Non-developers can update translations
- Translation memory and consistency
- Automatic missing key detection
- Version control for translations
- Collaboration with professional translators

---

## 🔧 Technical Debt

### 12. Remove Unused MobileNav Component
**Status**: Identified
**Estimated Effort**: 15 minutes
**Priority**: Low

**Description**: `components/layouts/MobileNav/MobileNav.tsx` is no longer used since we unified the header. Consider removing or archiving.

**Files to Update**:
- Delete or archive `components/layouts/MobileNav/MobileNav.tsx`
- Remove imports from AppShell if not already removed

---

### 13. Optimize Translation Bundle Size
**Status**: Not Started
**Estimated Effort**: 2-3 hours
**Priority**: Medium

**Description**: Currently loading all translations. Implement lazy loading per namespace and language.

**Implementation**:
- Configure i18next backend plugin
- Load translations on demand
- Cache loaded translations
- Preload critical namespaces (common, errors)

**Expected Impact**:
- Reduce initial bundle size by ~60-70%
- Faster initial page load
- Better performance on slow connections

---

### 14. Accessibility (a11y) Audit
**Status**: Not Started
**Estimated Effort**: 3-4 hours
**Priority**: High (Pre-Launch)

**Areas to Review**:
- [ ] Keyboard navigation throughout app
- [ ] Screen reader compatibility (ARIA labels)
- [ ] Color contrast ratios (WCAG AA compliance)
- [ ] Focus management in dialogs
- [ ] Form validation messages accessibility
- [ ] Error messages accessibility
- [ ] Language selector accessibility

**Tools to Use**:
- axe DevTools
- WAVE browser extension
- Screen reader testing (NVDA/JAWS)

---

### 15. Performance Optimization
**Status**: Not Started
**Estimated Effort**: 2-4 hours
**Priority**: Medium

**Optimization Opportunities**:
- [ ] Implement code splitting for routes
- [ ] Lazy load heavy components (charts, analytics)
- [ ] Optimize image loading (next/image)
- [ ] Implement virtual scrolling for long lists
- [ ] Reduce re-renders with React.memo
- [ ] Optimize bundle size analysis

**Metrics to Track**:
- First Contentful Paint (FCP) < 1.5s
- Largest Contentful Paint (LCP) < 2.5s
- Time to Interactive (TTI) < 3.5s
- Cumulative Layout Shift (CLS) < 0.1

---

### 16. Push Notification Permission UI
**Status**: Not Started
**Estimated Effort**: 2-3 hours (Frontend) + 3-4 hours (Backend)
**Priority**: Low (Post-Launch)
**Related**: PWA Features (95% complete, this is the remaining 5%)

**Description**: Implement web push notification permission request and backend Firebase FCM integration.

**Frontend Requirements**:
- [ ] Create PushNotificationPermission component
- [ ] Request notification permission from browser
- [ ] Handle permission states (granted, denied, default)
- [ ] Send FCM token to backend when granted
- [ ] Show permission prompt at appropriate time (not immediately)
- [ ] Store permission state in user preferences

**Backend Requirements**:
- [ ] Firebase Cloud Messaging (FCM) integration
- [ ] Store FCM tokens per user/device
- [ ] Create notification sending service
- [ ] Add endpoints: POST /notifications/subscribe, DELETE /notifications/unsubscribe
- [ ] Implement notification templates (activity reminders, family updates)
- [ ] Handle token refresh and cleanup

**Files to Create**:
- Frontend: `components/pwa/PushNotificationPermission.tsx`
- Backend: `src/modules/notifications/fcm.service.ts`
- Backend: `src/modules/notifications/push-notification.service.ts`

**Implementation Notes**:
- Requires Firebase project setup
- Need VAPID keys for web push
- Test on multiple browsers (Chrome, Firefox, Safari)
- iOS requires PWA installed for push notifications

---

## 📋 Future Features

### 17. Offline Mode Enhancements
**Status**: Basic offline support exists
**Estimated Effort**: 6-8 hours
**Priority**: Medium

**Enhancements Needed**:
- [ ] Better offline indicator UI
- [ ] Sync queue visualization
- [ ] Conflict resolution UI
- [ ] Offline data persistence improvements
- [ ] Background sync when connection restored

---

### 18. Voice Input Multi-Language Support
**Status**: Works with backend language detection
**Estimated Effort**: 2-3 hours
**Priority**: Low

**Enhancements Needed**:
- [ ] Language-specific voice models
- [ ] Accent/dialect support
- [ ] Voice command examples per language
- [ ] Improved transcription accuracy

---

### 19. Export/Import Data
**Status**: Not Started
**Estimated Effort**: 4-6 hours
**Priority**: Medium

**Features**:
- [ ] Export activity data (CSV, PDF)
- [ ] Export analytics reports
- [ ] GDPR data export compliance
- [ ] Import data from other baby tracking apps
- [ ] Backup/restore functionality

---

### 20. Dark Mode
**Status**: Not Started
**Estimated Effort**: 3-4 hours
**Priority**: Low

**Implementation**:
- [ ] Add dark mode toggle in settings
- [ ] Create dark theme palette
- [ ] Test all components in dark mode
- [ ] Persist preference
- [ ] System preference detection

---

### 21. Push Notifications Localization
**Status**: Backend supports multi-language
**Estimated Effort**: 2-3 hours
**Priority**: Medium

**Features**:
- [ ] Send notifications in user's preferred language
- [ ] Localized notification templates
- [ ] Time zone awareness
- [ ] Customizable notification preferences

---

## 📊 Progress Tracking

**Total Tasks**: 21
**High Priority**: 3 tasks (15%)
**Medium Priority**: 3 tasks (15%)
**Low Priority**: 15 tasks (71%)

**Estimated Total Effort**: 45-70 hours (1-1.75 weeks)

---

## 🎯 Recommended Implementation Order

### Sprint 1 (Pre-Launch - Critical)
1. Date/Time Localization Refinement (1-2h)
2. Number Formatting Consistency (1-2h)
3. Comprehensive Testing Suite (2-4h)
4. Accessibility Audit (3-4h)

**Total**: 7-12 hours

### Sprint 2 (Post-Launch - Week 1)
5. Dynamic HTML Lang Attribute (30m)
6. Component Localization Review (2-3h)
7. Performance Optimization (2-4h)
8. Developer Documentation (1-2h)

**Total**: 6-10 hours

### Sprint 3 (Post-Launch - Week 2)
9. Redux State Integration (1-2h)
10. Professional Translation Review (External)
11. Optimize Translation Bundle Size (2-3h)
12. Remove Unused Components (15m)

**Total**: 3-5 hours

### Future Sprints
13-20. Feature enhancements and nice-to-haves

---

## 📝 Notes

- This backlog should be reviewed and updated monthly
- Priority levels may change based on user feedback
- Effort estimates are rough and may vary
- Consider user feedback for prioritization
- Some tasks may become obsolete with new requirements

---

**Document Owner**: Development Team
**Review Frequency**: Monthly
**Next Review**: November 3, 2025
