v12
This commit is contained in:
parent
7fc6180066
commit
d515f936b1
116
partners.php
116
partners.php
@ -23,6 +23,40 @@ if (!$user['onboarding_completed']) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Skill-based Matching Helper
|
||||
function calculateMatchScore($me, $them) {
|
||||
$score = 0;
|
||||
|
||||
// 1. My preferred skills vs Their skills
|
||||
$myNeeds = array_filter(array_map('trim', explode(',', strtolower($me['preferred_co_founder_skills'] ?? ''))));
|
||||
$theirSkills = array_filter(array_map('trim', explode(',', strtolower($them['skills'] ?? ''))));
|
||||
$skillMatches = array_intersect($myNeeds, $theirSkills);
|
||||
$score += count($skillMatches) * 10;
|
||||
|
||||
// 2. Their preferred skills vs My skills
|
||||
$theirNeeds = array_filter(array_map('trim', explode(',', strtolower($them['preferred_co_founder_skills'] ?? ''))));
|
||||
$mySkills = array_filter(array_map('trim', explode(',', strtolower($me['skills'] ?? ''))));
|
||||
$reciprocalMatches = array_intersect($theirNeeds, $mySkills);
|
||||
$score += count($reciprocalMatches) * 10;
|
||||
|
||||
// 3. Industry overlap
|
||||
$myIndustries = array_filter(array_map('trim', explode(',', strtolower($me['startup_industries'] ?? ''))));
|
||||
$theirIndustries = array_filter(array_map('trim', explode(',', strtolower($them['startup_industries'] ?? ''))));
|
||||
$industryMatches = array_intersect($myIndustries, $theirIndustries);
|
||||
$score += count($industryMatches) * 5;
|
||||
|
||||
// 4. University match (bonus)
|
||||
if (!empty($me['university']) && $me['university'] === $them['university']) {
|
||||
$score += 5;
|
||||
}
|
||||
|
||||
return [
|
||||
'total' => $score,
|
||||
'skillMatches' => array_values($skillMatches),
|
||||
'industryMatches' => array_values($industryMatches)
|
||||
];
|
||||
}
|
||||
|
||||
// Handle Swipe Logic
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe') {
|
||||
header('Content-Type: application/json');
|
||||
@ -66,7 +100,7 @@ $stmt = db()->prepare("
|
||||
$stmt->execute([$current_user_id, $current_user_id, $current_user_id]);
|
||||
$matches = $stmt->fetchAll();
|
||||
|
||||
// Fetch swipe candidates
|
||||
// Fetch swipe candidates with scoring
|
||||
$stmt = db()->prepare("
|
||||
SELECT * FROM users
|
||||
WHERE role = 'founder'
|
||||
@ -74,11 +108,17 @@ $stmt = db()->prepare("
|
||||
AND onboarding_completed = 1
|
||||
AND looking_for_cofounder = 1
|
||||
AND id NOT IN (SELECT swiped_id FROM swipes WHERE swiper_id = ?)
|
||||
ORDER BY RAND()
|
||||
LIMIT 10
|
||||
LIMIT 50
|
||||
");
|
||||
$stmt->execute([$current_user_id, $current_user_id]);
|
||||
$swipeCandidates = $stmt->fetchAll();
|
||||
$allCandidates = $stmt->fetchAll();
|
||||
|
||||
foreach ($allCandidates as &$c) {
|
||||
$c['match_data'] = calculateMatchScore($user, $c);
|
||||
$c['score'] = $c['match_data']['total'];
|
||||
}
|
||||
usort($allCandidates, function($a, $b) { return $b['score'] <=> $a['score']; });
|
||||
$swipeCandidates = array_slice($allCandidates, 0, 10);
|
||||
|
||||
// Fetch partners for Browse view
|
||||
$search = $_GET['q'] ?? '';
|
||||
@ -91,10 +131,18 @@ if ($search) {
|
||||
$params[] = "%$search%";
|
||||
$params[] = "%$search%";
|
||||
}
|
||||
$stmt = db()->prepare("SELECT * FROM users WHERE $where LIMIT 20");
|
||||
$stmt = db()->prepare("SELECT * FROM users WHERE $where LIMIT 40");
|
||||
$stmt->execute($params);
|
||||
$browseCandidates = $stmt->fetchAll();
|
||||
|
||||
foreach ($browseCandidates as &$c) {
|
||||
$c['match_data'] = calculateMatchScore($user, $c);
|
||||
$c['score'] = $c['match_data']['total'];
|
||||
}
|
||||
if (!$search) {
|
||||
usort($browseCandidates, function($a, $b) { return $b['score'] <=> $a['score']; });
|
||||
}
|
||||
|
||||
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
?>
|
||||
<!doctype html>
|
||||
@ -221,6 +269,23 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
justify-content: center;
|
||||
font-size: 100px;
|
||||
color: rgba(255,255,255,0.2);
|
||||
position: relative;
|
||||
}
|
||||
.match-badge {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
background: rgba(0,0,0,0.6);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 8px 16px;
|
||||
border-radius: 50px;
|
||||
color: var(--accent-blue);
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
border: 1px solid var(--accent-blue);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.card-details { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; }
|
||||
.card-title { font-size: 26px; font-weight: 800; margin-bottom: 5px; }
|
||||
@ -228,6 +293,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
.card-bio { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 15px; }
|
||||
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.card-tag { font-size: 11px; padding: 5px 12px; background: rgba(255,255,255,0.05); border-radius: 20px; border: 1px solid var(--border-color); }
|
||||
.card-tag.highlight { border-color: var(--accent-blue); color: var(--accent-blue); background: rgba(0, 242, 255, 0.05); }
|
||||
|
||||
.swipe-actions { display: flex; gap: 20px; margin-top: 30px; }
|
||||
.action-btn {
|
||||
@ -251,11 +317,22 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
padding: 25px;
|
||||
transition: transform 0.3s;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
.candidate-card:hover { transform: translateY(-5px); border-color: var(--accent-blue); }
|
||||
.candidate-header { display: flex; gap: 15px; align-items: center; margin-bottom: 20px; }
|
||||
.candidate-avatar { width: 60px; height: 60px; border-radius: 18px; background: var(--gradient-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 20px; }
|
||||
|
||||
.score-indicator {
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 25px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: var(--accent-blue);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Match Modal */
|
||||
#match-modal {
|
||||
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
||||
@ -334,6 +411,9 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
<?php foreach (array_reverse($swipeCandidates) as $c): ?>
|
||||
<div class="swipe-card" data-id="<?= $c['id'] ?>">
|
||||
<div class="card-header-img">
|
||||
<?php if ($c['score'] >= 10): ?>
|
||||
<div class="match-badge"><i class="fas fa-bolt"></i> <?= $c['score'] ?>% Compatible</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($c['profile_photo']): ?>
|
||||
<img src="<?= htmlspecialchars($c['profile_photo']) ?>" style="width: 100%; height: 100%; object-fit: cover;">
|
||||
<?php else: ?>
|
||||
@ -347,8 +427,15 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
<div class="card-tags">
|
||||
<?php
|
||||
$skills = explode(',', $c['skills']);
|
||||
foreach (array_slice($skills, 0, 3) as $skill): if(empty(trim($skill))) continue; ?>
|
||||
<span class="card-tag"><?= htmlspecialchars(trim($skill)) ?></span>
|
||||
$myNeeds = array_map('trim', explode(',', strtolower($user['preferred_co_founder_skills'] ?? '')));
|
||||
foreach (array_slice($skills, 0, 4) as $skill):
|
||||
if(empty(trim($skill))) continue;
|
||||
$isNeeded = in_array(trim(strtolower($skill)), $myNeeds);
|
||||
?>
|
||||
<span class="card-tag <?= $isNeeded ? 'highlight' : '' ?>">
|
||||
<?= $isNeeded ? '<i class="fas fa-check"></i> ' : '' ?>
|
||||
<?= htmlspecialchars(trim($skill)) ?>
|
||||
</span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -374,6 +461,9 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
<div class="browse-container">
|
||||
<?php foreach ($browseCandidates as $c): ?>
|
||||
<div class="candidate-card" onclick="location.href='messages.php?user_id=<?= $c['id'] ?>'">
|
||||
<?php if ($c['score'] >= 10): ?>
|
||||
<div class="score-indicator"><i class="fas fa-star"></i> Top Match</div>
|
||||
<?php endif; ?>
|
||||
<div class="candidate-header">
|
||||
<div class="candidate-avatar">
|
||||
<?php if ($c['profile_photo']): ?>
|
||||
@ -393,8 +483,14 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 6px;">
|
||||
<?php
|
||||
$skills = explode(',', $c['skills']);
|
||||
foreach (array_slice($skills, 0, 2) as $skill): if(empty(trim($skill))) continue; ?>
|
||||
<span style="font-size: 10px; padding: 3px 10px; background: rgba(255,255,255,0.05); border-radius: 20px; color: var(--text-secondary);"><?= htmlspecialchars(trim($skill)) ?></span>
|
||||
$myNeeds = array_map('trim', explode(',', strtolower($user['preferred_co_founder_skills'] ?? '')));
|
||||
foreach (array_slice($skills, 0, 3) as $skill):
|
||||
if(empty(trim($skill))) continue;
|
||||
$isNeeded = in_array(trim(strtolower($skill)), $myNeeds);
|
||||
?>
|
||||
<span style="font-size: 10px; padding: 3px 10px; background: <?= $isNeeded ? 'rgba(0, 242, 255, 0.1)' : 'rgba(255,255,255,0.05)' ?>; border-radius: 20px; color: <?= $isNeeded ? 'var(--accent-blue)' : 'var(--text-secondary)' ?>; border: 1px solid <?= $isNeeded ? 'var(--accent-blue)' : 'transparent' ?>;">
|
||||
<?= htmlspecialchars(trim($skill)) ?>
|
||||
</span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -488,4 +584,4 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
||||
</style>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user