38873-vm/notifications.php
Flatlogic Bot 3575e4a095 v70
2026-02-28 23:27:55 +00:00

132 lines
7.3 KiB
PHP

<?php
require_once 'db/config.php';
session_start();
$user_id = $_SESSION['user_id'] ?? null;
if (!$user_id) { header('Location: login.php'); exit; }
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
if (!$user) { header('Location: login.php'); exit; }
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
if (isset($_POST['mark_read'])) {
$stmt = db()->prepare("UPDATE notifications SET is_read = 1 WHERE user_id = ?");
$stmt->execute([$user_id]);
}
$stmt = db()->prepare("SELECT * FROM notifications WHERE user_id = ? ORDER BY created_at DESC");
$stmt->execute([$user_id]);
$notifications = $stmt->fetchAll();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Notifications — <?= htmlspecialchars($platformName) ?></title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&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">
</head>
<body>
<header>
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
<a href="dashboard.php" class="logo-container">
<img src="assets/images/logo.svg?v=<?php echo time(); ?>" 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>
<a href="partners.php">Find Partners</a>
<?php else: ?>
<a href="funding_rounds.php">Founding Rounds</a>
<a href="portfolio.php">Portfolio</a>
<a href="discover.php">Discovery Hub</a>
<?php endif; ?>
<a href="messages.php">Messages</a>
</nav>
<div style="display: flex; align-items: center; gap: 15px;">
<a href="notifications.php" style="color: #fff; position: relative; font-size: 18px;">
<i class="fas fa-bell"></i>
</a>
<div style="display: flex; align-items: center; gap: 10px; padding: 5px 12px; background: rgba(255,255,255,0.05); border-radius: 50px; border: 1px solid var(--border-color);">
<div style="width: 24px; height: 24px; background: var(--gradient-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; font-weight: 800;">
<?= substr($user['full_name'], 0, 1) ?>
</div>
<span style="font-size: 13px; font-weight: 600;"><?= htmlspecialchars(explode(' ', $user['full_name'])[0]) ?></span>
</div>
<a href="logout.php" class="btn btn-secondary" style="padding: 8px 16px; font-size: 12px; border-radius: 10px;">Log Out</a>
</div>
</div>
</header>
<main class="container" style="padding-top: 50px; padding-bottom: 80px;">
<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>Activity Center</h1>
<p style="color: var(--text-secondary);">Stay updated with your latest matches and investments.</p>
</div>
<?php if (!empty($notifications)): ?>
<form method="POST">
<button type="submit" name="mark_read" class="btn btn-outline" style="font-size: 13px; border-radius: 50px;">Mark all as read</button>
</form>
<?php endif; ?>
</div>
<div class="card" style="padding: 0; overflow: hidden; border-color: var(--border-color);">
<?php if (empty($notifications)): ?>
<div style="text-align: center; padding: 100px 20px;">
<div style="width: 100px; height: 100px; background: var(--surface-color); border-radius: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 40px; margin-bottom: 30px; border: 1px solid var(--border-color);">
<i class="fas fa-bell-slash" style="opacity: 0.1; color: var(--accent-blue);"></i>
</div>
<h3>All quiet for now</h3>
<p style="color: var(--text-secondary); max-width: 300px; margin: 0 auto 30px;">We'll notify you when you get a new match or investment.</p>
<a href="discover.php" class="btn btn-primary">Browse Ecosystem</a>
</div>
<?php else: ?>
<div style="display: flex; flex-direction: column;">
<?php foreach ($notifications as $n): ?>
<div style="padding: 25px 30px; border-bottom: 1px solid var(--border-color); display: flex; align-items: flex-start; gap: 20px; transition: all 0.2s; <?= $n['is_read'] ? 'opacity: 0.5;' : 'background: rgba(0, 242, 255, 0.04);' ?>">
<div style="width: 48px; height: 48px; border-radius: 14px; background: <?= $n['is_read'] ? 'var(--surface-color)' : 'var(--gradient-primary)' ?>; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; font-size: 18px;">
<i class="fas <?= strpos($n['content'], 'match') !== false ? 'fa-heart' : (strpos($n['content'], 'invest') !== false ? 'fa-coins' : 'fa-bolt') ?>"></i>
</div>
<div style="flex: 1;">
<div style="margin: 0; font-size: 16px; color: #fff; font-weight: <?= $n['is_read'] ? '500' : '700' ?>; line-height: 1.4;">
<?= htmlspecialchars($n['content']) ?>
</div>
<div style="font-size: 12px; color: var(--text-secondary); margin-top: 10px; display: flex; align-items: center; gap: 6px;">
<i class="fas fa-clock" style="font-size: 10px;"></i>
<?= date('M d, Y • H:i', strtotime($n['created_at'])) ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</main>
<footer style="margin-top: 80px; padding: 60px 0; border-top: 1px solid var(--border-color); background: rgba(0,0,0,0.2);">
<div class="container" style="text-align: center;">
<div class="logo-container" style="justify-content: center; margin-bottom: 25px;">
<img src="assets/images/logo.svg?v=<?php echo time(); ?>" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img" style="width: 30px; height: 30px;">
<span class="logo-text" style="font-size: 20px;"><?= htmlspecialchars($platformName) ?></span>
</div>
<p style="color: var(--text-secondary); font-size: 14px;">&copy; <?= date('Y') ?> <?= htmlspecialchars($platformName) ?>. All rights reserved.</p>
</div>
</footer>
<script src="assets/js/main.js"></script>
</body>
</html>