<?php
require 'inc/auth_check.php';
require 'inc/header.php';

// counts
$c1 = $mysqli->query("SELECT COUNT(*) AS c FROM projects")->fetch_assoc()['c'];
$c2 = $mysqli->query("SELECT COUNT(*) AS c FROM contacts")->fetch_assoc()['c'];
?>
<h1 class="text-2xl font-bold mb-4">Dashboard</h1>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
  <div class="p-4 bg-white shadow rounded">
    <h3 class="font-semibold">Projects</h3>
    <div class="text-3xl"><?php echo e($c1); ?></div>
    <a href="projects.php" class="text-sm text-teal-600">Manage</a>
  </div>
  <div class="p-4 bg-white shadow rounded">
    <h3 class="font-semibold">Contacts</h3>
    <div class="text-3xl"><?php echo e($c2); ?></div>
    <a href="#" class="text-sm text-teal-600">View</a>
  </div>
  <div class="p-4 bg-white shadow rounded">
    <h3 class="font-semibold">Hero / About</h3>
    <a href="hero_edit.php" class="text-sm text-teal-600">Edit Hero</a><br>
    <a href="about_edit.php" class="text-sm text-teal-600">Edit About</a>
  </div>
</div>

</div> <!-- container -->
</body>
</html>
