diff --git a/dashboard.php b/dashboard.php
index 144d1f7..38beba0 100644
--- a/dashboard.php
+++ b/dashboard.php
@@ -32,6 +32,37 @@ if ($user['role'] === 'founder' && $user['onboarding_completed'] == 0) {
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
+// Identify Trending Startups (Top 3 in followers or funding this week)
+$trendingIds = [];
+
+// Top 3 Followed
+$stmt = db()->prepare("
+ SELECT s.id
+ FROM startups s
+ JOIN startup_followers sf ON s.id = sf.startup_id
+ WHERE sf.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+ GROUP BY s.id
+ ORDER BY COUNT(sf.id) DESC
+ LIMIT 3
+");
+$stmt->execute();
+$topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN);
+$trendingIds = array_merge($trendingIds, $topFollowed);
+
+// Top 3 Funded
+$stmt = db()->prepare("
+ SELECT s.id
+ FROM startups s
+ JOIN investments i ON s.id = i.startup_id
+ WHERE i.status = 'approved' AND i.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+ GROUP BY s.id
+ ORDER BY SUM(i.amount) DESC
+ LIMIT 3
+");
+$stmt->execute();
+$topFunded = $stmt->fetchAll(PDO::FETCH_COLUMN);
+$trendingIds = array_unique(array_merge($trendingIds, $topFunded));
+
// Fetch user's data based on role
$myStartups = [];
$myInvestments = [];
@@ -66,6 +97,22 @@ function number_get_formatted($num) {
+
@@ -115,10 +162,16 @@ function number_get_formatted($num) {
-
= htmlspecialchars($startup['name']) ?>
+
+ = htmlspecialchars($startup['name']) ?>
+
+ Trending
+
+
= $startup['round_status'] === 'Active' ? 'ROUND ACTIVE' : 'NO ACTIVE ROUND' ?>
diff --git a/startups.php b/startups.php
index 62f0dca..c8266ca 100644
--- a/startups.php
+++ b/startups.php
@@ -13,6 +13,37 @@ $user = $stmt->fetch();
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
+// Identify Trending Startups (Top 3 in followers or funding this week)
+$trendingIds = [];
+
+// Top 3 Followed
+$stmt = db()->prepare("
+ SELECT s.id
+ FROM startups s
+ JOIN startup_followers sf ON s.id = sf.startup_id
+ WHERE sf.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+ GROUP BY s.id
+ ORDER BY COUNT(sf.id) DESC
+ LIMIT 3
+");
+$stmt->execute();
+$topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN);
+$trendingIds = array_merge($trendingIds, $topFollowed);
+
+// Top 3 Funded
+$stmt = db()->prepare("
+ SELECT s.id
+ FROM startups s
+ JOIN investments i ON s.id = i.startup_id
+ WHERE i.status = 'approved' AND i.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+ GROUP BY s.id
+ ORDER BY SUM(i.amount) DESC
+ LIMIT 3
+");
+$stmt->execute();
+$topFunded = $stmt->fetchAll(PDO::FETCH_COLUMN);
+$trendingIds = array_unique(array_merge($trendingIds, $topFunded));
+
$myStartups = [];
if ($user['role'] === 'founder') {
$stmt = db()->prepare("
@@ -47,6 +78,31 @@ if ($user['role'] === 'founder') {
+
@@ -98,8 +154,14 @@ if ($user['role'] === 'founder') {
$goal = $startup['active_goal'] ?? $startup['funding_target'];
$raised = $startup['active_raised'] ?? $startup['funding_raised'];
$progress = round(($raised / ($goal ?: 1)) * 100);
+ $isTrending = in_array($startup['id'], $trendingIds);
?>
-
+
+
+
+ Trending
+
+
= htmlspecialchars($startup['name']) ?>