# Hydro Flux Dashboard - Complete Replication Guide ## Overview A mobile-first health tracking dashboard called "Hydro Flux" that tracks water intake, steps, sleep, Strava integration, goals, and notes. Built with React, TypeScript, Tailwind CSS, and Motion (Framer Motion). ## Design Specifications ### Color Palette - Primary Blue: #60A5FA (blue-400) - Secondary Blue: #3B82F6 (blue-500) - Light Blue: #DBEAFE (blue-50) - Orange (Strava): #EA580C (orange-600) - Gray Background: Linear gradient from gray-100 to gray-200 - White: #FFFFFF - Text Primary: #1F2937 (gray-800) - Text Secondary: #6B7280 (gray-500) ### Layout - Mobile-first design (max-width: 28rem / 448px) - Rounded container with 3rem border radius - White background with shadow-2xl - Padding: 1.5rem (6 units) - Component spacing: 1rem gap (4 units) ### Typography - Headers: font-bold - Body: font-medium - Small text: text-sm, text-xs ## Dependencies Required ```json { "recharts": "2.15.2", "motion": "12.23.24", "lucide-react": "0.487.0" } ``` Import Motion using: `import { motion } from 'motion/react'` ## File Structure ``` /src/app/ ├── App.tsx └── components/ ├── Header.tsx ├── WaterTracker.tsx ├── StepsTracker.tsx ├── StravaIntegration.tsx ├── SleepTracker.tsx ├── Goals.tsx └── Notes.tsx ``` ## Complete Component Code ### 1. /src/app/App.tsx ```tsx import { useState, useEffect } from 'react'; import { Header } from './components/Header'; import { WaterTracker } from './components/WaterTracker'; import { StepsTracker } from './components/StepsTracker'; import { StravaIntegration } from './components/StravaIntegration'; import { SleepTracker } from './components/SleepTracker'; import { Goals } from './components/Goals'; import { Notes } from './components/Notes'; function App() { const [waterAmount, setWaterAmount] = useState(1.2); const [currentDate, setCurrentDate] = useState(''); const [currentTime, setCurrentTime] = useState(''); const [note, setNote] = useState('Feeling hydrated today. Remember to add those gym sessions!'); const [goals, setGoals] = useState([ { id: '1', text: 'Drink 3L of water', completed: true }, { id: '2', text: 'Walk 10K steps', completed: false }, { id: '3', text: 'Sleep 8 hours', completed: false }, ]); // Sleep data for the chart const sleepData = [ { value: 30 }, { value: 35 }, { value: 25 }, { value: 40 }, { value: 55 }, { value: 45 }, { value: 60 }, { value: 75 }, { value: 70 }, { value: 80 }, { value: 65 }, { value: 55 }, { value: 50 }, { value: 45 }, { value: 40 }, ]; useEffect(() => { const updateDateTime = () => { const now = new Date(); const dateStr = now.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); const timeStr = now.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true }) + ' AEDT'; setCurrentDate(dateStr); setCurrentTime(timeStr); }; updateDateTime(); const interval = setInterval(updateDateTime, 1000); return () => clearInterval(interval); }, []); const handleAddWater = () => { setWaterAmount((prev) => Math.min(prev + 0.25, 3.0)); }; const handleToggleGoal = (id: string) => { setGoals((prev) => prev.map((goal) => goal.id === id ? { ...goal, completed: !goal.completed } : goal ) ); }; return (
{/* Subtle background decoration */}
); } export default App; ``` ### 2. /src/app/components/Header.tsx ```tsx import { Droplet } from 'lucide-react'; interface HeaderProps { level: number; streakDays: number; currentDate: string; currentTime: string; } export function Header({ level, streakDays, currentDate, currentTime }: HeaderProps) { return (
JD
Level {level}

Hydro Flux

{currentDate}
{currentTime}
{streakDays} Days
); } ``` ### 3. /src/app/components/WaterTracker.tsx ```tsx import { Plus } from 'lucide-react'; import { motion } from 'motion/react'; interface WaterTrackerProps { currentAmount: number; targetAmount: number; onAddWater: () => void; } export function WaterTracker({ currentAmount, targetAmount, onAddWater }: WaterTrackerProps) { const percentage = (currentAmount / targetAmount) * 100; return (
{/* Water wave */} {/* Wave effect */} {/* Add button */} {/* Amount display */}
{currentAmount.toFixed(1)}L / {targetAmount.toFixed(1)}L
); } ``` ### 4. /src/app/components/StepsTracker.tsx ```tsx interface StepsTrackerProps { steps: number; goal: number; } export function StepsTracker({ steps, goal }: StepsTrackerProps) { const percentage = Math.min((steps / goal) * 100, 100); const circumference = 2 * Math.PI * 45; const strokeDashoffset = circumference - (percentage / 100) * circumference; return (

Steps Tracker

{steps.toLocaleString()} steps
); } ``` ### 5. /src/app/components/StravaIntegration.tsx ```tsx interface StravaIntegrationProps { distance: number; lastSync: string; } export function StravaIntegration({ distance, lastSync }: StravaIntegrationProps) { return (

Strava Integration

S
{distance}km Run Last Sync: {lastSync}
); } ``` ### 6. /src/app/components/SleepTracker.tsx ```tsx import { LineChart, Line, ResponsiveContainer, YAxis } from 'recharts'; interface SleepTrackerProps { hours: number; minutes: number; sleepType: string; data: { value: number }[]; } export function SleepTracker({ hours, minutes, sleepType, data }: SleepTrackerProps) { return (

Sleep Tracker

{hours}h {minutes}m {sleepType}
); } ``` ### 7. /src/app/components/Goals.tsx ```tsx import { Check } from 'lucide-react'; interface Goal { id: string; text: string; completed: boolean; } interface GoalsProps { goals: Goal[]; onToggleGoal: (id: string) => void; } export function Goals({ goals, onToggleGoal }: GoalsProps) { return (

Goals

{goals.map((goal) => ( ))}
); } ``` ### 8. /src/app/components/Notes.tsx ```tsx interface NotesProps { note: string; onNoteChange: (note: string) => void; } export function Notes({ note, onNoteChange }: NotesProps) { return (

Notes