# 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 (
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) => (
onToggleGoal(goal.id)}
className={`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${
goal.completed
? 'bg-blue-500 text-white shadow-lg'
: 'bg-blue-100 text-gray-700 hover:bg-blue-200'
}`}
>
{goal.completed && }
{goal.text}
))}
);
}
```
### 8. /src/app/components/Notes.tsx
```tsx
interface NotesProps {
note: string;
onNoteChange: (note: string) => void;
}
export function Notes({ note, onNoteChange }: NotesProps) {
return (
Notes
);
}
```
## Key Features & Interactions
1. **Water Tracker**
- Animated wave visualization using SVG and Motion
- Click + button to add 0.25L (max 3.0L)
- Displays current/target amount
2. **Steps Tracker**
- Circular progress indicator using SVG circles
- Shows 8,432 / 10,000 steps
- Animated stroke-dashoffset for progress
3. **Strava Integration**
- Orange gradient background
- Rotated "S" logo
- Displays distance and last sync time
4. **Sleep Tracker**
- Recharts line chart visualization
- Shows hours and minutes
- Sleep type label (Light Sleep)
5. **Goals**
- Three clickable goal items
- Toggle completed state
- Visual feedback with color change
6. **Notes**
- Textarea for user input
- Placeholder text
- Auto-updating state
7. **Header**
- User avatar with initials "JD"
- Level indicator
- Streak counter with droplet icons
- Live date/time that updates every second
## Important Implementation Notes
- Use Tailwind CSS v4 (no config file needed)
- Motion package is imported as `import { motion } from 'motion/react'`
- All components are TypeScript with proper interfaces
- State management uses React useState hooks
- DateTime updates every 1000ms using setInterval
- Responsive design with max-width container
- All interactive elements have hover states
- Glassmorphism effects using backdrop-blur and opacity
## Testing Checklist
- [ ] Water tracker + button increases amount
- [ ] Water amount doesn't exceed 3.0L
- [ ] Goals toggle between completed/incomplete
- [ ] Notes textarea updates on input
- [ ] Date and time update in real-time
- [ ] All animations are smooth
- [ ] Mobile responsive (320px - 448px width)
- [ ] All icons from lucide-react render correctly
- [ ] Sleep chart displays properly with recharts