Files
maternal-app/maternal-web/update-tracking-errors.sh
Andrei c22fa82521
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
feat: Implement comprehensive error handling and production deployment pipeline
## Error Handling System
- Add centralized error handling utilities (errorHandler.ts)
- Create reusable error components (ErrorMessage, ErrorToast)
- Implement multilingual error support (preserves backend error messages in 5 languages)
- Update 15+ forms and components with consistent error handling
  - Auth forms: login, register, forgot-password
  - Family management: family page, join family dialog
  - Child management: child dialog
  - All tracking forms: feeding, sleep, diaper, medicine, growth, activity

## Production Build Fixes
- Fix backend TypeScript errors: InviteCode.uses → InviteCode.useCount (5 instances)
- Remove non-existent savedFamily variable from registration response
- Fix admin panel TypeScript errors: SimpleMDE toolbar type, PieChart label type

## User Experience Improvements
- Auto-uppercase invite code and share code inputs
- Visual feedback for case conversion with helper text
- Improved form validation with error codes

## CI/CD Pipeline
- Create comprehensive production deployment checklist (PRODUCTION_DEPLOYMENT_CHECKLIST.md)
- Add automated pre-deployment check script (pre-deploy-check.sh)
  - Validates frontend, backend, and admin panel builds
  - Checks git status, branch, and sync state
  - Verifies environment files and migrations
- Add quick start deployment guide (DEPLOYMENT_QUICK_START.md)
- Add production deployment automation template (deploy-production.sh)

## Cleanup
- Remove outdated push notifications documentation files
- Remove outdated PWA implementation plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 21:27:39 +00:00

48 lines
1.7 KiB
Bash

#!/bin/bash
# Script to update all tracking forms to use new error handling
TRACKING_FILES=(
"/root/maternal-app/maternal-web/app/track/feeding/page.tsx"
"/root/maternal-app/maternal-web/app/track/sleep/page.tsx"
"/root/maternal-app/maternal-web/app/track/diaper/page.tsx"
"/root/maternal-app/maternal-web/app/track/medicine/page.tsx"
"/root/maternal-app/maternal-web/app/track/growth/page.tsx"
"/root/maternal-app/maternal-web/app/track/activity/page.tsx"
)
for file in "${TRACKING_FILES[@]}"; do
if [ -f "$file" ]; then
echo "Updating $file..."
# 1. Add imports at the top (after existing imports)
if ! grep -q "useErrorMessage" "$file"; then
# Find the last import line and add after it
sed -i '/^import.*from/a\import { useErrorMessage } from "@/components/common/ErrorMessage";\nimport { formatErrorMessage } from "@/lib/utils/errorHandler";' "$file" | head -1
fi
# 2. Replace error state declaration
sed -i 's/const \[error, setError\] = useState<string | null>(null);/const { error, showError, clearError, hasError } = useErrorMessage();/' "$file"
# 3. Replace setError('') with clearError()
sed -i "s/setError('')/clearError()/g" "$file"
sed -i 's/setError("")/clearError()/g' "$file"
sed -i 's/setError(null)/clearError()/g' "$file"
# 4. Replace setError with showError for error messages
sed -i 's/setError(\([^)]*\))/showError(\1)/g' "$file"
# 5. Replace error && with hasError &&
sed -i 's/error &&/hasError \&\&/g' "$file"
# 6. Replace {error} display with {formatErrorMessage(error)}
sed -i 's/{error}/{formatErrorMessage(error)}/g' "$file"
echo " ✓ Updated $file"
else
echo " ✗ File not found: $file"
fi
done
echo "Done updating tracking forms!"