3.8 KiB
Create a modern baby tracking application using Next.js, Tailwind CSS, and Prisma with SQLite. The application should be fully responsive and optimize space usage for both mobile and desktop views.
Technical Requirements:
- Use Next.js App Router structure /app
- Implement API routes in the /app/api folder for all baby-related functions
- Use Prisma with SQLite for data management /prisma and /db
- Implement Tailwind CSS for styling
- Use shadcn/ui components for UI elements
- Use Lucide icons for all iconography
- Any new libraries we use should be installed first so the latest version is added to package.json
Core Features:
-
Baby Management:
- Selector dropdown in the top bar for choosing active baby
- Edit and Add buttons that trigger modals
- Form fields: First Name, Last Name, Birth Date, Gender
- Store data using API route: /app/api/baby
-
Activity Tracking: Quick action buttons for:
- Sleep tracking (start/stop with mood and notes)
- Bottle feeding
- Diaper changes
- Manual entry for historical data Store data using respective API routes:
- /app/api/sleep
- /app/api/feed
- /app/api/diaper
- /app/api/note
-
Recent Activity Timeline:
- Chronological list of all activities
- Each entry shows:
- Activity type icon
- Activity description
- Timestamp/duration
- Options menu for edit/delete
- Fetch data using: /app/api/activity
Layout Requirements:
-
Mobile View (< 768px):
- Full-width components
- Single column quick action buttons
- Condensed timeline entries
- Bottom navigation bar for key actions
- Modal dialogs should use full width with appropriate padding
-
Tablet View (768px - 1024px):
- Two-column quick action buttons
- Sidebar navigation
- Larger touch targets
- Modals should be centered with max-width
-
Desktop View (> 1024px):
- Maximum width of 4xl (56rem)
- Four-column quick action buttons
- Expanded timeline view
- Efficient use of horizontal space
Modal Requirements:
-
Baby Add/Edit Modal:
- Form validation
- Save/Cancel buttons
- Close on outside click
- Proper error handling
-
Sleep Modal:
- Start/End time selection
- Mood selector
- Notes field
- Location field (optional)
-
Feeding Modal:
- Time selection
- Amount input
- Type selector (breast, bottle, solids)
- Side selection for breastfeeding
- Notes field
-
Diaper Modal:
- Time selection
- Type selector (wet, dirty, both)
- Condition notes
- Color selection
-
Manual Entry Modal:
- Activity type selector
- Custom time selection
- Activity-specific fields
- Notes field
State Management:
- Use React's useState for component-level state
- Implement proper loading states
- Handle error states gracefully
- Show appropriate feedback for user actions
Additional Features to Consider:
- Statistics dashboard
- Growth tracking
- Multiple caregiver support
- Data export functionality
- Photo gallery for milestones
- Reminder system
Error Handling:
- Implement proper error boundaries
- Show user-friendly error messages
- Provide fallback UI for loading states
- Handle offline capabilities
Security Considerations:
- Input sanitization
- Data validation
- API route protection
- User authentication (if implementing multiple caregivers)
Use the provided sample code as a starting point, but ensure the final implementation:
- Properly handles all viewport sizes
- Implements proper error handling
- Uses appropriate loading states
- Follows accessibility guidelines
- Implements proper form validation
- Uses consistent styling throughout
- Optimizes performance
The final application should provide a seamless experience across all devices while maintaining a clean, modern aesthetic that's easy for tired parents to use.