This commit is contained in:
Flatlogic Bot 2026-02-28 17:04:46 +00:00
parent 3b76e4ec5b
commit 00a4b21825
3 changed files with 209 additions and 62 deletions

View File

@ -77,6 +77,7 @@ function number_get_formatted($num) {
<a href="startups.php">My Startups</a> <a href="startups.php">My Startups</a>
<a href="discover.php">Find Partners</a> <a href="discover.php">Find Partners</a>
<?php else: ?> <?php else: ?>
<a href="discover.php">Discovery</a>
<a href="startups.php">Browse Startups</a> <a href="startups.php">Browse Startups</a>
<a href="portfolio.php">Portfolio</a> <a href="portfolio.php">Portfolio</a>
<?php endif; ?> <?php endif; ?>
@ -206,13 +207,13 @@ function number_get_formatted($num) {
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if ($user['role'] === 'founder'): ?>
<div class="card" style="background: var(--gradient-primary); color: #fff; border: none; margin-bottom: 30px;"> <div class="card" style="background: var(--gradient-primary); color: #fff; border: none; margin-bottom: 30px;">
<h3 style="color: #fff; margin-bottom: 10px;">Find Partners</h3> <h3 style="color: #fff; margin-bottom: 10px;"><?= $user['role'] === 'founder' ? 'Find Partners' : 'Trending Startups' ?></h3>
<p style="font-size: 14px; opacity: 0.9; margin-bottom: 20px;">Ready to find your perfect co-founder? Start swiping through profiles.</p> <p style="font-size: 14px; opacity: 0.9; margin-bottom: 20px;">
<a href="discover.php" class="btn" style="width: 100%; background: #fff; color: var(--accent-blue); font-weight: 700; text-align: center; display: block; text-decoration: none;">Start Matching</a> <?= $user['role'] === 'founder' ? 'Ready to find your perfect co-founder? Start swiping through profiles.' : 'Check out the most followed and funded startups this week!' ?>
</p>
<a href="discover.php" class="btn" style="width: 100%; background: #fff; color: var(--accent-blue); font-weight: 700; text-align: center; display: block; text-decoration: none;">Explore Discovery Hub</a>
</div> </div>
<?php endif; ?>
<div class="card" style="background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--border-color);"> <div class="card" style="background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--border-color);">
<h3 style="color: #fff; margin-bottom: 10px;">Gatsby Pro</h3> <h3 style="color: #fff; margin-bottom: 10px;">Gatsby Pro</h3>

View File

@ -1,26 +1,28 @@
<?php <?php
session_start(); session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'founder') { if (!isset($_SESSION['user_id'])) {
header("Location: dashboard.php"); header("Location: login.php");
exit; exit;
} }
require_once __DIR__ . '/db/config.php'; require_once __DIR__ . '/db/config.php';
// Check if onboarding is completed $current_user_id = $_SESSION['user_id'];
$stmt = db()->prepare("SELECT onboarding_completed FROM users WHERE id = ?"); $user_role = $_SESSION['role'];
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
if (!$user['onboarding_completed']) { // Check if onboarding is completed (for founders)
if ($user_role === 'founder') {
$stmt = db()->prepare("SELECT onboarding_completed FROM users WHERE id = ?");
$stmt->execute([$current_user_id]);
$user_onboard = $stmt->fetch();
if (!$user_onboard['onboarding_completed']) {
header("Location: founder_onboarding.php"); header("Location: founder_onboarding.php");
exit; exit;
} }
}
$current_user_id = $_SESSION['user_id']; // Handle Swipe via AJAX/POST (only for founders)
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe' && $user_role === 'founder') {
// Handle Swipe via AJAX/POST
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe') {
$swiped_id = (int)$_POST['swiped_id']; $swiped_id = (int)$_POST['swiped_id'];
$direction = $_POST['direction']; // 'like' or 'dislike' $direction = $_POST['direction']; // 'like' or 'dislike'
@ -53,7 +55,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
} }
} }
// Fetch founders to swipe on // Fetch founders to swipe on (if founder)
$founders = [];
if ($user_role === 'founder') {
$stmt = db()->prepare(" $stmt = db()->prepare("
SELECT * FROM users SELECT * FROM users
WHERE role = 'founder' WHERE role = 'founder'
@ -64,6 +68,35 @@ $stmt = db()->prepare("
"); ");
$stmt->execute([$current_user_id, $current_user_id]); $stmt->execute([$current_user_id, $current_user_id]);
$founders = $stmt->fetchAll(); $founders = $stmt->fetchAll();
}
// Leaderboard: Most Followed This Week
$stmt = db()->prepare("
SELECT s.id, s.name, u.full_name as founder_name, COUNT(sf.id) as followers_count
FROM startups s
JOIN users u ON s.founder_id = u.id
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 followers_count DESC
LIMIT 5
");
$stmt->execute();
$mostFollowed = $stmt->fetchAll();
// Leaderboard: Most Funded This Week
$stmt = db()->prepare("
SELECT s.id, s.name, u.full_name as founder_name, SUM(i.amount) as funded_amount
FROM startups s
JOIN users u ON s.founder_id = u.id
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 funded_amount DESC
LIMIT 5
");
$stmt->execute();
$mostFunded = $stmt->fetchAll();
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
?> ?>
@ -152,6 +185,65 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
text-align: center; text-align: center;
flex-direction: column; flex-direction: column;
} }
/* Leaderboard Styling */
.leaderboard-section {
margin-top: 50px;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
}
@media (max-width: 900px) {
.leaderboard-section { grid-template-columns: 1fr; }
}
.leaderboard-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 20px;
padding: 25px;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.leaderboard-title {
font-size: 20px;
font-weight: 700;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}
.leaderboard-item {
display: flex;
align-items: center;
gap: 15px;
padding: 12px 0;
border-bottom: 1px solid rgba(255,255,255,0.05);
transition: transform 0.2s;
cursor: pointer;
text-decoration: none;
color: inherit;
}
.leaderboard-item:hover { transform: translateX(5px); }
.leaderboard-item:last-child { border-bottom: none; }
.rank {
width: 30px;
height: 30px;
border-radius: 50%;
background: rgba(255,255,255,0.05);
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 700;
color: var(--accent-blue);
}
.rank-1 { background: gold; color: #000; }
.rank-2 { background: silver; color: #000; }
.rank-3 { background: #cd7f32; color: #000; }
.item-info { flex-grow: 1; }
.item-name { font-weight: 600; font-size: 15px; }
.item-meta { font-size: 12px; color: var(--text-secondary); }
.item-stat { font-weight: 700; font-size: 14px; color: var(--accent-blue); }
</style> </style>
</head> </head>
<body> <body>
@ -160,8 +252,12 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<div class="logo"><?= htmlspecialchars($platformName) ?></div> <div class="logo"><?= htmlspecialchars($platformName) ?></div>
<nav> <nav>
<a href="dashboard.php"><i class="fas fa-home"></i> Dashboard</a> <a href="dashboard.php"><i class="fas fa-home"></i> Dashboard</a>
<?php if ($user_role === 'founder'): ?>
<a href="discover.php" class="active"><i class="fas fa-search"></i> Partner Matching</a> <a href="discover.php" class="active"><i class="fas fa-search"></i> Partner Matching</a>
<a href="startups.php"><i class="fas fa-rocket"></i> My Startups</a> <?php else: ?>
<a href="discover.php" class="active"><i class="fas fa-search"></i> Discovery</a>
<?php endif; ?>
<a href="startups.php"><i class="fas fa-rocket"></i> <?= $user_role === 'founder' ? 'My Startups' : 'Browse Startups' ?></a>
<a href="portfolio.php"><i class="fas fa-chart-line"></i> Portfolio</a> <a href="portfolio.php"><i class="fas fa-chart-line"></i> Portfolio</a>
<a href="messages.php"><i class="fas fa-comment"></i> Messages</a> <a href="messages.php"><i class="fas fa-comment"></i> Messages</a>
<a href="notifications.php"><i class="fas fa-bell"></i> Notifications</a> <a href="notifications.php"><i class="fas fa-bell"></i> Notifications</a>
@ -173,13 +269,14 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<div class="main-content"> <div class="main-content">
<div class="header"> <div class="header">
<h1>Partner Matching</h1> <h1><?= $user_role === 'founder' ? 'Partner Matching' : 'Discovery Hub' ?></h1>
<div class="user-profile"> <div class="user-profile">
<span><?= htmlspecialchars($_SESSION['full_name']) ?></span> <span><?= htmlspecialchars($_SESSION['full_name']) ?></span>
<div class="avatar"><?= strtoupper(substr($_SESSION['full_name'], 0, 1)) ?></div> <div class="avatar"><?= strtoupper(substr($_SESSION['full_name'], 0, 1)) ?></div>
</div> </div>
</div> </div>
<?php if ($user_role === 'founder'): ?>
<div class="discover-container" id="card-stack"> <div class="discover-container" id="card-stack">
<?php if (empty($founders)): ?> <?php if (empty($founders)): ?>
<div style="text-align: center; color: var(--text-secondary);"> <div style="text-align: center; color: var(--text-secondary);">
@ -215,6 +312,54 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?>
<!-- Leaderboards -->
<div class="leaderboard-section">
<!-- Most Followed -->
<div class="leaderboard-card">
<div class="leaderboard-title">
<i class="fas fa-users" style="color: var(--accent-blue);"></i>
Most Followed This Week
</div>
<?php if (empty($mostFollowed)): ?>
<p style="color: var(--text-secondary); font-size: 14px;">No data for this week yet.</p>
<?php else: ?>
<?php foreach ($mostFollowed as $index => $item): ?>
<a href="startup_details.php?id=<?= $item['id'] ?>" class="leaderboard-item">
<div class="rank rank-<?= $index + 1 ?>"><?= $index + 1 ?></div>
<div class="item-info">
<div class="item-name"><?= htmlspecialchars($item['name']) ?></div>
<div class="item-meta">by <?= htmlspecialchars($item['founder_name']) ?></div>
</div>
<div class="item-stat"><?= number_format($item['followers_count']) ?> <i class="fas fa-heart" style="font-size: 10px; opacity: 0.7;"></i></div>
</a>
<?php endforeach; ?>
<?php endif; ?>
</div>
<!-- Most Funded -->
<div class="leaderboard-card">
<div class="leaderboard-title">
<i class="fas fa-chart-line" style="color: #2ecc71;"></i>
Most Funded This Week
</div>
<?php if (empty($mostFunded)): ?>
<p style="color: var(--text-secondary); font-size: 14px;">No investments this week yet.</p>
<?php else: ?>
<?php foreach ($mostFunded as $index => $item): ?>
<a href="startup_details.php?id=<?= $item['id'] ?>" class="leaderboard-item">
<div class="rank rank-<?= $index + 1 ?>"><?= $index + 1 ?></div>
<div class="item-info">
<div class="item-name"><?= htmlspecialchars($item['name']) ?></div>
<div class="item-meta">by <?= htmlspecialchars($item['founder_name']) ?></div>
</div>
<div class="item-stat">£<?= number_format($item['funded_amount']) ?></div>
</a>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</div> </div>
<div id="match-modal"> <div id="match-modal">

View File

@ -58,6 +58,7 @@ if ($user['role'] === 'founder') {
<a href="startups.php" class="active">My Startups</a> <a href="startups.php" class="active">My Startups</a>
<a href="discover.php">Find Partners</a> <a href="discover.php">Find Partners</a>
<?php else: ?> <?php else: ?>
<a href="discover.php">Discovery</a>
<a href="startups.php" class="active">Browse Startups</a> <a href="startups.php" class="active">Browse Startups</a>
<a href="portfolio.php">Portfolio</a> <a href="portfolio.php">Portfolio</a>
<?php endif; ?> <?php endif; ?>