Spaces:
Running
Running
File size: 31,995 Bytes
96bd5d5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unimate - Find Friends at Your University</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background-color: #f8fafc;
}
.gradient-bg {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
}
.card-hover:hover {
transform: translateY(-5px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.pulse-animation {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
.chat-bubble {
position: relative;
background: #e2e8f0;
border-radius: 1.5rem;
padding: 1rem;
margin-bottom: 1rem;
max-width: 80%;
}
.chat-bubble:after {
content: '';
position: absolute;
bottom: 0;
left: 20%;
width: 0;
height: 0;
border: 20px solid transparent;
border-top-color: #e2e8f0;
border-bottom: 0;
border-left: 0;
margin-left: -10px;
margin-bottom: -20px;
}
.user-bubble {
background: #6366f1;
color: white;
margin-left: auto;
}
.user-bubble:after {
border-top-color: #6366f1;
left: auto;
right: 20%;
}
.profile-card {
position: relative;
border-radius: 1rem;
overflow: hidden;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
height: 500px;
background-size: cover;
background-position: center;
}
.profile-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
padding: 2rem 1.5rem 1.5rem;
color: white;
}
.swipe-buttons {
display: flex;
justify-content: center;
margin-top: 1rem;
gap: 1rem;
}
.swipe-button {
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: all 0.2s;
}
.swipe-button:hover {
transform: scale(1.1);
}
.dislike-btn {
background: white;
color: #ef4444;
}
.like-btn {
background: white;
color: #10b981;
}
.message-btn {
background: #6366f1;
color: white;
}
.tab-button {
position: relative;
padding-bottom: 0.5rem;
}
.tab-button.active:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 3px;
background: #6366f1;
}
.interest-tag {
display: inline-block;
background: rgba(255,255,255,0.2);
padding: 0.25rem 0.75rem;
border-radius: 9999px;
margin-right: 0.5rem;
margin-bottom: 0.5rem;
font-size: 0.875rem;
}
.university-badge {
position: absolute;
top: 1rem;
left: 1rem;
background: rgba(0,0,0,0.7);
color: white;
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.875rem;
display: flex;
align-items: center;
}
.university-badge i {
margin-right: 0.25rem;
}
/* Animation for matching */
@keyframes matchAnimation {
0% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.2); opacity: 0.8; }
100% { transform: scale(1); opacity: 1; }
}
.match-animation {
animation: matchAnimation 0.5s ease-in-out;
}
/* Chat specific styles */
.chat-header {
position: sticky;
top: 0;
background: white;
z-index: 10;
padding: 1rem;
border-bottom: 1px solid #e2e8f0;
display: flex;
align-items: center;
}
.chat-messages {
padding: 1rem;
overflow-y: auto;
height: calc(100vh - 200px);
}
.chat-input {
position: sticky;
bottom: 0;
background: white;
padding: 1rem;
border-top: 1px solid #e2e8f0;
}
.back-button {
margin-right: 1rem;
cursor: pointer;
}
.hidden {
display: none;
}
</style>
</head>
<body>
<!-- Navigation -->
<nav class="bg-white shadow-sm sticky top-0 z-10">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<div class="flex-shrink-0 flex items-center">
<i class="fas fa-users text-indigo-600 text-2xl mr-2"></i>
<span class="text-xl font-bold text-indigo-600">Unimate</span>
</div>
</div>
<div class="hidden sm:ml-6 sm:flex sm:items-center">
<button class="bg-white p-1 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
<span class="sr-only">Notifications</span>
<i class="fas fa-bell h-6 w-6"></i>
<span class="absolute top-0 right-0 block h-2 w-2 rounded-full bg-red-500 ring-2 ring-white"></span>
</button>
<div class="ml-3 relative">
<div>
<button type="button" class="bg-white rounded-full flex text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" id="user-menu-button" aria-expanded="false" aria-haspopup="true">
<span class="sr-only">Open user menu</span>
<img class="h-8 w-8 rounded-full" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="">
</button>
</div>
</div>
</div>
<div class="-mr-2 flex items-center sm:hidden">
<button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500" aria-controls="mobile-menu" aria-expanded="false">
<span class="sr-only">Open main menu</span>
<i class="fas fa-bars h-6 w-6"></i>
</button>
</div>
</div>
</div>
</nav>
<!-- Main Content with Tabs -->
<div class="max-w-md mx-auto pb-16">
<!-- Tab Navigation -->
<div class="flex border-b border-gray-200">
<button class="flex-1 py-4 px-1 text-center border-b-2 font-medium text-sm tab-button active" id="discover-tab">
<i class="fas fa-user-friends mr-1"></i> Discover
</button>
<button class="flex-1 py-4 px-1 text-center border-b-2 font-medium text-sm tab-button" id="matches-tab">
<i class="fas fa-heart mr-1"></i> Matches
<span class="ml-1 bg-indigo-600 text-white text-xs font-bold px-2 py-0.5 rounded-full">3</span>
</button>
<button class="flex-1 py-4 px-1 text-center border-b-2 font-medium text-sm tab-button" id="messages-tab">
<i class="fas fa-comment-dots mr-1"></i> Messages
<span class="ml-1 bg-indigo-600 text-white text-xs font-bold px-2 py-0.5 rounded-full">2</span>
</button>
</div>
<!-- Tab Content -->
<div class="px-4 py-4" id="discover-content">
<!-- Profile Card (Swipeable) -->
<div class="profile-card" style="background-image: url('https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80')">
<div class="university-badge">
<i class="fas fa-university"></i> UCL
</div>
<div class="profile-overlay">
<h3 class="text-2xl font-bold">Emma, 20</h3>
<p class="text-lg mb-2">Psychology Student</p>
<div class="mb-2">
<span class="interest-tag">#CoffeeLover</span>
<span class="interest-tag">#Hiking</span>
<span class="interest-tag">#Reading</span>
<span class="interest-tag">#Music</span>
</div>
<p class="text-sm opacity-90">"Just moved to London from Manchester and looking to meet new friends who enjoy exploring the city!"</p>
</div>
</div>
<!-- Swipe Buttons -->
<div class="swipe-buttons">
<button class="swipe-button dislike-btn" id="dislike-btn">
<i class="fas fa-times"></i>
</button>
<button class="swipe-button message-btn" id="message-btn">
<i class="fas fa-comment"></i>
</button>
<button class="swipe-button like-btn" id="like-btn">
<i class="fas fa-heart"></i>
</button>
</div>
</div>
<div class="hidden px-4 py-4" id="matches-content">
<h3 class="text-xl font-bold mb-4">Your Matches</h3>
<div class="grid grid-cols-2 gap-4">
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<img src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80" class="w-full h-40 object-cover">
<div class="p-3">
<h4 class="font-medium">James, 21</h4>
<p class="text-sm text-gray-500">Computer Science</p>
<button class="mt-2 w-full bg-indigo-100 text-indigo-600 py-1 rounded-md text-sm font-medium message-match-btn" data-user="James">
Message
</button>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<img src="https://images.unsplash.com/photo-1517841905240-472988babdf9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80" class="w-full h-40 object-cover">
<div class="p-3">
<h4 class="font-medium">Priya, 19</h4>
<p class="text-sm text-gray-500">Economics</p>
<button class="mt-2 w-full bg-indigo-100 text-indigo-600 py-1 rounded-md text-sm font-medium message-match-btn" data-user="Priya">
Message
</button>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<img src="https://images.unsplash.com/photo-1531123897727-8f129e1688ce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80" class="w-full h-40 object-cover">
<div class="p-3">
<h4 class="font-medium">Alex, 22</h4>
<p class="text-sm text-gray-500">Medicine</p>
<button class="mt-2 w-full bg-indigo-100 text-indigo-600 py-1 rounded-md text-sm font-medium message-match-btn" data-user="Alex">
Message
</button>
</div>
</div>
</div>
</div>
<div class="hidden px-4 py-4" id="messages-content">
<!-- Messages List View -->
<div id="messages-list">
<h3 class="text-xl font-bold mb-4">Your Conversations</h3>
<div class="space-y-3">
<div class="flex items-center p-3 bg-white rounded-lg shadow-sm open-chat-btn" data-user="James">
<img src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80" class="w-12 h-12 rounded-full object-cover">
<div class="ml-3 flex-1">
<div class="flex justify-between">
<h4 class="font-medium">James</h4>
<span class="text-xs text-gray-500">2h ago</span>
</div>
<p class="text-sm text-gray-500 truncate">Hey! Want to grab coffee tomorrow before class?</p>
</div>
<span class="ml-2 block h-2 w-2 rounded-full bg-indigo-600"></span>
</div>
<div class="flex items-center p-3 bg-white rounded-lg shadow-sm open-chat-btn" data-user="Priya">
<img src="https://images.unsplash.com/photo-1517841905240-472988babdf9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80" class="w-12 h-12 rounded-full object-cover">
<div class="ml-3 flex-1">
<div class="flex justify-between">
<h4 class="font-medium">Priya</h4>
<span class="text-xs text-gray-500">1d ago</span>
</div>
<p class="text-sm text-gray-500 truncate">The study group is meeting at the library at 3pm</p>
</div>
</div>
</div>
<div class="mt-6 bg-indigo-50 p-4 rounded-lg">
<h4 class="font-medium text-indigo-800 mb-2">Icebreaker Suggestions</h4>
<div class="space-y-2">
<button class="w-full text-left p-2 bg-white rounded-md text-sm">
"What's your favorite spot on campus?"
</button>
<button class="w-full text-left p-2 bg-white rounded-md text-sm">
"What are you studying and why did you choose it?"
</button>
<button class="w-full text-left p-2 bg-white rounded-md text-sm">
"Do you have any recommendations for good coffee near campus?"
</button>
</div>
</div>
</div>
<!-- Individual Chat View (hidden by default) -->
<div id="chat-view" class="hidden">
<div class="chat-header">
<button class="back-button" id="back-to-messages">
<i class="fas fa-arrow-left"></i>
</button>
<img id="chat-user-avatar" src="" class="w-10 h-10 rounded-full object-cover">
<div class="ml-3">
<h4 id="chat-user-name" class="font-medium"></h4>
<p id="chat-user-status" class="text-xs text-gray-500">Online</p>
</div>
</div>
<div class="chat-messages" id="chat-messages">
<!-- Messages will be inserted here -->
</div>
<div class="chat-input">
<div class="flex">
<input type="text" placeholder="Type a message..." class="flex-1 border border-gray-300 rounded-l-md px-4 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500">
<button class="bg-indigo-600 text-white px-4 py-2 rounded-r-md">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Bottom Navigation (Mobile) -->
<div class="fixed bottom-0 left-0 right-0 bg-white shadow-lg sm:hidden z-10">
<div class="flex justify-around">
<button class="p-4 text-indigo-600" id="mobile-discover-tab">
<i class="fas fa-user-friends text-xl"></i>
</button>
<button class="p-4 text-gray-500" id="mobile-matches-tab">
<i class="fas fa-heart text-xl"></i>
</button>
<button class="p-4 text-gray-500" id="mobile-messages-tab">
<i class="fas fa-comment-dots text-xl"></i>
</button>
</div>
</div>
<!-- Match Modal (Hidden by default) -->
<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-20 hidden" id="match-modal">
<div class="bg-white rounded-lg p-6 max-w-sm w-full text-center">
<div class="flex justify-center -space-x-4">
<img src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80" class="w-20 h-20 rounded-full border-4 border-white">
<img src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80" class="w-20 h-20 rounded-full border-4 border-white">
</div>
<h3 class="text-2xl font-bold mt-4">It's a match!</h3>
<p class="text-gray-600 mt-2">You and Emma have liked each other</p>
<div class="mt-6 space-y-3">
<button class="w-full bg-indigo-600 text-white py-2 rounded-md font-medium" id="match-message-btn">
Send Message
</button>
<button class="w-full border border-gray-300 text-gray-700 py-2 rounded-md font-medium" id="keep-swiping-btn">
Keep Swiping
</button>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Current chat state
let currentChatUser = null;
// Tab switching functionality
const tabs = {
discover: {
tab: document.getElementById('discover-tab'),
mobileTab: document.getElementById('mobile-discover-tab'),
content: document.getElementById('discover-content')
},
matches: {
tab: document.getElementById('matches-tab'),
mobileTab: document.getElementById('mobile-matches-tab'),
content: document.getElementById('matches-content')
},
messages: {
tab: document.getElementById('messages-tab'),
mobileTab: document.getElementById('mobile-messages-tab'),
content: document.getElementById('messages-content')
}
};
// Chat elements
const messagesListView = document.getElementById('messages-list');
const chatView = document.getElementById('chat-view');
const chatMessages = document.getElementById('chat-messages');
const chatUserName = document.getElementById('chat-user-name');
const chatUserAvatar = document.getElementById('chat-user-avatar');
const backToMessagesBtn = document.getElementById('back-to-messages');
function switchTab(activeTab) {
// Update all tabs
Object.keys(tabs).forEach(tabKey => {
const tab = tabs[tabKey];
const isActive = tabKey === activeTab;
// Update tab buttons
if (tab.tab) {
tab.tab.classList.toggle('active', isActive);
tab.tab.classList.toggle('text-indigo-600', isActive);
tab.tab.classList.toggle('text-gray-500', !isActive);
}
if (tab.mobileTab) {
tab.mobileTab.classList.toggle('text-indigo-600', isActive);
tab.mobileTab.classList.toggle('text-gray-500', !isActive);
}
// Update content
tab.content.classList.toggle('hidden', !isActive);
});
// If switching to messages tab, show the list view by default
if (activeTab === 'messages') {
messagesListView.classList.remove('hidden');
chatView.classList.add('hidden');
}
}
// Add event listeners to all tabs
Object.keys(tabs).forEach(tabKey => {
const tab = tabs[tabKey];
if (tab.tab) tab.tab.addEventListener('click', () => switchTab(tabKey));
if (tab.mobileTab) tab.mobileTab.addEventListener('click', () => switchTab(tabKey));
});
// Swipe button functionality
const likeBtn = document.getElementById('like-btn');
const dislikeBtn = document.getElementById('dislike-btn');
const messageBtn = document.getElementById('message-btn');
const matchModal = document.getElementById('match-modal');
const keepSwipingBtn = document.getElementById('keep-swiping-btn');
const matchMessageBtn = document.getElementById('match-message-btn');
likeBtn.addEventListener('click', function() {
// In a real app, this would send a like to the server
// For demo, we'll show a match 30% of the time
if (Math.random() < 0.3) {
matchModal.classList.remove('hidden');
} else {
// Animate the card swipe
const profileCard = document.querySelector('.profile-card');
profileCard.classList.add('match-animation');
// After animation, we'd load a new profile
setTimeout(() => {
// In a real app, this would fetch a new profile
alert('New profile would load here');
}, 500);
}
});
dislikeBtn.addEventListener('click', function() {
// Animate the card swipe
const profileCard = document.querySelector('.profile-card');
profileCard.style.transform = 'translateX(-100%) rotate(-10deg)';
profileCard.style.opacity = '0';
profileCard.style.transition = 'all 0.5s ease';
// After animation, we'd load a new profile
setTimeout(() => {
// In a real app, this would fetch a new profile
alert('New profile would load here');
}, 500);
});
messageBtn.addEventListener('click', function() {
// Switch to messages tab and open chat with Emma
switchTab('messages');
openChat('Emma', 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80');
});
// Close match modal
keepSwipingBtn.addEventListener('click', function() {
matchModal.classList.add('hidden');
// Animate the card swipe
const profileCard = document.querySelector('.profile-card');
profileCard.classList.add('match-animation');
// After animation, we'd load a new profile
setTimeout(() => {
// In a real app, this would fetch a new profile
alert('New profile would load here');
}, 500);
});
// Message button in match modal
matchMessageBtn.addEventListener('click', function() {
matchModal.classList.add('hidden');
switchTab('messages');
openChat('Emma', 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=4&w=800&h=800&q=80');
});
// Message buttons in matches list
document.querySelectorAll('.message-match-btn').forEach(btn => {
btn.addEventListener('click', function() {
const userName = this.getAttribute('data-user');
const userAvatar = this.closest('.bg-white').querySelector('img').src;
switchTab('messages');
openChat(userName, userAvatar);
});
});
// Open chat buttons in messages list
document.querySelectorAll('.open-chat-btn').forEach(btn => {
btn.addEventListener('click', function() {
const userName = this.getAttribute('data-user');
const userAvatar = this.querySelector('img').src;
openChat(userName, userAvatar);
});
});
// Back to messages list button
backToMessagesBtn.addEventListener('click', function() {
messagesListView.classList.remove('hidden');
chatView.classList.add('hidden');
});
// Function to open a chat with a specific user
function openChat(userName, userAvatar) {
currentChatUser = userName;
// Update chat header
chatUserName.textContent = userName;
chatUserAvatar.src = userAvatar;
// Clear existing messages
chatMessages.innerHTML = '';
// Add sample messages (in a real app, these would come from the server)
if (userName === 'Emma') {
addMessage('Emma', 'Hi there! How are you?', false);
addMessage('You', "I'm good thanks! How about you?", true);
addMessage('Emma', "Great! Just moved to London and looking to meet new friends", false);
} else if (userName === 'James') {
addMessage('James', 'Hey! Want to grab coffee tomorrow before class?', false);
addMessage('You', "Sure, what time works for you?", true);
addMessage('James', "How about 9am at the campus cafe?", false);
} else if (userName === 'Priya') {
addMessage('Priya', 'The study group is meeting at the library at 3pm', false);
addMessage('You', "Thanks for letting me know! I'll be there", true);
} else if (userName === 'Alex') {
addMessage('Alex', 'Hey! Are you coming to the med school mixer this weekend?', false);
}
// Show the chat view and hide the messages list
messagesListView.classList.add('hidden');
chatView.classList.remove('hidden');
}
// Function to add a message to the chat
function addMessage(sender, text, isCurrentUser) {
const messageDiv = document.createElement('div');
messageDiv.className = `mb-4 ${isCurrentUser ? 'text-right' : 'text-left'}`;
const bubble = document.createElement('div');
bubble.className = `inline-block px-4 py-2 rounded-lg ${isCurrentUser ? 'bg-indigo-600 text-white' : 'bg-gray-200 text-gray-800'}`;
bubble.textContent = text;
const senderName = document.createElement('div');
senderName.className = 'text-xs text-gray-500 mb-1';
senderName.textContent = sender;
if (!isCurrentUser) {
messageDiv.appendChild(senderName);
}
messageDiv.appendChild(bubble);
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
// Mobile menu toggle
const mobileMenuButton = document.querySelector('[aria-controls="mobile-menu"]');
mobileMenuButton.addEventListener('click', function() {
alert('Mobile menu would open here');
});
// User menu toggle
const userMenuButton = document.getElementById('user-menu-button');
userMenuButton.addEventListener('click', function() {
alert('User menu would open here');
});
// Initialize with discover tab
switchTab('discover');
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=mcbaicoding/unimates" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |