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="discover.php">Find Partners</a>
<?php else: ?>
<a href="discover.php">Discovery</a>
<a href="startups.php">Browse Startups</a>
<a href="portfolio.php">Portfolio</a>
<?php endif; ?>
@ -206,13 +207,13 @@ function number_get_formatted($num) {
<?php endif; ?>
</div>
<?php if ($user['role'] === 'founder'): ?>
<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>
<p style="font-size: 14px; opacity: 0.9; margin-bottom: 20px;">Ready to find your perfect co-founder? Start swiping through profiles.</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;">Start Matching</a>
<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;">
<?= $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>
<?php endif; ?>
<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>
@ -248,4 +249,4 @@ function number_get_formatted($num) {
</style>
</body>
</html>
</html>

View File

@ -1,26 +1,28 @@
<?php
session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'founder') {
header("Location: dashboard.php");
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once __DIR__ . '/db/config.php';
// Check if onboarding is completed
$stmt = db()->prepare("SELECT onboarding_completed FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$current_user_id = $_SESSION['user_id'];
$user_role = $_SESSION['role'];
if (!$user['onboarding_completed']) {
header("Location: founder_onboarding.php");
exit;
// 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");
exit;
}
}
$current_user_id = $_SESSION['user_id'];
// Handle Swipe via AJAX/POST
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe') {
// Handle Swipe via AJAX/POST (only for founders)
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe' && $user_role === 'founder') {
$swiped_id = (int)$_POST['swiped_id'];
$direction = $_POST['direction']; // 'like' or 'dislike'
@ -53,17 +55,48 @@ 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("
SELECT * FROM users
WHERE role = 'founder'
AND id != ?
AND onboarding_completed = 1
AND id NOT IN (SELECT swiped_id FROM swipes WHERE swiper_id = ?)
LIMIT 10
");
$stmt->execute([$current_user_id, $current_user_id]);
$founders = $stmt->fetchAll();
}
// Leaderboard: Most Followed This Week
$stmt = db()->prepare("
SELECT * FROM users
WHERE role = 'founder'
AND id != ?
AND onboarding_completed = 1
AND id NOT IN (SELECT swiped_id FROM swipes WHERE swiper_id = ?)
LIMIT 10
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([$current_user_id, $current_user_id]);
$founders = $stmt->fetchAll();
$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';
?>
@ -152,6 +185,65 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
text-align: center;
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>
</head>
<body>
@ -160,8 +252,12 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
<nav>
<a href="dashboard.php"><i class="fas fa-home"></i> Dashboard</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 if ($user_role === 'founder'): ?>
<a href="discover.php" class="active"><i class="fas fa-search"></i> Partner Matching</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="messages.php"><i class="fas fa-comment"></i> Messages</a>
<a href="notifications.php"><i class="fas fa-bell"></i> Notifications</a>
@ -173,47 +269,96 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<div class="main-content">
<div class="header">
<h1>Partner Matching</h1>
<h1><?= $user_role === 'founder' ? 'Partner Matching' : 'Discovery Hub' ?></h1>
<div class="user-profile">
<span><?= htmlspecialchars($_SESSION['full_name']) ?></span>
<div class="avatar"><?= strtoupper(substr($_SESSION['full_name'], 0, 1)) ?></div>
</div>
</div>
<div class="discover-container" id="card-stack">
<?php if (empty($founders)): ?>
<div style="text-align: center; color: var(--text-secondary);">
<i class="fas fa-user-friends" style="font-size: 48px; margin-bottom: 20px;"></i>
<p>No more founders found for now.<br>Check back later!</p>
</div>
<?php else: ?>
<?php foreach (array_reverse($founders) as $f): ?>
<div class="swipe-card" data-id="<?= $f['id'] ?>">
<div class="card-img"><i class="fas fa-user"></i></div>
<div class="card-body">
<div class="card-name"><?= htmlspecialchars($f['full_name']) ?></div>
<div class="card-meta"><?= htmlspecialchars($f['university']) ?> • <?= htmlspecialchars($f['degree_program']) ?> '<?= substr($f['graduation_year'], -2) ?></div>
<div class="card-tags">
<?php
$skills = explode(',', $f['skills']);
foreach (array_slice($skills, 0, 3) as $skill):
?>
<span class="tag"><?= htmlspecialchars(trim($skill)) ?></span>
<?php endforeach; ?>
</div>
<div class="card-bio"><?= htmlspecialchars($f['bio']) ?></div>
<div style="margin-top: 15px; font-size: 12px; color: var(--accent-blue);">
<i class="fas fa-bolt"></i> Interested in: <?= htmlspecialchars($f['startup_industries']) ?>
<?php if ($user_role === 'founder'): ?>
<div class="discover-container" id="card-stack">
<?php if (empty($founders)): ?>
<div style="text-align: center; color: var(--text-secondary);">
<i class="fas fa-user-friends" style="font-size: 48px; margin-bottom: 20px;"></i>
<p>No more founders found for now.<br>Check back later!</p>
</div>
<?php else: ?>
<?php foreach (array_reverse($founders) as $f): ?>
<div class="swipe-card" data-id="<?= $f['id'] ?>">
<div class="card-img"><i class="fas fa-user"></i></div>
<div class="card-body">
<div class="card-name"><?= htmlspecialchars($f['full_name']) ?></div>
<div class="card-meta"><?= htmlspecialchars($f['university']) ?> • <?= htmlspecialchars($f['degree_program']) ?> '<?= substr($f['graduation_year'], -2) ?></div>
<div class="card-tags">
<?php
$skills = explode(',', $f['skills']);
foreach (array_slice($skills, 0, 3) as $skill):
?>
<span class="tag"><?= htmlspecialchars(trim($skill)) ?></span>
<?php endforeach; ?>
</div>
<div class="card-bio"><?= htmlspecialchars($f['bio']) ?></div>
<div style="margin-top: 15px; font-size: 12px; color: var(--accent-blue);">
<i class="fas fa-bolt"></i> Interested in: <?= htmlspecialchars($f['startup_industries']) ?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
<div class="swipe-actions">
<button class="swipe-btn btn-dislike" onclick="swipe('dislike')"><i class="fas fa-times"></i></button>
<button class="swipe-btn btn-like" onclick="swipe('like')"><i class="fas fa-heart"></i></button>
<div class="swipe-actions">
<button class="swipe-btn btn-dislike" onclick="swipe('dislike')"><i class="fas fa-times"></i></button>
<button class="swipe-btn btn-like" onclick="swipe('like')"><i class="fas fa-heart"></i></button>
</div>
<?php endif; ?>
</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 endif; ?>
<?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>

View File

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