SameerArz commited on
Commit
eb66d76
·
verified ·
1 Parent(s): d82c543

You are VibeCoder — a full-stack production AI that builds modern, mobile-first, privacy-respecting web apps. Build a complete dating website called **SparkMeet** aimed at **Gen Z (ages 18–26)**. The deliverable must be a production-ready, accessible, performant, and secure full-stack app (frontend + backend + database + infra + tests + documentation). Use modern tech: React + TypeScript (Next.js recommended for SSR/edge), Tailwind CSS for styling, Prisma or an ORM for DB, PostgreSQL (or Supabase/PlanetScale), Redis for caching & rate limits, WebSocket (or Supabase Realtime) for chat, S3 (or equivalent) for images. Provide a runnable repo layout, README, and end-to-end tests.

Browse files

--- PRODUCT VISION
- Short pitch: SparkMeet — a playful, safe, swipeable dating app for Gen Z that focuses on authenticity, micro-vibes, and fast matches.
- Tone & Branding: playful, concise, inclusive. Use short microcopy and emojis sparingly. UI: rounded cards, neon gradient accents (pink/purple/teal), large tappable targets.
- Target: mobile-first progressive web app (works on desktop & mobile).

--- CORE MVP FEATURES (must implement)
1. Onboarding / Auth
- Email + password (strong password rules) + email verification.
- OAuth 2.0 options: Google & Apple (if available).
- Phone number + OTP or passwordless email as an option.
- Age verification (users must be >= 18) — soft: date of birth input; hard: optional ID/photo check flows.
2. Profile
- Multi-photo upload (max 10), photos stored on S3 with signed uploads.
- Bio, pronouns, location (city), age, interests (tag list), Spotify/Instagram optional links, study/work info.
- "Vibe badges" (fun little tags) and 3-sentence “Sparkline” — concise highlight visible in cards.
3. Discovery
- Swipe interface + grid/list mode.
- Filters: distance, age range, interests, online now.
- “Spark” mechanic: a paid or earned boost that increases visibility.
4. Matching
- Mutual likes create a Match — open match chat.
- Notification on match + celebratory modal/UI.
5. Chat
- Real-time messaging via WebSocket or WebRTC data channels.
- Read receipts, typing indicator, image support, message delete for own messages.
- Safety commands: report, block, mute.
6. Safety & Moderation
- Content moderation pipeline for images and text (automated + human queue).
- Report/Block flows, rate limiting, anti-spam heuristics.
7. Monetization (optional basic)
- Subscriptions (monthly) + in-app credits ("Sparks" to boost).
- Stripe integration for payments.
8. Notifications & Emails
- Push notifications (web push + mobile) and transactional emails.
9. Admin Dashboard
- User search, reports queue, content moderation, ban/unban, analytics.
10. Metrics & Analytics
- Event tracking (profile_view, like, match, message_sent, report_submitted) suitable for Mixpanel/Amplitude.

--- DESIGN & UI SYSTEM
- Component library: Button, Card, Avatar, Modal, Input, Toggle, Tag, Badge, Toast.
- Responsive breakpoints; mobile-first.
- Accessibility (a11y): proper aria labels, keyboard navigation, color contrast, focus states.
- Animations: subtle microinteractions on like/match using Lottie or CSS transforms.

--- DETAILED PAGE & UI COMPONENTS (with **every** button + exact behavior)

1) Landing / Home (unauthenticated)
- Buttons:
- `Sign Up` -> opens onboarding modal. Behavior: opens `/signup` route. Track event: `cta_signup_clicked`.
- `Log In` -> opens login modal. Behavior: `/login`. Track `cta_login_clicked`.
- `Learn More` -> scroll or route to features section. Track `cta_learn_more`.
- SEO meta tags and social preview.

2) Onboarding (Signup flow)
- Inputs: email, DOB, password OR OAuth flow buttons.
- Buttons:
- `Continue` (on each step) -> validate inputs client-side, call `/api/auth/signup/step` with payload, show loader, on success go next. Analytics `onboarding_step_completed` with properties {step, method}.
- `Use Google` / `Use Apple` -> trigger OAuth popup, on success complete onboarding server side and redirect to profile builder.
- `Back` -> navigate to previous step, save partial state in localStorage.
- `Skip` (for optional steps) -> store default values and continue.
- Validation: strong password rules, DOB => must be >= 18 else show friendly rejection modal with help.

3) Profile Builder
- Buttons:
- `Upload Photo` (per slot) -> open image picker, client validates file type/size, then uploads via signed URL to S3: PUT signed URL. After upload, POST `/api/users/{id}/photos` to register. Show progress and allow reorder. Immediately run image moderation; if blocked, notify user and remove photo.
- `Save Profile` -> PUT `/api/users/{id}` with full profile JSON. On success show toast "Profile saved".
- `Add Badge` -> opens tag selector modal; PUT update profile interests.
- `Preview Profile` -> open public view page; track `profile_preview`.
- Edge cases: network failure -> retry modal with retry/back options.

4) Discovery / Swipe Screen (primary)
- Layout: central card with person profile; swipe gestures (touch, mouse drag) + buttons under the card.
- Buttons (explicit list with behavior):
- `X / Pass` button:
- UI: visible, accessible label `Pass`.
- Action: optimistic UI remove card, POST `/api/discovery/pass` payload {userId, targetId}. If response error, revert card and show error toast. Track `discovery_pass`.
- `Like` (heart):
- UI: toggleable, triggers animation.
- Action: optimistic UI mark liked. POST `/api/matches/like` with {fromUserId, toUserId}. If response returns `{match: true, matchId}`, open Match modal that prompts "You matched — Send a message". Create a conversation in DB and navigate to chat if user clicks. Track `discovery_like` with property {match: boolean}.
- `SuperSpark` (special):
- UI: uses Sparks credit or subscription. If user has credits, pressing consumes credit and sends a stronger signal. POST `/api/matches/superspark`. Show confirmation modal with microcopy and animation. Track `discovery_superspark`.
- `Info` (i icon):
- Opens detailed overlay with more profile fields and common interests. Track `discovery_info_open`.
- Swipe gestures:
- Right = Like, Left = Pass, Up = SuperSpark. On each gesture, call the same endpoints as corresponding buttons. Debounce swipes to prevent accidental repeats.

5) Profile Card (viewing someone)
- Buttons:
- `Message`:
- Enabled only if matched. If not matched, button text `Like to Match` and clicking performs like flow.
- If matched, opens chat window, focus input. Track `profile_message_open`.
- `Spark` icon on card:
- Behavior same as SuperSpark.
- `Report`:
- Opens report modal to select reason (harassment, nudity, fake profile, minors, spam). On submit: POST `/api/reports` with last messages & last 5 photos metadata. Immediately create moderation ticket, optionally auto-suspend if severe reason. Track `profile_report_submitted`.
- `Block`:
- POST `/api/users/{me}/block` -> server adds block and prevents recommendations/messages. Client hides the user and shows undo toast `User blocked`.
- `Follow` (if you want social features) — optional.

6) Chat / Messaging
- Buttons and behaviors:
- `Send` (text):
- Enabled when input non-empty. Action: optimistic append message to chat UI with temporary id, send over WebSocket `message_send` event and fallback to POST `/api/messages` if socket fails. On ACK replace temp id with real id. Track `message_sent` with length properties.
- Validation: check for banned words; block sending or flag if present.
- `Attach Photo`:
- Similar to profile photo upload; upload signed URL then send image message. Moderation pipeline runs; if flagged, remove message and notify both users if required.
- `Delete` (own message):
- Sends DELETE `/api/messages/{id}`; client hides message and shows "Message deleted". Server keeps audit copy for moderation but hides content from the other user.
- `Block/Report` (within chat):
- Same endpoints as profile, but attach last 10 messages to the report payload automatically.
- `Start Video Date`:
- If both agree, start WebRTC flow via signaling server. Button `Start Video` triggers call offer, sends push to other user; state in DB: `call_request`. Track `video_call_requested`.

7) Settings & Account
- Buttons:
- `Change Password` -> form with current/new/confirm and validation. POST `/api/auth/change-password`.
- `Delete Account` -> requires password confirm and shows 2-step modal. DELETE `/api/users/{id}` (soft delete: mark as deleted, anonymize). Provide grace period before permanent deletion.
- `Privacy Settings` toggles:
- `Show me in Discovery` toggle -> PUT `/api/users/{id}/privacy`.
- `Allow message from non-matches` toggle -> PUT.
- `Manage Subscription` -> links to billing portal (Stripe) or shows plan details.
- `Export My Data` -> triggers job and email with ZIP (GDPR request), track `data_export_requested`.

--- API DESIGN (examples)
- `POST /api/auth/signup` {email, password, dob} -> 201 {userId, nextStep}
- `POST /api/auth/login` {email, password} -> {token, refreshToken, expiresAt}
- `GET /api/discovery?cursor=...&filters=...` -> list of profiles
- `POST /api/matches/like` {fromUserId, toUserId} -> {match: boolean, matchId?: string}
- `POST /api/matches/superspark` {fromUserId, toUserId} -> {success, boostExpiresAt}
- `POST /api/messages` {conversationId, from, text, attachments[]} -> {messageId, createdAt}
- `POST /api/reports` {reporterId, targetId, reason, context: {messages[], photos[]}} -> {ticketId}
- `PUT /api/users/{id}` -> update profile
- `POST /api/uploads/signed-url` {filename, type} -> {url, key}

Include auth middleware (JWT + refresh tokens), RBAC for admin endpoints.

--- DATABASE SCHEMA (core tables)
- `users` (id, email, passwordHash, dob, displayName, pronouns, locationCity, createdAt, deletedAt, isBanned, lastActiveAt)
- `profiles` (userId FK, bio, sparkline, badges JSON, interests JSO

Files changed (1) hide show
  1. discovery.html +353 -0
discovery.html ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```html
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Discovery - SparkMeet</title>
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
11
+ <style>
12
+ .gradient-bg {
13
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
14
+ }
15
+ .btn-primary {
16
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
17
+ }
18
+ .btn-primary:hover {
19
+ background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
20
+ }
21
+ .profile-card {
22
+ transition: all 0.3s ease;
23
+ cursor: grab;
24
+ }
25
+ .profile-card:active {
26
+ cursor: grabbing;
27
+ }
28
+ .swipe-left {
29
+ transform: translateX(-150%) rotate(-30deg);
30
+ opacity: 0;
31
+ }
32
+ .swipe-right {
33
+ transform: translateX(150%) rotate(30deg);
34
+ opacity: 0;
35
+ }
36
+ .swipe-up {
37
+ transform: translateY(-150%) scale(0.8);
38
+ opacity: 0;
39
+ }
40
+ .match-modal {
41
+ backdrop-filter: blur(10px);
42
+ }
43
+ .spark-animation {
44
+ animation: sparkle 1.5s ease-in-out infinite;
45
+ }
46
+ @keyframes sparkle {
47
+ 0%, 100% { transform: scale(1) rotate(0deg); }
48
+ 50% { transform: scale(1.2) rotate(180deg); }
49
+ }
50
+ .action-button {
51
+ transition: all 0.2s ease;
52
+ box-shadow: 0 4px 15px rgba(0,0,0,0.1);
53
+ }
54
+ .action-button:hover {
55
+ transform: scale(1.1);
56
+ box-shadow: 0 8px 25px rgba(0,0,0,0.15);
57
+ }
58
+ .action-button:active {
59
+ transform: scale(0.95);
60
+ }
61
+ </style>
62
+ </head>
63
+ <body class="bg-gray-50 font-sans">
64
+ <!-- Navigation -->
65
+ <nav class="bg-white shadow-sm sticky top-0 z-40">
66
+ <div class="max-w-6xl mx-auto px-4">
67
+ <div class="flex justify-between items-center py-3">
68
+ <a href="index.html" class="flex items-center space-x-2">
69
+ <span class="text-2xl font-bold bg-gradient-to-r from-purple-600 to-pink-500 bg-clip-text text-transparent">SparkMeet</span>
70
+ </a>
71
+ <div class="flex items-center space-x-4">
72
+ <button class="p-2 text-gray-600 hover:text-purple-600 rounded-full hover:bg-gray-100">
73
+ <i data-feather="filter" class="w-5 h-5"></i>
74
+ </button>
75
+ <button class="p-2 text-gray-600 hover:text-purple-600 rounded-full hover:bg-gray-100">
76
+ <i data-feather="message-circle" class="w-5 h-5"></i>
77
+ </button>
78
+ <button class="relative p-2 text-gray-600 hover:text-purple-600 rounded-full hover:bg-gray-100">
79
+ <i data-feather="bell" class="w-5 h-5"></i>
80
+ <span class="absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"></span>
81
+ </button>
82
+ <a href="profile-builder.html" class="w-8 h-8 rounded-full bg-gradient-to-r from-purple-400 to-pink-400 flex items-center justify-center text-white font-semibold">
83
+ A
84
+ </a>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </nav>
89
+
90
+ <!-- Main Discovery Area -->
91
+ <div class="max-w-md mx-auto px-4 py-6">
92
+ <div class="relative h-[70vh] mb-6">
93
+ <!-- Profile Cards Stack -->
94
+ <div id="card-stack" class="relative w-full h-full">
95
+ <!-- Card 1 -->
96
+ <div class="profile-card absolute inset-0 bg-white rounded-2xl shadow-lg overflow-hidden" data-user-id="1">
97
+ <div class="relative h-3/4">
98
+ <img src="http://static.photos/people/640x360/123" alt="Sarah" class="w-full h-full object-cover">
99
+ <div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent"></div>
100
+ <div class="absolute bottom-4 left-4 text-white">
101
+ <h3 class="text-2xl font-bold">Sarah, 22</h3>
102
+ <p class="text-sm opacity-90">✨ Photography & Coffee</p>
103
+ <div class="flex items-center mt-2 space-x-2">
104
+ <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Creative</span>
105
+ <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Adventurous</span>
106
+ </div>
107
+ </div>
108
+ <button class="info-btn absolute top-4 right-4 w-10 h-10 bg-white/20 backdrop-blur rounded-full flex items-center justify-center text-white hover:bg-white/30">
109
+ <i data-feather="info" class="w-5 h-5"></i>
110
+ </button>
111
+ </div>
112
+ <div class="p-4">
113
+ <p class="text-gray-700 text-sm">"Capturing moments and chasing sunsets. Let's grab coffee and see where the conversation goes!"</p>
114
+ </div>
115
+ </div>
116
+
117
+ <!-- Card 2 -->
118
+ <div class="profile-card absolute inset-0 bg-white rounded-2xl shadow-lg overflow-hidden" data-user-id="2">
119
+ <div class="relative h-3/4">
120
+ <img src="http://static.photos/people/640x360/456" alt="Alex" class="w-full h-full object-cover">
121
+ <div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent"></div>
122
+ <div class="absolute bottom-4 left-4 text-white">
123
+ <h3 class="text-2xl font-bold">Alex, 24</h3>
124
+ <p class="text-sm opacity-90">🎵 Music & Hiking</p>
125
+ <div class="flex items-center mt-2 space-x-2">
126
+ <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Musician</span>
127
+ <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Outdoors</span>
128
+ </div>
129
+ </div>
130
+ <button class="info-btn absolute top-4 right-4 w-10 h-10 bg-white/20 backdrop-blur rounded-full flex items-center justify-center text-white hover:bg-white/30">
131
+ <i data-feather="info" class="w-5 h-5"></i>
132
+ </button>
133
+ </div>
134
+ <div class="p-4">
135
+ <p class="text-gray-700 text-sm">"Guitar, mountains, and good vibes. Looking for someone to share playlists and trail views."</p>
136
+ </div>
137
+ </div>
138
+
139
+ <!-- Card 3 -->
140
+ <div class="profile-card absolute inset-0 bg-white rounded-2xl shadow-lg overflow-hidden" data-user-id="3">
141
+ <div class="relative h-3/4">
142
+ <img src="http://static.photos/people/640x360/789" alt="Jordan" class="w-full h-full object-cover">
143
+ <div class="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent"></div>
144
+ <div class="absolute bottom-4 left-4 text-white">
145
+ <h3 class="text-2xl font-bold">Jordan, 21</h3>
146
+ <p class="text-sm opacity-90">🎮 Gaming & Tech</p>
147
+ <div class="flex items-center mt-2 space-x-2">
148
+ <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Gamer</span>
149
+ <span class="px-2 py-1 bg-white/20 backdrop-blur rounded-full text-xs">Techie</span>
150
+ </div>
151
+ </div>
152
+ <button class="info-btn absolute top-4 right-4 w-10 h-10 bg-white/20 backdrop-blur rounded-full flex items-center justify-center text-white hover:bg-white/30">
153
+ <i data-feather="info" class="w-5 h-5"></i>
154
+ </button>
155
+ </div>
156
+ <div class="p-4">
157
+ <p class="text-gray-700 text-sm">"Coding by day, gaming by night. Let's team up in life and in co-op games!"</p>
158
+ </div>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <!-- Action Buttons -->
164
+ <div class="flex justify-center items-center space-x-6">
165
+ <button id="pass-btn" class="action-button w-16 h-16 bg-gray-200 rounded-full flex items-center justify-center text-gray-600 hover:bg-gray-300" aria-label="Pass">
166
+ <i data-feather="x" class="w-8 h-8"></i>
167
+ </button>
168
+ <button id="like-btn" class="action-button w-16 h-16 bg-red-500 rounded-full flex items-center justify-center text-white hover:bg-red-600" aria-label="Like">
169
+ <i data-feather="heart" class="w-8 h-8"></i>
170
+ </button>
171
+ <button id="superspark-btn" class="action-button w-16 h-16 bg-purple-500 rounded-full flex items-center justify-center text-white hover:bg-purple-600 relative" aria-label="Super Spark">
172
+ <i data-feather="zap" class="w-8 h-8 spark-animation"></i>
173
+ <span class="absolute -top-1 -right-1 w-5 h-5 bg-yellow-400 rounded-full text-xs flex items-center justify-center font-bold">3</span>
174
+ </button>
175
+ </div>
176
+ </div>
177
+
178
+ <!-- Match Modal -->
179
+ <div id="match-modal" class="match-modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
180
+ <div class="bg-white rounded-2xl max-w-sm w-full p-6 text-center relative overflow-hidden">
181
+ <div class="absolute inset-0 bg-gradient-to-r from-purple-400 to-pink-400 opacity-10"></div>
182
+ <div class="relative z-10">
183
+ <div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-gradient-to-r from-purple-400 to-pink-400 mb-4">
184
+ <i data-feather="heart" class="h-8 w-8 text-white"></i>
185
+ </div>
186
+ <h2 class="text-2xl font-bold mb-2">It's a Match! 🔥</h2>
187
+ <p class="text-gray-600 mb-6">You and Sarah both liked each other. Ready to spark a convo?</p>
188
+ <div class="flex space-x-3">
189
+ <button id="send-message-btn" class="flex-1 px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
190
+ Send Message
191
+ </button>
192
+ <button id="keep-swiping-btn" class="flex-1 px-6 py-3 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors">
193
+ Keep Swiping
194
+ </button>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div>
199
+
200
+ <!-- Profile Info Modal -->
201
+ <div id="info-modal" class="match-modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
202
+ <div class="bg-white rounded-2xl max-w-sm w-full max-h-[80vh] overflow-y-auto">
203
+ <div class="p-6">
204
+ <div class="flex justify-between items-start mb-4">
205
+ <div>
206
+ <h3 id="info-name" class="text-xl font-bold"></h3>
207
+ <p id="info-bio" class="text-gray-600 mt-1"></p>
208
+ </div>
209
+ <button id="close-info-btn" class="text-gray-400 hover:text-gray-600">
210
+ <i data-feather="x" class="w-6 h-6"></i>
211
+ </button>
212
+ </div>
213
+ <div id="info-details" class="space-y-3">
214
+ <!-- Dynamic content will be inserted here -->
215
+ </div>
216
+ <div class="mt-6 flex space-x-3">
217
+ <button class="flex-1 px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors">
218
+ <i data-feather="message-circle" class="w-4 h-4 inline mr-2"></i>Message
219
+ </button>
220
+ <button class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition-colors">
221
+ <i data-feather="share" class="w-4 h-4"></i>
222
+ </button>
223
+ </div>
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+ <script>
229
+ // Initialize Feather Icons
230
+ feather.replace();
231
+
232
+ // Card stack management
233
+ let currentCardIndex = 0;
234
+ const cards = document.querySelectorAll('.profile-card');
235
+ const totalCards = cards.length;
236
+
237
+ // Analytics tracking
238
+ function trackEvent(eventName, properties = {}) {
239
+ console.log('Analytics:', eventName, properties);
240
+ // In production, send to Mixpanel/Amplitude
241
+ }
242
+
243
+ // Card interaction functions
244
+ function handleSwipe(direction) {
245
+ const currentCard = cards[currentCardIndex];
246
+ if (!currentCard) return;
247
+
248
+ const userId = currentCard.dataset.userId;
249
+
250
+ // Add swipe animation class
251
+ currentCard.classList.add(`swipe-${direction}`);
252
+
253
+ // Track event
254
+ trackEvent(`discovery_${direction}`, {
255
+ userId,
256
+ method: direction === 'up' ? 'superspark' : direction
257
+ });
258
+
259
+ // Remove card after animation
260
+ setTimeout(() => {
261
+ currentCard.style.display = 'none';
262
+ currentCardIndex++;
263
+
264
+ // Check if we need to load more cards
265
+ if (currentCardIndex >= totalCards) {
266
+ // In production, load more profiles
267
+ console.log('No more profiles to show');
268
+ }
269
+ }, 300);
270
+
271
+ // Check for match (simulated)
272
+ if (direction === 'right' || direction === 'up') {
273
+ setTimeout(() => {
274
+ if (Math.random() > 0.7) { // 30% chance of match
275
+ showMatchModal();
276
+ }
277
+ }, 500);
278
+ }
279
+ }
280
+
281
+ function showMatchModal() {
282
+ const modal = document.getElementById('match-modal');
283
+ modal.classList.remove('hidden');
284
+ trackEvent('match_created', { matchId: 'match_123' });
285
+
286
+ // Animate match modal
287
+ anime({
288
+ targets: '#match-modal > div',
289
+ scale: [0.8, 1],
290
+ opacity: [0, 1],
291
+ duration: 500,
292
+ easing: 'easeOutElastic(1, .5)'
293
+ });
294
+ }
295
+
296
+ function showInfoModal(card) {
297
+ const modal = document.getElementById('info-modal');
298
+ const name = card.querySelector('h3').textContent;
299
+ const bio = card.querySelector('p').textContent;
300
+ const tags = Array.from(card.querySelectorAll('span')).map(span => span.textContent);
301
+
302
+ document.getElementById('info-name').textContent = name;
303
+ document.getElementById('info-bio').textContent = bio;
304
+
305
+ const detailsHtml = `
306
+ <div class="flex flex-wrap gap-2 mb-4">
307
+ ${tags.map(tag => `<span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">${tag}</span>`).join('')}
308
+ </div>
309
+ <div class="space-y-2 text-sm">
310
+ <div class="flex items-center">
311
+ <i data-feather="map-pin" class="w-4 h-4 mr-2 text-gray-400"></i>
312
+ <span>2 miles away</span>
313
+ </div>
314
+ <div class="flex items-center">
315
+ <i data-feather="briefcase" class="w-4 h-4 mr-2 text-gray-400"></i>
316
+ <span>Student at University</span>
317
+ </div>
318
+ <div class="flex items-center">
319
+ <i data-feather="music" class="w-4 h-4 mr-2 text-gray-400"></i>
320
+ <span>Indie, Alternative</span>
321
+ </div>
322
+ </div>
323
+ `;
324
+
325
+ document.getElementById('info-details').innerHTML = detailsHtml;
326
+ modal.classList.remove('hidden');
327
+ trackEvent('discovery_info_open', { userId: card.dataset.userId });
328
+
329
+ // Re-render feather icons in modal
330
+ feather.replace();
331
+ }
332
+
333
+ // Button event listeners
334
+ document.getElementById('pass-btn').addEventListener('click', () => handleSwipe('left'));
335
+ document.getElementById('like-btn').addEventListener('click', () => handleSwipe('right'));
336
+ document.getElementById('superspark-btn').addEventListener('click', () => handleSwipe('up'));
337
+
338
+ // Match modal buttons
339
+ document.getElementById('send-message-btn').addEventListener('click', () => {
340
+ trackEvent('profile_message_open', { matchId: 'match_123' });
341
+ window.location.href = 'chat.html?matchId=match_123';
342
+ });
343
+
344
+ document.getElementById('keep-swiping-btn').addEventListener('click', () => {
345
+ document.getElementById('match-modal').classList.add('hidden');
346
+ });
347
+
348
+ // Info modal
349
+ document.querySelectorAll('.info-btn').forEach(btn => {
350
+ btn.addEventListener('click', (e) => {
351
+ e.stopPropagation();
352
+ const card = btn.closest('.profile-card');
353
+ show