v20
This commit is contained in:
parent
c312777c3a
commit
3abb7cc4ae
@ -32,15 +32,14 @@ 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)
|
||||
// Identify Trending Startups (Top 3 in followers or funding)
|
||||
$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)
|
||||
LEFT JOIN startup_followers sf ON s.id = sf.startup_id
|
||||
GROUP BY s.id
|
||||
ORDER BY COUNT(sf.id) DESC
|
||||
LIMIT 3
|
||||
@ -49,14 +48,11 @@ $stmt->execute();
|
||||
$topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$trendingIds = array_merge($trendingIds, $topFollowed);
|
||||
|
||||
// Top 3 Funded
|
||||
// Top 3 Funded (Total)
|
||||
$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
|
||||
SELECT id
|
||||
FROM startups
|
||||
ORDER BY funding_raised DESC
|
||||
LIMIT 3
|
||||
");
|
||||
$stmt->execute();
|
||||
|
||||
23
discover.php
23
discover.php
@ -32,14 +32,13 @@ $blocked_by_ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$all_blocked = array_unique(array_merge($blocked_ids, $blocked_by_ids));
|
||||
$placeholders = empty($all_blocked) ? "0" : implode(',', array_fill(0, count($all_blocked), '?'));
|
||||
|
||||
// Leaderboard: Most Followed This Week
|
||||
// Leaderboard: Most Followed (All Time)
|
||||
$sql = "
|
||||
SELECT s.id, s.name, s.description, 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)
|
||||
AND u.id NOT IN ($placeholders)
|
||||
LEFT JOIN startup_followers sf ON s.id = sf.startup_id
|
||||
WHERE u.id NOT IN ($placeholders)
|
||||
GROUP BY s.id
|
||||
ORDER BY followers_count DESC
|
||||
LIMIT 10
|
||||
@ -48,15 +47,12 @@ $stmt = db()->prepare($sql);
|
||||
$stmt->execute($all_blocked ?: []);
|
||||
$mostFollowed = $stmt->fetchAll();
|
||||
|
||||
// Leaderboard: Most Funded This Week
|
||||
// Leaderboard: Most Funded (All Time)
|
||||
$sql = "
|
||||
SELECT s.id, s.name, s.description, u.full_name as founder_name, SUM(i.amount) as funded_amount
|
||||
SELECT s.id, s.name, s.description, u.full_name as founder_name, s.funding_raised 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)
|
||||
AND u.id NOT IN ($placeholders)
|
||||
GROUP BY s.id
|
||||
WHERE u.id NOT IN ($placeholders)
|
||||
ORDER BY funded_amount DESC
|
||||
LIMIT 10
|
||||
";
|
||||
@ -120,7 +116,10 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
|
||||
<header>
|
||||
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
|
||||
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
|
||||
<a href="dashboard.php" class="logo-container">
|
||||
<img src="assets/images/logo.svg" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img">
|
||||
<span class="logo-text"><?= htmlspecialchars($platformName) ?></span>
|
||||
</a>
|
||||
<nav class="nav-links">
|
||||
<?php if ($user_role === 'founder'): ?>
|
||||
<a href="startups.php">My Startups</a>
|
||||
@ -153,7 +152,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
|
||||
<div class="leaderboard-grid">
|
||||
<div class="lb-card">
|
||||
<div class="lb-title"><i class="fas fa-heart" style="color: #ff3b30;"></i> Most Followed</div>
|
||||
<div class="lb-title"><i class="fas fa-heart" style="color: #ff3b30;"></i> Top Followed</div>
|
||||
<?php foreach ($mostFollowed as $i => $s): ?>
|
||||
<a href="startup_details.php?id=<?= $s['id'] ?>" class="lb-item">
|
||||
<div class="lb-rank rank-<?= $i+1 ?>"><?= $i+1 ?></div>
|
||||
|
||||
@ -39,66 +39,80 @@ foreach ($myInvestments as $inv) {
|
||||
|
||||
<header>
|
||||
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
|
||||
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
|
||||
<a href="dashboard.php" class="logo-container">
|
||||
<img src="assets/images/logo.svg" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img">
|
||||
<span class="logo-text"><?= htmlspecialchars($platformName) ?></span>
|
||||
</a>
|
||||
<nav class="nav-links">
|
||||
<a href="discover.php">Discover</a>
|
||||
<a href="startups.php">Browse Startups</a>
|
||||
<a href="portfolio.php" class="active">Portfolio</a>
|
||||
<a href="discover.php">Discovery Hub</a>
|
||||
<a href="messages.php">Messages</a>
|
||||
<a href="notifications.php">Notifications</a>
|
||||
</nav>
|
||||
<div style="display: flex; align-items: center; gap: 15px;">
|
||||
<a href="dashboard.php" style="color: var(--text-secondary);"><i class="fas fa-th-large"></i></a>
|
||||
<a href="logout.php" class="btn btn-secondary" style="padding: 8px 16px;">Log Out</a>
|
||||
<a href="logout.php" class="btn btn-secondary" style="padding: 8px 16px; font-size: 13px;">Log Out</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="container" style="padding-top: 50px;">
|
||||
<main class="container" style="padding-top: 50px; padding-bottom: 50px;">
|
||||
<div class="hero-bg">
|
||||
<div class="hero-blob" style="top: 10%; right: -10%;"></div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px;">
|
||||
<div>
|
||||
<h1>Investment Portfolio</h1>
|
||||
<p style="color: var(--text-secondary);">Manage your stakes in student-led startups.</p>
|
||||
</div>
|
||||
<div class="card" style="padding: 15px 30px; display: flex; align-items: center; gap: 20px;">
|
||||
<div class="card" style="padding: 20px 30px; display: flex; align-items: center; gap: 30px; border: 1px solid var(--border-color); background: var(--card-bg);">
|
||||
<div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary);">Total Invested</div>
|
||||
<div style="font-size: 24px; font-weight: 700; color: var(--accent-blue);">£<?= number_format($totalInvested, 0) ?></div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; letter-spacing: 1px; margin-bottom: 5px;">Total Invested</div>
|
||||
<div style="font-size: 28px; font-weight: 900; color: var(--accent-blue);">£<?= number_format($totalInvested, 0) ?></div>
|
||||
</div>
|
||||
<div style="width: 1px; height: 40px; background: var(--border-color);"></div>
|
||||
<div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary);">Startups</div>
|
||||
<div style="font-size: 24px; font-weight: 700; color: #fff;"><?= count($myInvestments) ?></div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; letter-spacing: 1px; margin-bottom: 5px;">Startups</div>
|
||||
<div style="font-size: 28px; font-weight: 900; color: #fff;"><?= count($myInvestments) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: grid; grid-template-columns: 1fr; gap: 20px;">
|
||||
<?php if (empty($myInvestments)): ?>
|
||||
<div class="card" style="text-align: center; padding: 60px 20px;">
|
||||
<div class="card" style="text-align: center; padding: 80px 20px; border: 1px dashed var(--border-color);">
|
||||
<i class="fas fa-chart-line" style="font-size: 64px; color: var(--accent-blue); opacity: 0.2; margin-bottom: 30px;"></i>
|
||||
<h3>No investments yet</h3>
|
||||
<p style="color: var(--text-secondary);">Start building your portfolio by discovering startups.</p>
|
||||
<p style="color: var(--text-secondary);">Start building your portfolio by discovering promising startups.</p>
|
||||
<a href="discover.php" class="btn btn-primary" style="margin-top: 25px;">Discover Startups</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($myInvestments as $inv): ?>
|
||||
<div class="card" style="display: flex; justify-content: space-between; align-items: center; padding: 25px;">
|
||||
<div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--accent-blue); margin-bottom: 5px;">Invested on <?= date('M d, Y', strtotime($inv['created_at'])) ?></div>
|
||||
<h3 style="margin-bottom: 5px;"><?= htmlspecialchars($inv['startup_name']) ?></h3>
|
||||
<p style="font-size: 14px; color: var(--text-secondary);"><?= htmlspecialchars(substr($inv['startup_desc'], 0, 80)) ?>...</p>
|
||||
</div>
|
||||
<div style="text-align: right; display: flex; align-items: center; gap: 40px;">
|
||||
<div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary);">Amount</div>
|
||||
<div style="font-size: 20px; font-weight: 700; color: #fff;">£<?= number_format($inv['amount'], 0) ?></div>
|
||||
<div class="card" style="display: flex; justify-content: space-between; align-items: center; padding: 30px; transition: all 0.3s;" onclick="location.href='startup_details.php?id=<?= $inv['startup_id'] ?>'" style="cursor: pointer;">
|
||||
<div style="display: flex; align-items: center; gap: 25px;">
|
||||
<div style="width: 60px; height: 60px; background: var(--gradient-primary); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; font-weight: 800;">
|
||||
<?= substr($inv['startup_name'], 0, 1) ?>
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary);">Status</div>
|
||||
<div style="font-weight: 600; color: <?= $inv['status'] === 'approved' ? '#55ff55' : ($inv['status'] === 'pending' ? '#ffaa00' : '#ff5555') ?>;">
|
||||
<?= ucfirst($inv['status']) ?>
|
||||
<div style="font-size: 11px; text-transform: uppercase; color: var(--accent-blue); margin-bottom: 5px; font-weight: 700;">Invested on <?= date('M d, Y', strtotime($inv['created_at'])) ?></div>
|
||||
<h3 style="margin-bottom: 5px; font-size: 22px; font-weight: 800;"><?= htmlspecialchars($inv['startup_name']) ?></h3>
|
||||
<p style="font-size: 14px; color: var(--text-secondary); margin: 0; opacity: 0.8;"><?= htmlspecialchars(substr($inv['startup_desc'], 0, 100)) ?>...</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: right; display: flex; align-items: center; gap: 50px;">
|
||||
<div>
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; letter-spacing: 1px; margin-bottom: 5px;">Amount</div>
|
||||
<div style="font-size: 22px; font-weight: 900; color: #fff;">£<?= number_format($inv['amount'], 0) ?></div>
|
||||
</div>
|
||||
<div style="min-width: 100px;">
|
||||
<div style="font-size: 10px; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; letter-spacing: 1px; margin-bottom: 5px;">Status</div>
|
||||
<div style="font-size: 13px; font-weight: 800; color: <?= $inv['status'] === 'approved' ? '#4cd964' : ($inv['status'] === 'pending' ? '#ffcc00' : '#ff3b30') ?>; letter-spacing: 1px;">
|
||||
<?= strtoupper($inv['status']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<a href="startup_details.php?id=<?= $inv['startup_id'] ?>" class="btn btn-secondary" style="padding: 10px 20px;">View Startup</a>
|
||||
<a href="startup_details.php?id=<?= $inv['startup_id'] ?>" class="btn btn-secondary" style="padding: 10px 20px; border-radius: 12px; font-size: 13px; font-weight: 700;">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
@ -106,5 +120,11 @@ foreach ($myInvestments as $inv) {
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
header { background: rgba(10, 10, 15, 0.8); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border-color); padding: 15px 0; position: sticky; top: 0; z-index: 1000; }
|
||||
.nav-links a { color: var(--text-secondary); text-decoration: none; margin: 0 15px; font-size: 14px; font-weight: 500; transition: color 0.2s; }
|
||||
.nav-links a:hover, .nav-links a.active { color: #fff; }
|
||||
</style>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@ -196,6 +196,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
|
||||
$stmt = db()->prepare("SELECT * FROM funding_rounds WHERE id = ?");
|
||||
$stmt->execute([$activeRound['id']]);
|
||||
$activeRound = $stmt->fetch();
|
||||
// Refresh startup data to get updated total funding_raised
|
||||
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ?");
|
||||
$stmt->execute([$startup_id]);
|
||||
$startup = $stmt->fetch();
|
||||
} catch (Exception $e) {
|
||||
db()->rollBack();
|
||||
$error = "Investment failed: " . $e->getMessage();
|
||||
@ -221,7 +225,10 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
|
||||
<header>
|
||||
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
|
||||
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
|
||||
<a href="dashboard.php" class="logo-container">
|
||||
<img src="assets/images/logo.svg" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img">
|
||||
<span class="logo-text"><?= htmlspecialchars($platformName) ?></span>
|
||||
</a>
|
||||
<nav class="nav-links">
|
||||
<?php if ($user['role'] === 'founder'): ?>
|
||||
<a href="startups.php">My Startups</a>
|
||||
@ -388,7 +395,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
<div>
|
||||
<section class="card" style="margin-bottom: 30px;">
|
||||
<h3 style="margin-top: 0; margin-bottom: 20px;">Venture Stats</h3>
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px;">
|
||||
<div style="background: rgba(255,255,255,0.02); padding: 15px; border-radius: 12px; text-align: center; border: 1px solid var(--border-color);">
|
||||
<div style="color: var(--text-secondary); font-size: 11px; text-transform: uppercase; margin-bottom: 5px; font-weight: 700;">Backers</div>
|
||||
<?php
|
||||
@ -408,6 +415,10 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
<div style="font-size: 20px; font-weight: 700;"><?= $followerCount ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background: var(--surface-color); padding: 20px; border-radius: 16px; border: 1px solid var(--border-color); text-align: center;">
|
||||
<div style="color: var(--text-secondary); font-size: 11px; text-transform: uppercase; margin-bottom: 5px; font-weight: 700;">Total Raised All-Time</div>
|
||||
<div style="font-size: 28px; font-weight: 900; color: #fff;">£<?= number_format($startup['funding_raised']) ?></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
@ -430,7 +441,8 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-weight: 600;"><?= htmlspecialchars($founder['full_name']) ?></div>
|
||||
<div style="font-size: 13px; color: var(--text-secondary);"><?= htmlspecialchars($founder['university']) ?></div>
|
||||
<div style="font-size: 13px; color: var(--text-secondary);">
|
||||
<?= htmlspecialchars($founder['university']) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="messages.php?chat_with=<?= $founder['id'] ?>&startup_id=<?= $startup_id ?>" class="btn btn-outline" style="width: 100%; text-align: center; display: block; border-radius: 12px; border: 1px solid var(--border-color);">Send Message</a>
|
||||
|
||||
23
startups.php
23
startups.php
@ -13,15 +13,14 @@ $user = $stmt->fetch();
|
||||
|
||||
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
|
||||
// Identify Trending Startups (Top 3 in followers or funding this week)
|
||||
// Identify Trending Startups (Top 3 in followers or funding)
|
||||
$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)
|
||||
LEFT JOIN startup_followers sf ON s.id = sf.startup_id
|
||||
GROUP BY s.id
|
||||
ORDER BY COUNT(sf.id) DESC
|
||||
LIMIT 3
|
||||
@ -30,14 +29,11 @@ $stmt->execute();
|
||||
$topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
$trendingIds = array_merge($trendingIds, $topFollowed);
|
||||
|
||||
// Top 3 Funded
|
||||
// Top 3 Funded (Total)
|
||||
$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
|
||||
SELECT id
|
||||
FROM startups
|
||||
ORDER BY funding_raised DESC
|
||||
LIMIT 3
|
||||
");
|
||||
$stmt->execute();
|
||||
@ -108,7 +104,10 @@ if ($user['role'] === 'founder') {
|
||||
|
||||
<header>
|
||||
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
|
||||
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
|
||||
<a href="dashboard.php" class="logo-container">
|
||||
<img src="assets/images/logo.svg" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img">
|
||||
<span class="logo-text"><?= htmlspecialchars($platformName) ?></span>
|
||||
</a>
|
||||
<nav class="nav-links">
|
||||
<?php if ($user['role'] === 'founder'): ?>
|
||||
<a href="startups.php" class="active">My Startups</a>
|
||||
@ -230,4 +229,4 @@ if ($user['role'] === 'founder') {
|
||||
</style>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user