This commit is contained in:
Flatlogic Bot 2026-02-28 23:45:11 +00:00
parent 4f94d39ce7
commit 3f9d35d276

View File

@ -40,6 +40,11 @@ if (!$isFounder && $startup['status'] === 'private' && !$isInvestor) {
die("You do not have permission to view this profile.");
}
// Check if following
$stmt = db()->prepare("SELECT 1 FROM startup_followers WHERE user_id = ? AND startup_id = ?");
$stmt->execute([$user_id, $startupId]);
$isFollowing = (bool)$stmt->fetch();
// Fetch funding history
$canSeeHistory = $isFounder || $isInvestor;
$fundingHistory = [];
@ -236,6 +241,33 @@ function getNextDividendInfo($createdAt) {
background-color: rgba(0,0,0,0.9);
backdrop-filter: blur(4px);
}
.follow-btn {
padding: 16px 24px;
border-radius: 999px;
font-weight: 800;
text-transform: uppercase;
font-size: 14px;
letter-spacing: 0.5px;
cursor: pointer;
transition: all 0.3s;
display: inline-flex;
align-items: center;
gap: 10px;
border: 1px solid var(--accent-primary);
}
.follow-btn.following {
background: var(--accent-primary);
color: #000;
}
.follow-btn.not-following {
background: transparent;
color: var(--accent-primary);
}
.follow-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(0, 255, 128, 0.2);
}
</style>
</head>
<body style="background: var(--bg-color); color: var(--text-primary);">
@ -293,6 +325,9 @@ function getNextDividendInfo($createdAt) {
<span style="color: var(--text-secondary); font-size: 13px;">
<i class="fas fa-map-marker-alt"></i> <?= htmlspecialchars($startup['country']) ?>
</span>
<span style="color: var(--text-secondary); font-size: 13px;">
<i class="fas fa-users"></i> <span id="follower-count"><?= number_format($startup['followers_count']) ?></span> Followers
</span>
</div>
<h1 style="font-size: 48px; font-weight: 900; margin: 0; line-height: 1.1; letter-spacing: -1px;">
<?= htmlspecialchars($startup['name']) ?>
@ -302,20 +337,27 @@ function getNextDividendInfo($createdAt) {
</p>
</div>
<?php if ($isInvestor): ?>
<div style="display: flex; gap: 15px;">
<a href="messages.php?chat_with=<?= $startup['founder_id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
<i class="far fa-comment-dots"></i> Message Founder
</a>
<a href="invest.php?id=<?= $startup['id'] ?>" class="invest-btn">
<i class="fas fa-rocket"></i> Invest Now
</a>
<?php if (!$isFounder): ?>
<button id="main-follow-btn" class="follow-btn <?= $isFollowing ? 'following' : 'not-following' ?>" onclick="toggleFollow(<?= $startup['id'] ?>)">
<i class="fas <?= $isFollowing ? 'fa-check' : 'fa-plus' ?>"></i>
<span><?= $isFollowing ? 'Following' : 'Follow' ?></span>
</button>
<?php endif; ?>
<?php if ($isInvestor): ?>
<a href="messages.php?chat_with=<?= $startup['founder_id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
<i class="far fa-comment-dots"></i> Message Founder
</a>
<a href="invest.php?id=<?= $startup['id'] ?>" class="invest-btn">
<i class="fas fa-rocket"></i> Invest Now
</a>
<?php elseif ($isFounder): ?>
<a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
<i class="fas fa-edit"></i> Edit Profile
</a>
<?php endif; ?>
</div>
<?php elseif ($isFounder): ?>
<a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
<i class="fas fa-edit"></i> Edit Profile
</a>
<?php endif; ?>
</div>
<?php if ($startup['round_status'] === 'Active'): ?>
@ -639,6 +681,47 @@ window.onclick = function(event) {
closeWalletModal();
}
}
function toggleFollow(startupId) {
const btn = document.getElementById('main-follow-btn');
const icon = btn.querySelector('i');
const span = btn.querySelector('span');
const countSpan = document.getElementById('follower-count');
fetch('api/follow_startup.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'startup_id=' + startupId
})
.then(response => response.json())
.then(data => {
if (data.success) {
if (data.action === 'followed') {
btn.classList.remove('not-following');
btn.classList.add('following');
icon.classList.remove('fa-plus');
icon.classList.add('fa-check');
span.innerText = 'Following';
} else {
btn.classList.remove('following');
btn.classList.add('not-following');
icon.classList.remove('fa-check');
icon.classList.add('fa-plus');
span.innerText = 'Follow';
}
if (countSpan) {
countSpan.innerText = data.followers_count.toLocaleString();
}
} else {
alert('Error: ' + data.error);
}
})
.catch(error => {
console.error('Error:', error);
});
}
</script>
</body>