Understood. Here is the complete front-end code for the Boonz Nutriplanet website. I have built out all the remaining sections: the Dashboard, Food Tracker, Meal Planner, and Blog.
📝 Instructions
- Create the Project Folder: Make a folder named
boonz-nutriplanet.
- Create Subfolders: Inside
boonz-nutriplanet, create css, js, and images folders.
- Save the Files: Save each code block below into the correct file path (e.g., save the
dashboard.html code into a file named dashboard.html at the root of your project folder).
- Update Existing Files: Replace the content of your existing
index.html, hydrate.html, css/style.css, and js/hydrate-tracker.js with the updated versions below.
- Open
index.html in your browser to navigate the complete website.
📂 File Structure (Final)
boonz-nutriplanet/
│
├── index.html
├── dashboard.html
├── hydrate.html
├── track-food.html
├── meal-planner.html
├── blog.html
│
├── css/
│ └── style.css
│
├── js/
│ ├── hydrate-tracker.js
│ ├── dashboard-chart.js
│ └── food-tracker.js
│
└── images/
└── (empty for now)
HTML Files
📄 index.html (Updated with Full Navigation)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Boonz Nutriplanet – Fuel Your Body. Thrive Your Life.</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<header>
<nav>
<div class="logo">🥗 Boonz Nutriplanet</div>
<ul>
<li><a href="index.html" class="active">Home</a></li>
<li><a href="dashboard.html">Dashboard</a></li>
<li><a href="hydrate.html">Hydration</a></li>
<li><a href="track-food.html">Food Log</a></li>
<li><a href="meal-planner.html">Meal Planner</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</nav>
</header>
<main>
<section class="hero">
<h1>Fuel Your Body. Thrive Your Life.</h1>
<p>Welcome to Boonz Nutriplanet – Your Personal Nutrition & Hydration Companion.</p>
<a href="dashboard.html" class="btn">Go to Dashboard</a>
</section>
<section class="features">
<div class="feature-card">
<h3>💧 Hydration Tracker</h3>
<p>Never forget to drink water. Set reminders & track your daily intake.</p>
</div>
<div class="feature-card">
<h3>🍽️ Food & Meal Logging</h3>
<p>Easily log meals, track calories, and understand your nutrition.</p>
</div>
<div class="feature-card">
<h3>📅 Smart Meal Planner</h3>
<p>Get delicious, balanced meal plans tailored to your goals.</p>
</div>
</section>
</main>
<footer>
<p>© 2024 Boonz Nutriplanet. All rights reserved.</p>
</footer>
</body>
</html>
📄 dashboard.html (NEW)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard - Boonz Nutriplanet</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js" defer></script>
<script src="js/dashboard-chart.js" defer></script>
</head>
<body>
<header>
<nav>
<div class="logo">🥗 Boonz Nutriplanet</div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="dashboard.html" class="active">Dashboard</a></li>
<li><a href="hydrate.html">Hydration</a></li>
<li><a href="track-food.html">Food Log</a></li>
<li><a href="meal-planner.html">Meal Planner</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</nav>
</header>
<main class="dashboard-container">
<h1>Welcome Back, User!</h1>
<p>Here's your snapshot for today.</p>
<div class="dashboard-grid">
<!-- Today's Summary -->
<div class="card summary-card">
<h2>Today's Summary</h2>
<div class="stat">
<span>🔥 Calories</span>
<strong>1,560 / 2,200 kcal</strong>
</div>
<div class="stat">
<span>💧 Water</span>
<strong>6 / 8 cups</strong>
</div>
<div class="macros">
<div class="macro-item">
<span class="label">Carbs</span>
<div class="macro-bar carbs"><div style="width: 60%;"></div></div>
<span>180g</span>
</div>
<div class="macro-item">
<span class="label">Protein</span>
<div class="macro-bar protein"><div style="width: 80%;"></div></div>
<span>120g</span>
</div>
<div class="macro-item">
<span class="label">Fat</span>
<div class="macro-bar fat"><div style="width: 50%;"></div></div>
<span>60g</span>
</div>
</div>
</div>
<!-- Weight Progress -->
<div class="card progress-card">
<h2>Weight Progress</h2>
<canvas id="weightChart"></canvas>
</div>
<!-- Quick Actions -->
<div class="card quick-actions-card">
<h2>Quick Actions</h2>
<a href="track-food.html" class="btn action-btn">Log a Meal</a>
<a href="hydrate.html" class="btn action-btn">Add Water</a>
<a href="meal-planner.html" class="btn action-btn">View Meal Plan</a>
</div>
<!-- Today's Meals -->
<div class="card recent-meals-card">
<h2>Today's Meals</h2>
<ul>
<li><strong>Breakfast:</strong> Oatmeal with Berries (350 kcal)</li>
<li><strong>Lunch:</strong> Grilled Chicken Salad (450 kcal)</li>
<li><strong>Dinner:</strong> Salmon with Quinoa (550 kcal)</li>
<li><strong>Snack:</strong> Greek Yogurt (210 kcal)</li>
</ul>
</div>
</div>
</main>
<footer>
<p>© 2024 Boonz Nutriplanet. All rights reserved.</p>
</footer>
</body>
</html>
📄 hydrate.html (Updated with Full Navigation)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Hydration Tracker – Boonz Nutriplanet</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<header>
<nav>
<div class="logo">🥗 Boonz Nutriplanet</div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="dashboard.html">Dashboard</a></li>
<li><a href="hydrate.html" class="active">Hydration</a></li>
<li><a href="track-food.html">Food Log</a></li>
<li><a href="meal-planner.html">Meal Planner</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</nav>
</header>
<main>
<section class="hydrate-section card">
<h1>💧 Hydration Tracker</h1>
<p>Set your daily water goal and track your intake with reminders.</p>
<div class="hydrate-goal">
<label for="water-goal">Daily Water Goal (cups):</label>
<input type="number" id="water-goal" value="8" min="1" max="20" />
</div>
<div class="water-progress">
<h3>Today's Intake: <span id="current-intake">0</span> / <span id="goal">8</span> cups</h3>
<div class="progress-bar-container">
<div class="progress-bar-fill" id="water-progress"></div>
</div>
</div>
<div class="hydrate-actions">
<button id="add-water-btn" class="btn">Add 1 Cup</button>
<button id="remove-water-btn" class="btn btn-secondary">Remove 1 Cup</button>
</div>
<div class="reminder-section">
<h3>⏰ Reminder Settings</h3>
<label class="toggle-switch">
<input type="checkbox" id="reminder-toggle" checked>
<span class="slider"></span>
Enable Reminders
</label>
<div class="reminder-options">
<label for="reminder-frequency">Remind me every:</label>
<select id="reminder-frequency">
<option value="30">30 minutes</option>
<option value="60" selected>1 hour</option>
<option value="120">2 hours</option>
</select>
<button id="start-reminder-btn" class="btn">Start Reminders</button>
</div>
</div>
</section>
</main>
<footer>
<p>© 2024 Boonz Nutriplanet. All rights reserved.</p>
</footer>
<script src="js/hydrate-tracker.js"></script>
</body>
</html>
📄 track-food.html (NEW)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Log Food - Boonz Nutriplanet</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<nav>
<div class="logo">🥗 Boonz Nutriplanet</div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="dashboard.html">Dashboard</a></li>
<li><a href="hydrate.html">Hydration</a></li>
<li><a href="track-food.html" class="active">Food Log</a></li>
<li><a href="meal-planner.html">Meal Planner</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</nav>
</header>
<main class="container">
<h1>Log Your Meals for Today</h1>
<p>Search for food or add items manually to track your intake.</p>
<div class="food-log-grid">
<!-- Add Food Form -->
<div class="card add-food-form">
<h2>Add Food Item</h2>
<form id="add-food-item-form">
<div class="form-group">
<label for="food-name">Food Name</label>
<input type="text" id="food-name" placeholder="e.g., Apple" required>
</div>
<div class="form-group">
<label for="calories">Calories (kcal)</label>
<input type="number" id="calories" placeholder="e.g., 95" required>
</div>
<div class="form-group">
<label for="meal-type">Add to Meal</label>
<select id="meal-type">
<option value="breakfast">Breakfast</option>
<option value="lunch">Lunch</option>
<option value="dinner">Dinner</option>
<option value="snacks">Snacks</option>
</select>
</div>
<button type="submit" class="btn">Add Food</button>
</form>
</div>
<!-- Daily Totals -->
<div class="card daily-totals">
<h2>Daily Totals</h2>
<div class="stat">
<span>🔥 Total Calories</span>
<strong id="total-calories">0 kcal</strong>
</div>
</div>
</div>
<!-- Meal Containers -->
<div class="meals-container">
<div class="card meal-card">
<h3>Breakfast</h3>
<ul id="breakfast-list">
<!-- Food items will be added here by JS -->
</ul>
</div>
<div class="card meal-card">
<h3>Lunch</h3>
<ul id="lunch-list"></ul>
</div>
<div class="card meal-card">
<h3>Dinner</h3>
<ul id="dinner-list"></ul>
</div>
<div class="card meal-card">
<h3>Snacks</h3>
<ul id="snacks-list"></ul>
</div>
</div>
</main>
<footer>
<p>© 2024 Boonz Nutriplanet. All rights reserved.</p>
</footer>
<script src="js/food-tracker.js"></script>
</body>
</html>
📄 meal-planner.html (NEW)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Meal Planner - Boonz Nutriplanet</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<nav>
<div class="logo">🥗 Boonz Nutriplanet</div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="dashboard.html">Dashboard</a></li>
<li><a href="hydrate.html">Hydration</a></li>
<li><a href="track-food.html">Food Log</a></li>
<li><a href="meal-planner.html" class="active">Meal Planner</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</nav>
</header>
<main class="container">
<h1>Your Weekly Meal Plan</h1>
<p>Plan your meals for the week ahead to stay on track.</p>
<button class="btn" style="margin-bottom: 2rem;">Generate Shopping List</button>
<div class="meal-planner-grid">
<!-- Day Columns -->
<div class="day-column">
<h2>Monday</h2>
<div class="meal-slot breakfast"><strong>B:</strong> Avocado Toast</div>
<div class="meal-slot lunch"><strong>L:</strong> Quinoa Salad</div>
<div class="meal-slot dinner"><strong>D:</strong> Chicken Stir-fry</div>
</div>
<div class="day-column">
<h2>Tuesday</h2>
<div class="meal-slot breakfast"><strong>B:</strong> Greek Yogurt</div>
<div class="meal-slot lunch"><strong>L:</strong> Lentil Soup</div>
<div class="meal-slot dinner"><strong>D:</strong> Baked Cod</div>
</div>
<div class="day-column">
<h2>Wednesday</h2>
<div class="meal-slot breakfast"><strong>B:</strong> Oatmeal</div>
<div class="meal-slot lunch"><strong>L:</strong> Leftover Stir-fry</div>
<div class="meal-slot dinner"><strong>D:</strong> Turkey Meatballs</div>
</div>
<div class="day-column">
<h2>Thursday</h2>
<div class="meal-slot breakfast"><strong>B:</strong> Smoothie</div>
<div class="meal-slot lunch"><strong>L:</strong> Chickpea Sandwich</div>
<div class="meal-slot dinner"><strong>D:</strong> Veggie Tacos</div>
</div>
<div class="day-column">
<h2>Friday</h2>
<div class="meal-slot breakfast"><strong>B:</strong> Scrambled Eggs</div>
<div class="meal-slot lunch"><strong>L:</strong> Leftover Tacos</div>
<div class="meal-slot dinner"><strong>D:</strong> Pizza Night</div>
</div>
<div class="day-column">
<h2>Saturday</h2>
<div class="meal-slot breakfast"><strong>B:</strong> Pancakes</div>
<div class="meal-slot lunch"><strong>L:</strong> Caesar Salad</div>
<div class="meal-slot dinner"><strong>D:</strong> Steak & Veggies</div>
</div>
<div class="day-column">
<h2>Sunday</h2>
<div class="meal-slot breakfast"><strong>B:</strong> French Toast</div>
<div class="meal-slot lunch"><strong>L:</strong> Leftover Steak</div>
<div class="meal-slot dinner"><strong>D:</strong> Roast Chicken</div>
</div>
</div>
<h2 style="margin-top: 3rem;">Recipe Ideas</h2>
<div class="recipe-ideas-grid">
<div class="card recipe-card">
<h4>Classic Chicken Stir-fry</h4>
<p>A quick, healthy, and flavorful weeknight dinner.</p>
<a href="#">View Recipe</a>
</div>
<div class="card recipe-card">
<h4>Hearty Lentil Soup</h4>
<p>Packed with fiber and protein to keep you full.</p>
<a href="#">View Recipe</a>
</div>
<div class="card recipe-card">
<h4>Zesty Quinoa Salad</h4>
<p>A refreshing and nutrient-dense lunch option.</p>
<a href="#">View Recipe</a>
</div>
</div>
</main>
<footer>
<p>© 2024 Boonz Nutriplanet. All rights reserved.</p>
</footer>
</body>
</html>
📄 blog.html (NEW)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blog - Boonz Nutriplanet</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<nav>
<div class="logo">🥗 Boonz Nutriplanet</div>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="dashboard.html">Dashboard</a></li>
<li><a href="hydrate.html">Hydration</a></li>
<li><a href="track-food.html">Food Log</a></li>
<li><a href="meal-planner.html">Meal Planner</a></li>
<li><a href="blog.html" class="active">Blog</a></li>
</ul>
</nav>
</header>
<main class="container">
<h1>Boonz Nutriplanet Blog</h1>
<p>Evidence-based articles to help you on your wellness journey.</p>
<div class="blog-grid">
<div class="card article-card">
<img src="https://via.placeholder.com/400x250/81C784/FFFFFF?text=Nutrition" alt="Article image">
<div class="article-content">
<h3>Understanding Macronutrients: Carbs, Protein, and Fat</h3>
<p>A deep dive into the building blocks of your diet and why they matter for your health goals...</p>
<a href="#" class="btn btn-secondary">Read More</a>
</div>
</div>
<div class="card article-card">
<img src="https://via.placeholder.com/400x250/2196F3/FFFFFF?text=Hydration" alt="Article image">
<div class="article-content">
<h3>Beyond 8 Glasses: How Much Water Do You Really Need?</h3>
<p>Debunking myths and providing a scientific look at your personal hydration needs based on lifestyle...</p>
<a href="#" class="btn btn-secondary">Read More</a>
</div>
</div>
<div class="card article-card">
<img src="https://via.placeholder.com/400x250/FFC107/FFFFFF?text=Mindfulness" alt="Article image">
<div class="article-content">
<h3>The Art of Mindful Eating: Reconnect with Your Food</h3>
<p>Learn techniques to combat emotional eating and develop a healthier relationship with your meals...</p>
<a href="#" class="btn btn-secondary">Read More</a>
</div>
</div>
<div class="card article-card">
<img src="https://via.placeholder.com/400x250/f44336/FFFFFF?text=Myth+Busting" alt="Article image">
<div class="article-content">
<h3>Nutrition Myth Busters: Is Gluten Really the Enemy?</h3>
<p>We tackle common nutrition myths with scientific evidence to help you make informed choices...</p>
<a href="#" class="btn btn-secondary">Read More</a>
</div>
</div>
</div>
</main>
<footer>
<p>© 2024 Boonz Nutriplanet. All rights reserved.</p>
</footer>
</body>
</html>
CSS File
📄 css/style.css (Fully Updated)
Save this as css/style.css, replacing the old content.
/* ===== GLOBAL & BASE STYLES ===== */
:root {
--primary-color: #4CAF50; /* Green */
--secondary-color: #FFC107; /* Yellow */
--accent-color: #2196F3; /* Blue */
--light-gray: #f9f9f9;
--dark-gray: #333;
--text-color: #333;
--white: #ffffff;
--border-color: #e0e0e0;
--shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
--border-radius: 10px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Open Sans', sans-serif;
background-color: var(--light-gray);
color: var(--text-color);
line-height: 1.6;
}
h1, h2, h3, h4 {
font-family: 'Poppins', sans-serif;
font-weight: 600;
line-height: 1.2;
}
.container {
max-width: 1200px;
margin: 2rem auto;
padding: 0 2rem;
}
.card {
background: var(--white);
padding: 1.5rem;
border-radius: var(--border-radius);
box-shadow: var(--shadow);
margin-bottom: 1rem;
}
/* ===== HEADER & NAVIGATION ===== */
header {
background: var(--primary-color);
color: var(--white);
padding: 1rem 2rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
nav {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-family: 'Poppins', sans-serif;
font-size: 1.5rem;
font-weight: 700;
}
nav ul {
display: flex;
list-style: none;
gap: 1.5rem;
}
nav ul li a {
color: var(--white);
text-decoration: none;
font-weight: 600;
padding-bottom: 5px;
transition: border-bottom 0.2s;
}
nav ul li a.active, nav ul li a:hover {
border-bottom: 2px solid var(--secondary-color);
}
/* ===== BUTTONS ===== */
.btn {
background: var(--accent-color);
color: var(--white);
padding: 0.7rem 1.5rem;
border: none;
border-radius: 5px;
font-weight: 600;
cursor: pointer;
text-decoration: none;
display: inline-block;
transition: background-color 0.3s;
}
.btn:hover { background: #1976D2; }
.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #5a6268; }
/* ===== FORMS & INPUTS ===== */
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: .5rem;
font-weight: 600;
}
.form-group input, .form-group select {
width: 100%;
padding: 0.7rem;
border: 1px solid var(--border-color);
border-radius: 5px;
}
/* ===== HERO SECTION (Homepage) ===== */
.hero {
text-align: center;
padding: 4rem 2rem;
background: linear-gradient(135deg, var(--primary-color), #81C784);
color: var(--white);
}
.hero h1 { font-size: 2.8rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; margin-bottom: 2rem; }
.features {
display: flex;
justify-content: center;
gap: 2rem;
padding: 3rem 2rem;
flex-wrap: wrap;
}
.feature-card { text-align: center; width: 300px; }
.feature-card h3 { color: var(--primary-color); margin-bottom: 1rem; }
/* ===== DASHBOARD ===== */
.dashboard-container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.summary-card .stat { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.macros { margin-top: 1.5rem; }
.macro-item { margin-bottom: 0.7rem; }
.macro-item .label { display: block; margin-bottom: 0.3rem; font-weight: 600; }
.macro-bar { height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden;}
.macro-bar div { height: 100%; border-radius: 4px; }
.carbs div { background-color: var(--secondary-color); }
.protein div { background-color: var(--primary-color); }
.fat div { background-color: var(--accent-color); }
.quick-actions-card .action-btn { display: block; margin-bottom: 1rem; text-align: center; }
.recent-meals-card ul { list-style-type: none; }
.recent-meals-card li { padding: .5rem 0; border-bottom: 1px solid var(--border-color); }
.recent-meals-card li:last-child { border-bottom: none; }
/* ===== HYDRATION TRACKER ===== */
.hydrate-section { max-width: 600px; margin: 3rem auto; text-align: center; }
.hydrate-goal input { padding: 0.5rem; margin-left: .5rem; width: 80px; border: 1px solid #ccc; border-radius: 5px;}
.water-progress { margin: 1.5rem 0; }
.progress-bar-container { width: 100%; height: 20px; background: var(--border-color); border-radius: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #2196F3, #90CAF9); width: 0%; transition: width 0.4s ease; }
.hydrate-actions { display: flex; justify-content: center; gap: 1rem; margin: 1.5rem 0; }
.reminder-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); text-align: left;}
.toggle-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; font-weight: 600;}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: relative; display: inline-block; width: 44px; height: 24px; background-color: #ccc; border-radius: 24px; transition: 0.4s; margin-right: 10px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: 0.4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(20px); }
.reminder-options { margin-top: 1rem; display: flex; align-items: center; gap: 1rem; }
/* ===== FOOD LOG ===== */
.food-log-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
.daily-totals { text-align: center; }
.daily-totals h2 { margin-bottom: 1.5rem; }
.meals-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.meal-card ul { list-style-type: none; margin-top: 1rem; }
.meal-card li { display: flex; justify-content: space-between; padding: .5rem; background: #fafafa; border-radius: 5px; margin-bottom: .5rem;}
.meal-card li button { background: none; border: none; color: #f44336; cursor: pointer; font-weight: bold; }
/* ===== MEAL PLANNER ===== */
.meal-planner-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1rem; }
.day-column { background: var(--white); padding: 1rem; border-radius: var(--border-radius); box-shadow: var(--shadow); }
.day-column h2 { text-align: center; margin-bottom: 1rem; font-size: 1.2rem; color: var(--primary-color); }
.meal-slot { background: #f0f8ff; padding: .75rem; border-radius: 5px; margin-bottom: .5rem; font-size: 0.9rem; }
.recipe-ideas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.recipe-card a { font-weight: bold; color: var(--accent-color); text-decoration: none; }
/* ===== BLOG ===== */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.article-card { display: flex; flex-direction: column; }
.article-card img { width: 100%; border-radius: var(--border-radius) var(--border-radius) 0 0; }
.article-content { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; }
.article-content h3 { margin-bottom: 1rem; }
.article-content p { margin-bottom: 1.5rem; flex-grow: 1; }
.article-content a { align-self: flex-start; }
/* ===== FOOTER ===== */
footer {
text-align: center;
padding: 1.5rem;
background: var(--dark-gray);
color: var(--white);
margin-top: 3rem;
}
/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 992px) {
.food-log-grid { grid-template-columns: 1fr; }
.meal-planner-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
}
@media (max-width: 768px) {
nav { flex-direction: column; gap: 1rem; }
nav ul { flex-wrap: wrap; justify-content: center; }
.dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
.meal-planner-grid { grid-template-columns: 1fr; }
nav ul { gap: 1rem; }
.hero h1 { font-size: 2.2rem; }
}
JavaScript Files
📄 js/hydrate-tracker.js (Updated)
document.addEventListener('DOMContentLoaded', () => {
// --- Elements ---
const goalInput = document.getElementById('water-goal');
const currentIntakeSpan = document.getElementById('current-intake');
const goalSpan = document.getElementById('goal');
const progressBar = document.getElementById('water-progress');
const addWaterBtn = document.getElementById('add-water-btn');
const removeWaterBtn = document.getElementById('remove-water-btn');
const startReminderBtn = document.getElementById('start-reminder-btn');
const reminderToggle = document.getElementById('reminder-toggle');
const reminderFrequency = document.getElementById('reminder-frequency');
// --- State ---
let currentCups = 0;
let goalCups = parseInt(goalInput.value);
let reminderInterval;
// --- Functions ---
const updateUI = () => {
currentIntakeSpan.textContent = currentCups;
goalSpan.textContent = goalCups;
const percentage = Math.min((currentCups / goalCups) * 100, 100);
progressBar.style.width = percentage + '%';
if (currentCups >= goalCups) {
progressBar.style.backgroundColor = 'var(--primary-color)';
} else {
progressBar.style.background = 'linear-gradient(90deg, #2196F3, #90CAF9)';
}
};
const addCup = () => {
currentCups++;
updateUI();
};
const removeCup = () => {
if (currentCups > 0) {
currentCups--;
updateUI();
}
};
const startReminders = () => {
if (reminderInterval) {
clearInterval(reminderInterval);
}
if (!reminderToggle.checked) {
alert('Please enable reminders first.');
return;
}
const freqMinutes = parseInt(reminderFrequency.value);
const freqMs = freqMinutes * 60 * 1000;
reminderInterval = setInterval(() => {
if (currentCups < goalCups) {
// In a real app, this would be a browser push notification
alert(`💧 Hydration Reminder!\nTime to drink some water. You're at ${currentCups}/${goalCups} cups.`);
} else {
clearInterval(reminderInterval); // Stop reminders if goal is met
}
}, freqMs);
alert(`✅ Reminders started! You'll get a notification every ${freqMinutes} minute(s).`);
};
// --- Event Listeners ---
goalInput.addEventListener('change', () => {
goalCups = parseInt(goalInput.value);
updateUI();
});
addWaterBtn.addEventListener('click', addCup);
removeWaterBtn.addEventListener('click', removeCup);
startReminderBtn.addEventListener('click', startReminders);
// --- Initial Load ---
updateUI();
});
📄 js/dashboard-chart.js (NEW)
document.addEventListener('DOMContentLoaded', () => {
const ctx = document.getElementById('weightChart');
if (ctx) {
new Chart(ctx, {
type: 'line',
data: {
labels: ['Week 1', 'Week 2', 'Week 3', 'Week 4', 'Week 5', 'Week 6'],
datasets: [{
label: 'Weight (kg)',
data: [85, 84.5, 84, 83, 82.5, 82], // Mock data
borderColor: '#4CAF50',
backgroundColor: 'rgba(76, 175, 80, 0.1)',
fill: true,
tension: 0.3
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: false
}
}
}
});
}
});
📄 js/food-tracker.js (NEW)
document.addEventListener('DOMContentLoaded', () => {
// --- Elements ---
const form = document.getElementById('add-food-item-form');
const totalCaloriesSpan = document.getElementById('total-calories');
// --- State ---
let totalCalories = 0;
// --- Function to add food to the list ---
const addFoodToList = (name, calories, mealType) => {
const list = document.getElementById(`${mealType}-list`);
if (!list) return;
// Create list item
const li = document.createElement('li');
li.innerHTML = `
<span>${name} (${calories} kcal)</span>
<button class="remove-btn" data-calories="${calories}">✖</button>
`;
list.appendChild(li);
// Update total calories
totalCalories += parseInt(calories);
totalCaloriesSpan.textContent = `${totalCalories} kcal`;
};
// --- Form submission ---
form.addEventListener('submit', (e) => {
e.preventDefault();
const foodName = document.getElementById('food-name').value;
const calories = document.getElementById('calories').value;
const mealType = document.getElementById('meal-type').value;
addFoodToList(foodName, calories, mealType);
// Reset the form
form.reset();
});
// --- Event delegation for remove buttons ---
document.querySelector('.meals-container').addEventListener('click', (e) => {
if (e.target.classList.contains('remove-btn')) {
const item = e.target.parentElement;
const caloriesToRemove = parseInt(e.target.dataset.calories);
// Update total calories
totalCalories -= caloriesToRemove;
totalCaloriesSpan.textContent = `${totalCalories} kcal`;
// Remove item from DOM
item.remove();
}
});
});