This commit is contained in:
Flatlogic Bot 2026-02-28 17:07:33 +00:00
parent 00a4b21825
commit 0ddffbfe31
2 changed files with 117 additions and 2 deletions

View File

@ -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) {
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.trending-pill {
background: linear-gradient(45deg, #FFD700, #FFA500);
color: #000;
padding: 2px 8px;
border-radius: 4px;
font-size: 10px;
font-weight: 800;
text-transform: uppercase;
display: inline-flex;
align-items: center;
gap: 3px;
margin-left: 8px;
vertical-align: middle;
}
</style>
</head>
<body>
@ -115,10 +162,16 @@ function number_get_formatted($num) {
<?php foreach ($myStartups as $startup):
$goal = $startup['active_goal'] ?? $startup['funding_target'];
$raised = $startup['active_raised'] ?? $startup['funding_raised'];
$isTrending = in_array($startup['id'], $trendingIds);
?>
<div style="padding: 20px; background: var(--surface-color); border-radius: 16px; border: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; transition: all 0.2s; cursor: pointer;" onclick="window.location.href='startup_details.php?id=<?= $startup['id'] ?>'">
<div>
<div style="font-weight: 600; font-size: 18px; margin-bottom: 4px;"><?= htmlspecialchars($startup['name']) ?></div>
<div style="font-weight: 600; font-size: 18px; margin-bottom: 4px;">
<?= htmlspecialchars($startup['name']) ?>
<?php if ($isTrending): ?>
<span class="trending-pill"><i class="fas fa-fire"></i> Trending</span>
<?php endif; ?>
</div>
<div style="font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 10px;">
<span style="padding: 2px 8px; background: rgba(0, 122, 255, 0.1); color: var(--accent-blue); border-radius: 4px; font-weight: 600;">
<?= $startup['round_status'] === 'Active' ? 'ROUND ACTIVE' : 'NO ACTIVE ROUND' ?>

View File

@ -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') {
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.trending-badge {
position: absolute;
top: -10px;
right: -10px;
background: linear-gradient(45deg, #FFD700, #FFA500);
color: #000;
padding: 5px 12px;
border-radius: 20px;
font-size: 11px;
font-weight: 800;
text-transform: uppercase;
box-shadow: 0 4px 10px rgba(255, 165, 0, 0.4);
display: flex;
align-items: center;
gap: 5px;
z-index: 10;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
</style>
</head>
<body>
@ -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);
?>
<div class="card">
<div class="card" style="position: relative;">
<?php if ($isTrending): ?>
<div class="trending-badge">
<i class="fas fa-fire"></i> Trending
</div>
<?php endif; ?>
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px;">
<div>
<h3 style="margin: 0;"><?= htmlspecialchars($startup['name']) ?></h3>