35900-vm/index.php
2025-11-21 12:22:08 +00:00

103 lines
4.9 KiB
PHP

<?php
declare(strict_types=1);
// Mock data for products. In a real app, this would come from a database.
$products = [
['id' => 1, 'name' => 'Avocado', 'calories' => 160, 'protein' => 2, 'carbs' => 9, 'fat' => 15],
['id' => 2, 'name' => 'Chicken Breast', 'calories' => 165, 'protein' => 31, 'carbs' => 0, 'fat' => 3.6],
['id' => 3, 'name' => 'Salmon Fillet', 'calories' => 208, 'protein' => 20, 'carbs' => 0, 'fat' => 13],
['id' => 4, 'name' => 'Brown Rice', 'calories' => 111, 'protein' => 2.6, 'carbs' => 23, 'fat' => 0.9],
['id' => 5, 'name' => 'Broccoli', 'calories' => 55, 'protein' => 3.7, 'carbs' => 11, 'fat' => 0.6],
['id' => 6, 'name' => 'Apple', 'calories' => 52, 'protein' => 0.3, 'carbs' => 14, 'fat' => 0.2],
['id' => 7, 'name' => 'Banana', 'calories' => 89, 'protein' => 1.1, 'carbs' => 23, 'fat' => 0.3],
['id' => 8, 'name' => 'Almonds', 'calories' => 579, 'protein' => 21, 'carbs' => 22, 'fat' => 49],
];
$projectName = $_SERVER['PROJECT_NAME'] ?? 'Calorie Tracker';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?= htmlspecialchars($projectName) ?></title>
<?php
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Track your daily calorie and nutrient intake.';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
<meta property="og:title" content="<?= htmlspecialchars($projectName) ?>" />
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<meta property="twitter:card" content="summary" />
<meta property="twitter:title" content="<?= htmlspecialchars($projectName) ?>" />
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php if ($projectImageUrl): ?>
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<div class="mobile-container">
<div class="background-gradient"></div>
<header class="app-header p-3 text-center">
<h1 class="h4 mb-0"><?= htmlspecialchars($projectName) ?></h1>
</header>
<main class="p-3">
<h2 class="h5 mb-3 text-white">Food Library</h2>
<div class="list-group">
<?php foreach ($products as $product): ?>
<?php
$imageUrl = 'https://picsum.photos/seed/' . $product['id'] . '/400/200';
// Note: The Pexels API integration can be used here for higher quality images.
// Example: $imageUrl = 'api/pexels.php?query=' . urlencode($product['name']);
?>
<div class="product-card mb-4" style="background-image: url('<?= $imageUrl ?>');">
<div class="card-overlay"></div>
<div class="card-content">
<h5 class="card-title"><?= htmlspecialchars($product['name']) ?></h5>
<p class="card-text"><?= (int)$product['calories'] ?> kcal</p>
<div class="d-flex gap-2 mt-2">
<span class="badge nutrient-badge">
Protein: <?= (float)$product['protein'] ?>g
</span>
<span class="badge nutrient-badge">
Carbs: <?= (float)$product['carbs'] ?>g
</span>
<span class="badge nutrient-badge">
Fat: <?= (float)$product['fat'] ?>g
</span>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</main>
<nav class="bottom-nav">
<a href="index.php" class="nav-item active">
<i class="bi bi-house-door-fill"></i>
<span>Home</span>
</a>
<a href="add_food.php" class="nav-item">
<i class="bi bi-plus-circle-fill"></i>
<span>Add Food</span>
</a>
<a href="dashboard.php" class="nav-item">
<i class="bi bi-bar-chart-line-fill"></i>
<span>Dashboard</span>
</a>
</nav>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>