-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.html
More file actions
754 lines (708 loc) · 51.3 KB
/
dashboard.html
File metadata and controls
754 lines (708 loc) · 51.3 KB
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
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard | LinkStack - Manage Your Digital Identity</title>
<meta name="description" content="Manage your LinkStack profile, track your analytics, and customize your digital presence from your personal dashboard.">
<meta name="keywords" content="linkstack dashboard, bio link editor, creator analytics, link in bio management">
<meta name="author" content="James Theakston">
<meta name="robots" content="noindex, nofollow">
<link rel="canonical" href="https://link-stack.pages.dev/dashboard">
<meta property="og:type" content="website">
<meta property="og:url" content="https://link-stack.pages.dev/dashboard">
<meta property="og:title" content="LinkStack Dashboard | Your Digital Identity Hub">
<meta property="og:description" content="Everything you are in one simple link. Manage your stack and view real-time analytics.">
<meta property="og:image" content="https://link-stack.pages.dev/og-preview.jpg">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://link-stack.pages.dev/dashboard">
<meta property="twitter:title" content="LinkStack Dashboard | Your Digital Identity Hub">
<meta property="twitter:description" content="Everything you are in one simple link. Manage your stack and view real-time analytics.">
<meta property="twitter:image" content="https://link-stack.pages.dev/og-preview.jpg">
<link rel="icon" type="image/svg+xml" href="<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#6366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 2 7 12 12 22 7 12 2'/><polyline points='2 17 12 22 22 17'/><polyline points='2 12 12 17 22 12'/></svg>">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src='https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css' rel='stylesheet' />
<style>
.glass { background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.1); }
.hidden { display: none !important; }
.active-tab { border-bottom: 3px solid #6366f1; color: #6366f1; }
#phone-preview { transition: all 0.4s ease; background-size: cover; background-position: center; position: sticky; top: 100px; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.modal-bg { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); }
.theme-card { cursor: pointer; transition: all 0.2s; border: 4px solid transparent; height: 80px; display: flex; align-items: center; justify-content: center; border-radius: 1.25rem; }
.theme-card.active { border-color: #6366f1; transform: scale(1.05); z-index: 10; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
#map { width: 100%; height: 280px; border-radius: 1.5rem; }
#jasper-chat-window { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); transform: translateY(20px) scale(0.95); opacity: 0; pointer-events: none; }
#jasper-chat-window.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.animate-spin-slow { animation: spin 3s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.sparkle-btn { background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); }
.typing-dot { width: 4px; height: 4px; background: #94a3b8; border-radius: 50%; animation: blink 1.4s infinite both; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
</style>
</head>
<div id="handle-modal" class="hidden fixed inset-0 z-[200] flex items-center justify-center p-4 modal-bg">
<div class="bg-white rounded-[2.5rem] p-10 w-full max-w-md shadow-2xl text-center">
<div class="w-20 h-20 bg-indigo-50 text-indigo-600 rounded-3xl flex items-center justify-center mx-auto mb-6">
<i data-feather="globe" class="w-10 h-10"></i>
</div>
<h3 class="text-3xl font-black mb-3 text-slate-900">Be Visible to the world</h3>
<p class="text-slate-500 mb-8 text-sm leading-relaxed">Add your profile handle to be visible to the world and start building your stack.</p>
<div class="relative mb-6">
<span class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 font-bold">@</span>
<input type="text" id="setup-handle-input" placeholder="yourname" class="w-full pl-10 pr-4 py-4 bg-slate-50 border border-slate-100 rounded-2xl outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<button id="setup-handle-btn" class="w-full py-5 bg-indigo-600 text-white font-black rounded-2xl hover:bg-indigo-700 transition shadow-lg shadow-indigo-200">
Continue to Dashboard
</button>
</div>
</div>
<div id="modal-container" class="hidden fixed inset-0 z-[100] flex items-center justify-center p-4 modal-bg">
<div class="bg-white rounded-[2rem] p-8 w-full max-w-md shadow-2xl text-center relative">
<button id="close-modal-btn" class="absolute top-6 right-6 p-2 hover:bg-slate-100 rounded-full transition text-slate-400">
<i data-feather="x" class="w-5 h-5"></i>
</button>
<div id="modal-icon-container" class="w-16 h-16 bg-indigo-50 text-indigo-600 rounded-2xl flex items-center justify-center mx-auto mb-6">
<i id="modal-feather-icon" data-feather="bell" class="w-8 h-8"></i>
</div>
<h3 id="modal-title" class="text-2xl font-black mb-2">Notification</h3>
<p id="modal-message" class="text-slate-600 mb-8 text-sm leading-relaxed"></p>
<button id="dismiss-modal-btn" class="w-full py-4 bg-slate-900 text-white font-bold rounded-2xl hover:bg-slate-800 transition">
Dismiss
</button>
</div>
</div>
<nav class="fixed top-0 w-full z-40 glass border-b border-slate-200 py-4 px-8 flex justify-between items-center">
<div class="flex items-center gap-2 font-black text-2xl text-indigo-600 cursor-pointer" id="logo-refresh">
<i data-feather="layers"></i><span>LinkStack</span>
</div>
<button id="logout-btn" class="px-5 py-2 bg-red-50 text-red-600 rounded-xl text-xs font-bold border border-red-100 flex items-center gap-2 hover:bg-red-100 transition">
<i data-feather="log-out" class="w-4 h-4"></i> Sign Out
</button>
</nav>
<main class="pt-24 pb-12 px-6 max-w-7xl mx-auto">
<section class="grid lg:grid-cols-12 gap-12">
<div class="lg:col-span-7 space-y-8">
<div class="bg-indigo-600 p-6 rounded-[2rem] text-white flex flex-col md:flex-row items-center justify-between gap-4 shadow-xl">
<div class="truncate">
<p class="text-[10px] font-black uppercase tracking-widest opacity-70 mb-1">Your Profile URL</p>
<p id="public-url-display" class="font-mono text-sm font-bold truncate">https://link-stack.pages.dev/?u=...</p>
</div>
<button id="copy-link-btn" class="whitespace-nowrap px-6 py-3 bg-white text-indigo-600 rounded-xl font-black text-xs flex items-center gap-2 hover:bg-indigo-50 transition">
<i data-feather="copy" class="w-4 h-4"></i> Copy Link
</button>
</div>
<div class="flex border-b border-slate-200 overflow-x-auto scrollbar-hide gap-8">
<button id="tab-links" class="pb-4 font-bold active-tab whitespace-nowrap transition">Links</button>
<button id="tab-socials" class="pb-4 font-bold text-slate-400 whitespace-nowrap transition">Socials</button>
<button id="tab-style" class="pb-4 font-bold text-slate-400 whitespace-nowrap transition">Style</button>
<button id="tab-verification" class="pb-4 font-bold text-slate-400 whitespace-nowrap transition">Verification</button>
<button id="tab-business" class="pb-4 font-bold text-slate-400 whitespace-nowrap transition">Analytics</button>
</div>
<div id="section-links" class="space-y-6">
<div class="bg-white p-8 rounded-[2.5rem] border border-slate-100 shadow-sm">
<h3 class="text-lg font-black mb-4">Add New Link</h3>
<div class="grid gap-3">
<input type="text" id="link-label" placeholder="Link Label" class="w-full px-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2 focus:ring-indigo-500">
<input type="url" id="link-url" placeholder="URL (https://...)" class="w-full px-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2 focus:ring-indigo-500">
<button id="add-link-btn" class="w-full bg-slate-900 text-white py-4 rounded-2xl font-black mt-2 flex items-center justify-center gap-2 hover:bg-slate-800 transition">
<i data-feather="plus"></i> Add to Stack
</button>
</div>
</div>
<div id="links-editor-list" class="space-y-3"></div>
</div>
<div id="section-socials" class="hidden space-y-6">
<div class="bg-white p-8 rounded-[2.5rem] border border-slate-100 shadow-sm">
<h3 class="text-lg font-black mb-6">Social Links</h3>
<div class="space-y-4">
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="instagram" class="w-5 h-5"></i></div>
<input type="text" id="social-instagram" placeholder="Instagram Username" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="youtube" class="w-5 h-5"></i></div>
<input type="text" id="social-youtube" placeholder="YouTube Channel Handle" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="twitter" class="w-5 h-5"></i></div>
<input type="text" id="social-twitter" placeholder="X (Twitter) Username" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
<div id="pro-socials-container" class="space-y-4 hidden border-t border-slate-100 pt-6">
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="music" class="w-5 h-5"></i></div>
<input type="text" id="social-tiktok" placeholder="TikTok Username" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="linkedin" class="w-5 h-5"></i></div>
<input type="text" id="social-linkedin" placeholder="LinkedIn Profile Slug" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="tv" class="w-5 h-5"></i></div>
<input type="text" id="social-twitch" placeholder="Twitch Channel Name" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="hash" class="w-5 h-5"></i></div>
<input type="text" id="social-discord" placeholder="Discord Invite Code" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
<div class="relative">
<div class="absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"><i data-feather="disc" class="w-5 h-5"></i></div>
<input type="text" id="social-spotify" placeholder="Spotify Artist/User URL" class="w-full pl-12 pr-4 py-3 bg-slate-50 border rounded-xl outline-none focus:ring-2">
</div>
</div>
<button id="save-socials-btn" class="w-full bg-slate-900 text-white py-4 rounded-2xl font-black mt-4 flex items-center justify-center gap-2 hover:bg-slate-800 transition">
<i data-feather="check"></i> Save Socials
</button>
</div>
</div>
<div id="socials-upsell" class="bg-indigo-600 p-8 rounded-[2.5rem] text-white flex items-center justify-between">
<div class="flex items-center gap-4">
<div class="w-12 h-12 bg-white/20 rounded-2xl flex items-center justify-center"><i data-feather="zap"></i></div>
<div>
<h4 class="font-black">Unlock more socials</h4>
<p class="text-white/70 text-xs">Twitch, Discord, TikTok & more</p>
</div>
</div>
<button onclick="switchTab('business')" class="px-6 py-3 bg-white text-indigo-600 rounded-xl text-xs font-black">Upgrade</button>
</div>
</div>
<div id="section-style" class="hidden space-y-8">
<div class="bg-white p-8 rounded-[2.5rem] border border-slate-100 shadow-sm">
<h3 class="text-lg font-black mb-6">Identity</h3>
<div class="space-y-4">
<input type="text" id="profile-handle" class="w-full px-4 py-3 bg-slate-50 border rounded-xl outline-none" placeholder="Handle">
<input type="url" id="profile-avatar-url" class="w-full px-4 py-3 bg-slate-50 border rounded-xl outline-none" placeholder="Avatar Image URL">
<textarea id="profile-bio" class="w-full px-4 py-3 bg-slate-50 border rounded-xl h-24 outline-none text-sm" placeholder="Tell the world about yourself..."></textarea>
<button id="save-profile-btn" class="w-full bg-indigo-600 text-white py-4 rounded-2xl font-black flex items-center justify-center gap-2 hover:bg-indigo-700 transition">
<i data-feather="save"></i> Save Appearance
</button>
</div>
</div>
<div class="bg-white p-8 rounded-[2.5rem] border border-slate-100 shadow-sm">
<h3 class="text-lg font-black mb-6">Themes</h3>
<div class="grid grid-cols-2 md:grid-cols-3 gap-4" id="themes-grid">
<div id="theme-default" class="theme-card bg-slate-900 text-white text-xs font-black uppercase">Midnight</div>
<div id="theme-sunset" class="theme-card bg-gradient-to-br from-orange-400 to-pink-600 text-white text-xs font-black uppercase">Sunset</div>
<div id="theme-glass" class="theme-card bg-slate-200 text-slate-800 text-xs font-black uppercase border-dashed border-2">Glass</div>
</div>
</div>
</div>
<div id="section-verification" class="hidden space-y-6">
<div class="bg-white p-8 rounded-[2.5rem] border border-slate-100 shadow-sm">
<h3 class="text-2xl font-black mb-2">Verification</h3>
<p class="text-slate-500 text-sm mb-8">Verification builds trust. Meet all criteria to unlock your badge.</p>
<div class="space-y-3" id="verification-checklist">
<div id="check-pro" class="flex items-center justify-between p-4 bg-slate-50 rounded-2xl">
<div class="flex items-center gap-3"><div class="status-icon"><i data-feather="circle"></i></div><span class="font-bold text-sm text-slate-700">Business Pro Status</span></div>
<button id="upgrade-shortcut-btn" class="text-xs font-black text-indigo-600">Upgrade</button>
</div>
<div id="check-bio" class="flex items-center justify-between p-4 bg-slate-50 rounded-2xl">
<div class="flex items-center gap-3"><div class="status-icon"><i data-feather="circle"></i></div><span class="font-bold text-sm text-slate-700">Profile Bio</span></div>
</div>
<div id="check-avatar" class="flex items-center justify-between p-4 bg-slate-50 rounded-2xl">
<div class="flex items-center gap-3"><div class="status-icon"><i data-feather="circle"></i></div><span class="font-bold text-sm text-slate-700">Profile Avatar</span></div>
</div>
<div id="check-links" class="flex items-center justify-between p-4 bg-slate-50 rounded-2xl">
<div class="flex items-center gap-3"><div class="status-icon"><i data-feather="circle"></i></div><span class="font-bold text-sm text-slate-700">2+ Active Links</span></div>
</div>
</div>
<div id="verification-action-area" class="mt-8"></div>
</div>
</div>
<div id="section-business" class="hidden space-y-6">
<div id="business-paywall">
<div class="bg-white p-12 rounded-[2.5rem] border border-slate-100 shadow-sm text-center">
<div class="w-20 h-20 bg-indigo-50 text-indigo-600 rounded-[2rem] flex items-center justify-center mx-auto mb-6"><i data-feather="bar-chart-2" class="w-10 h-10"></i></div>
<h3 class="text-3xl font-black mb-4">Unlock Business Pro</h3>
<p class="text-slate-500 mb-6 max-w-sm mx-auto">Get deep insights, visit tracking, and link performance stats.</p>
<p class="text-red-500 text-[10px] font-black uppercase tracking-widest mb-8">Strictly Prohibited: Impersonating registered businesses.</p>
<button id="upgrade-pro-btn" class="px-10 py-4 bg-indigo-600 text-white font-black rounded-2xl hover:bg-indigo-700 transition">Get Started for $0</button>
</div>
</div>
<div id="business-content" class="hidden space-y-6">
<div class="bg-white p-8 rounded-[2.5rem] border border-slate-100 shadow-sm">
<h3 class="text-2xl font-black mb-8">Analytics</h3>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
<div class="p-4 bg-slate-50 rounded-2xl text-center"><p class="text-[10px] font-bold text-slate-400 uppercase tracking-widest">Visits</p><p id="stat-visits" class="text-2xl font-black">0</p></div>
<div class="p-4 bg-slate-50 rounded-2xl text-center"><p class="text-[10px] font-bold text-slate-400 uppercase tracking-widest">Clicks</p><p id="stat-clicks" class="text-2xl font-black">0</p></div>
<div class="p-4 bg-slate-50 rounded-2xl text-center"><p class="text-[10px] font-bold text-slate-400 uppercase tracking-widest">CTR</p><p id="stat-ctr" class="text-2xl font-black">0%</p></div>
<div class="p-4 bg-slate-50 rounded-2xl text-center"><p class="text-[10px] font-bold text-slate-400 uppercase tracking-widest">Geo</p><p id="stat-countries" class="text-2xl font-black">0</p></div>
</div>
<div class="h-64 mb-8 bg-slate-50 rounded-3xl p-4"><canvas id="visitsChart"></canvas></div>
<div id="map" class="mb-8"></div>
<div class="pt-6 border-t border-slate-100 flex justify-between items-center">
<p class="text-xs text-slate-400 font-bold">Business Pro Active</p>
<button id="downgrade-btn" class="text-xs font-bold text-red-500 hover:text-red-700 transition">Switch back to Personal</button>
</div>
</div>
</div>
</div>
</div>
<div class="lg:col-span-5">
<div id="phone-preview" class="mx-auto w-[320px] h-[640px] rounded-[3.5rem] border-[8px] border-slate-800 shadow-2xl overflow-hidden flex flex-col">
<div class="flex-1 overflow-y-auto scrollbar-hide p-8 text-center flex flex-col items-center">
<div class="relative mt-6 mb-4">
<img id="preview-img" class="w-24 h-24 rounded-full border-4 border-white/10 shadow-xl object-cover bg-slate-700">
<div id="verification-badge-container" class="absolute -right-1 bottom-0"></div>
</div>
<h2 id="preview-name" class="font-black text-xl mb-1 tracking-tight"></h2>
<p id="preview-bio" class="text-[11px] opacity-80 px-4 mb-8"></p>
<div id="preview-socials" class="flex flex-wrap justify-center gap-4 mb-8"></div>
<div id="preview-links" class="w-full space-y-3"></div>
</div>
</div>
</div>
</section>
</main>
<div class="fixed bottom-6 right-6 z-[100] flex flex-col items-end gap-4">
<div id="jasper-chat-window" class="w-[350px] max-w-[calc(100vw-3rem)] h-[500px] bg-white rounded-[2.5rem] shadow-2xl border border-slate-100 flex flex-col overflow-hidden">
<div class="p-6 border-b border-slate-50 flex items-center justify-between bg-indigo-600 text-white">
<div class="flex items-center gap-3">
<div class="w-8 h-8 bg-white/20 rounded-full flex items-center justify-center">
<svg class="w-4 h-4 text-white" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2L14.8 8.2L21 11L14.8 13.8L12 20L9.2 13.8L3 11L9.2 8.2L12 2Z" fill="currentColor"/>
</svg>
</div>
<span class="font-black text-sm tracking-tight">Chat with Jasper</span>
</div>
<button id="close-jasper-btn" class="p-2 hover:bg-white/10 rounded-full transition"><i data-feather="x" class="w-4 h-4"></i></button>
</div>
<div id="jasper-messages" class="flex-1 p-6 overflow-y-auto scrollbar-hide space-y-4">
<div class="w-full h-full flex flex-col items-center justify-center text-center py-12" id="jasper-loading">
<div class="w-16 h-16 bg-slate-50 rounded-3xl flex items-center justify-center mb-4 text-slate-300"><i data-feather="loader" class="w-8 h-8 animate-spin-slow"></i></div>
<p class="text-slate-900 font-bold mb-1">Jasper is waking up</p>
<p class="text-slate-400 text-xs px-8">Analyzing your profile data...</p>
</div>
</div>
<div id="jasper-typing-indicator" class="hidden px-6 py-2">
<div class="bg-slate-50 w-fit px-4 py-3 rounded-2xl flex items-center gap-1.5">
<div class="typing-dot"></div>
<div class="typing-dot"></div>
<div class="typing-dot"></div>
</div>
</div>
<div class="p-6 border-t border-slate-50">
<form id="jasper-form" class="relative mb-3">
<input type="text" id="jasper-input" disabled placeholder="Type your message..." class="w-full pl-4 pr-12 py-3 bg-slate-50 border border-slate-100 rounded-xl text-sm outline-none">
<button type="submit" id="jasper-send" disabled class="absolute right-3 top-1/2 -translate-y-1/2 text-slate-300 transition-colors"><i data-feather="send" class="w-4 h-4"></i></button>
</form>
<div class="flex items-center justify-center gap-1.5 opacity-40">
<span class="text-[10px] font-black uppercase tracking-widest text-slate-500">Powered by Gemini 2.5 Flash</span>
</div>
</div>
</div>
<button id="toggle-jasper-btn" class="w-16 h-16 sparkle-btn text-white rounded-2xl shadow-xl hover:opacity-90 transition flex items-center justify-center hover:scale-105 active:scale-95">
<svg class="w-9 h-9" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11 2L13.8 8.2L20 11L13.8 13.8L11 20L8.2 13.8L2 11L8.2 8.2L11 2Z" fill="white"/>
<path d="M19 14L20 16.5L22.5 17.5L20 18.5L19 21L18 18.5L15.5 17.5L18 16.5L19 14Z" fill="white" opacity="0.65"/>
</svg>
</button>
</div>
<script type="module">
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
const MAPTILER_KEY = 'iFCe8tlBYnpPH7TsEpUI';
const SUPABASE_URL = 'https://xcicvuqdoztxhidwdmlc.supabase.co';
const SUPABASE_ANON_KEY = 'sb_publishable_DeSw5UHzjV444ZF6eMkB0g_taV-dynR';
const supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
let currentUser = null, selectedTheme = 'default', cachedProfile = null, cachedLinks = [], chartInstance = null, mapInstance = null;
// simple badges (kept short to avoid unclosed templating)
const goldBadge = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10" fill="#fbbf24"/><path d="M8 12l2 2 4-4" stroke="#111827" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
const standardBadge = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10" fill="#c7d2fe"/><path d="M8 12l2 2 4-4" stroke="#111827" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
const themeConfig = {
default: { bg: '#0f172a', btn: 'bg-white/10 text-white border-white/10', text: 'text-white' },
sunset: { bg: 'linear-gradient(135deg, #fb923c, #db2777)', btn: 'bg-white text-orange-600 border-transparent', text: 'text-white' },
glass: { bg: 'url(https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe) center/cover', btn: 'bg-white/20 backdrop-blur-md text-white border-white/30', text: 'text-white' }
};
window.toggleJasper = () => { document.getElementById('jasper-chat-window').classList.toggle('open'); feather.replace(); };
window.closeModal = () => { document.getElementById('modal-container').classList.add('hidden'); };
window.switchTab = (t) => {
['links','socials','style','business','verification'].forEach(s => {
document.getElementById('section-'+s)?.classList.add('hidden');
document.getElementById('tab-'+s)?.classList.remove('active-tab');
document.getElementById('tab-'+s)?.classList.add('text-slate-400');
});
document.getElementById('section-'+t)?.classList.remove('hidden');
document.getElementById('tab-'+t)?.classList.add('active-tab');
document.getElementById('tab-'+t)?.classList.remove('text-slate-400');
};
window.deleteLink = async (id) => { await supabaseClient.from('links').delete().eq('id', id); loadAll(); };
window.reorderLink = async (index, dir) => {
const newIdx = index + dir;
if(newIdx < 0 || newIdx >= cachedLinks.length) return;
const a = cachedLinks[index], b = cachedLinks[newIdx];
await supabaseClient.from('links').update({ order_index: newIdx }).eq('id', a.id);
await supabaseClient.from('links').update({ order_index: index }).eq('id', b.id);
loadAll();
};
async function init() {
const { data: { session } } = await supabaseClient.auth.getSession();
if (!session) return window.location.replace('/');
currentUser = session.user;
await loadAll();
initJasper();
setupEventListeners();
}
function setupEventListeners() {
document.getElementById('logout-btn').onclick = async () => { await supabaseClient.auth.signOut(); window.location.replace('/'); };
document.getElementById('logo-refresh').onclick = () => location.reload();
document.getElementById('close-modal-btn').onclick = window.closeModal;
document.getElementById('dismiss-modal-btn').onclick = window.closeModal;
document.getElementById('copy-link-btn').onclick = () => {
try {
navigator.clipboard.writeText(document.getElementById('public-url-display').innerText);
showModal("Copied", "Public URL copied!", "check-circle");
} catch (e) {
showModal("Error", "Could not copy to clipboard.", "x-circle");
}
};
document.getElementById('tab-links').onclick = () => switchTab('links');
document.getElementById('tab-socials').onclick = () => switchTab('socials');
document.getElementById('tab-style').onclick = () => switchTab('style');
document.getElementById('tab-verification').onclick = () => switchTab('verification');
document.getElementById('tab-business').onclick = () => switchTab('business');
document.getElementById('add-link-btn').onclick = async () => {
const label = document.getElementById('link-label').value.trim();
const url = document.getElementById('link-url').value.trim();
if(!label || !url || !currentUser) return;
await supabaseClient.from('links').insert([{ profile_id: currentUser.id, label, url, order_index: cachedLinks.length }]);
document.getElementById('link-label').value = '';
document.getElementById('link-url').value = '';
loadAll();
};
document.getElementById('save-socials-btn').onclick = async () => {
if(!currentUser) return;
const socials = {
instagram: document.getElementById('social-instagram').value.trim(),
youtube: document.getElementById('social-youtube').value.trim(),
twitter: document.getElementById('social-twitter').value.trim(),
tiktok: document.getElementById('social-tiktok').value.trim(),
linkedin: document.getElementById('social-linkedin').value.trim(),
twitch: document.getElementById('social-twitch').value.trim(),
discord: document.getElementById('social-discord').value.trim(),
spotify: document.getElementById('social-spotify').value.trim()
};
await supabaseClient.from('profiles').update({ socials_data: socials }).eq('id', currentUser.id);
loadAll();
showModal("Saved", "Social channels updated!", "check-circle");
};
document.getElementById('save-profile-btn').onclick = async () => {
if (!currentUser) return;
const updates = {
handle: document.getElementById('profile-handle').value.toLowerCase().replace(/[^a-z0-9]/g, ''),
avatar_url: document.getElementById('profile-avatar-url').value,
bio: document.getElementById('profile-bio').value,
theme_id: selectedTheme
};
await supabaseClient.from('profiles').update(updates).eq('id', currentUser.id);
loadAll();
showModal("Success", "Appearance updated!", "check");
};
document.getElementById('theme-default').onclick = () => setTheme('default');
document.getElementById('theme-sunset').onclick = () => setTheme('sunset');
document.getElementById('theme-glass').onclick = () => setTheme('glass');
document.getElementById('upgrade-shortcut-btn').onclick = () => switchTab('business');
document.getElementById('upgrade-pro-btn').onclick = () => {
window.location.href = '/business';
};
document.getElementById('downgrade-btn').onclick = async () => {
if(!confirm("Are you sure? Verification and analytics will be disabled.")) return;
await supabaseClient.from('profiles').update({ is_business: false, is_verified: false }).eq('id', currentUser.id);
loadAll();
};
document.getElementById('close-jasper-btn').onclick = window.toggleJasper;
document.getElementById('toggle-jasper-btn').onclick = window.toggleJasper;
document.getElementById('jasper-form').onsubmit = handleJasperSubmit;
document.getElementById('setup-handle-btn').onclick = async () => {
const handle = document.getElementById('setup-handle-input').value.toLowerCase().replace(/[^a-z0-9]/g, '');
if (handle.length < 3) return showModal("Wait", "Handle must be at least 3 characters.", "alert-circle");
const { error } = await supabaseClient.from('profiles').update({ handle }).eq('id', currentUser.id);
if (error) return showModal("Error", "Handle might be taken. Try another.", "x-circle");
document.getElementById('handle-modal').classList.add('hidden');
loadAll();
};
}
async function handleJasperSubmit(e) {
e.preventDefault();
const input = document.getElementById('jasper-input');
const query = input.value.trim();
if (!query) return;
const msgContainer = document.getElementById('jasper-messages');
const typingIndicator = document.getElementById('jasper-typing-indicator');
msgContainer.innerHTML += `<div class="self-end bg-indigo-600 text-white p-3 rounded-2xl text-xs max-w-[80%] shadow-sm ml-auto">${escapeHtml(query)}</div>`;
input.value = '';
msgContainer.scrollTop = msgContainer.scrollHeight;
typingIndicator.classList.remove('hidden');
msgContainer.scrollTop = msgContainer.scrollHeight;
try {
const { data: { session } } = await supabaseClient.auth.getSession();
if (!session) throw new Error("No session");
const { data, error } = await supabaseClient.functions.invoke('jasper-chat', {
headers: { Authorization: `Bearer ${session.access_token}` },
body: { message: query, context: { profile: cachedProfile, links: cachedLinks } }
});
if (error) throw error;
typingIndicator.classList.add('hidden');
msgContainer.innerHTML += `<div class="self-start bg-slate-100 text-slate-800 p-3 rounded-2xl text-xs max-w-[80%] shadow-sm">${escapeHtml(data.reply || 'Sorry, no response')}</div>`;
} catch (err) {
console.error("Jasper Error:", err);
typingIndicator.classList.add('hidden');
msgContainer.innerHTML += `<div class="self-start bg-red-50 text-red-600 p-3 rounded-2xl text-xs max-w-[80%] border border-red-100 italic">Trouble connecting to Jasper. Please try again later.</div>`;
}
msgContainer.scrollTop = msgContainer.scrollHeight;
}
function initJasper() {
const jasperInput = document.getElementById('jasper-input');
const jasperSend = document.getElementById('jasper-send');
const jasperLoading = document.getElementById('jasper-loading');
const jasperMessages = document.getElementById('jasper-messages');
if (jasperInput && jasperSend) {
jasperInput.disabled = false;
jasperInput.classList.remove('opacity-50', 'bg-slate-50');
jasperInput.classList.add('bg-white');
jasperSend.disabled = false;
jasperSend.classList.remove('text-slate-300');
jasperSend.classList.add('text-indigo-600');
if (jasperLoading) jasperLoading.remove();
if (!jasperMessages.querySelector('.jasper-welcome')) {
jasperMessages.innerHTML = `<div class="jasper-welcome self-start bg-slate-100 text-slate-800 p-3 rounded-2xl text-xs max-w-[80%] shadow-sm">Hey there! I'm Jasper. I can analyse your profile and suggest improvements.</div>`;
}
}
}
async function loadAll() {
if (!currentUser) return;
let { data: p } = await supabaseClient.from('profiles').select('*').eq('id', currentUser.id).maybeSingle();
if (!p) {
const { data: newP } = await supabaseClient.from('profiles').insert([{ id: currentUser.id, theme_id: 'default' }]).select().single();
p = newP;
}
if (!p.handle) {
document.getElementById('handle-modal').classList.remove('hidden');
feather.replace();
}
const { data: links } = await supabaseClient.from('links').select('*').eq('profile_id', currentUser.id).order('order_index', { ascending: true });
cachedProfile = p;
cachedLinks = links || [];
selectedTheme = p.theme_id || 'default';
updateForms();
updatePreview();
updateVerification();
if (p.is_business) {
document.getElementById('business-content').classList.remove('hidden');
document.getElementById('business-paywall').classList.add('hidden');
document.getElementById('pro-socials-container').classList.remove('hidden');
document.getElementById('socials-upsell').classList.add('hidden');
setTimeout(loadAnalytics, 100);
} else {
document.getElementById('business-paywall').classList.remove('hidden');
document.getElementById('business-content').classList.add('hidden');
document.getElementById('pro-socials-container').classList.add('hidden');
document.getElementById('socials-upsell').classList.remove('hidden');
}
feather.replace();
}
function updateForms() {
const p = cachedProfile;
if(!p) return;
document.getElementById('profile-handle').value = p.handle || '';
document.getElementById('profile-avatar-url').value = p.avatar_url || '';
document.getElementById('profile-bio').value = p.bio || '';
document.getElementById('public-url-display').innerText = `https://link-stack.pages.dev/?u=${p.handle || '...'}`;
const sd = p.socials_data || {};
document.getElementById('social-instagram').value = sd.instagram || '';
document.getElementById('social-youtube').value = sd.youtube || '';
document.getElementById('social-twitter').value = sd.twitter || '';
document.getElementById('social-tiktok').value = sd.tiktok || '';
document.getElementById('social-linkedin').value = sd.linkedin || '';
document.getElementById('social-twitch').value = sd.twitch || '';
document.getElementById('social-discord').value = sd.discord || '';
document.getElementById('social-spotify').value = sd.spotify || '';
document.getElementById('links-editor-list').innerHTML = cachedLinks.map((l, index) => `
<div class="flex justify-between items-center p-4 bg-white rounded-2xl border border-slate-100 shadow-sm">
<div class="flex items-center gap-3">
<div class="flex flex-col text-slate-300">
<button onclick="reorderLink(${index}, -1)" class="hover:text-indigo-600"><i data-feather="chevron-up" class="w-4 h-4"></i></button>
<button onclick="reorderLink(${index}, 1)" class="hover:text-indigo-600"><i data-feather="chevron-down" class="w-4 h-4"></i></button>
</div>
<p class="font-bold text-sm">${escapeHtml(l.label)}</p>
</div>
<button onclick="deleteLink('${l.id}')" class="text-red-400 p-2 hover:bg-red-50 rounded-lg transition"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</div>
`).join('');
feather.replace();
}
function updateVerification() {
const p = cachedProfile;
if(!p) return;
const checks = { pro: p.is_business, bio: !!p.bio && p.bio.length > 3, avatar: !!p.avatar_url, links: cachedLinks.length >= 2 };
const updateItem = (id, met) => {
const el = document.getElementById(id);
if (!el) return;
el.querySelector('.status-icon').innerHTML = met ? `<i data-feather="check-circle" class="text-green-500"></i>` : `<i data-feather="circle" class="text-slate-300"></i>`;
el.className = `flex items-center justify-between p-4 rounded-2xl ${met ? 'bg-green-50' : 'bg-slate-50'}`;
};
updateItem('check-pro', checks.pro);
updateItem('check-bio', checks.bio);
updateItem('check-avatar', checks.avatar);
updateItem('check-links', checks.links);
const allMet = Object.values(checks).every(v => v === true);
const actionArea = document.getElementById('verification-action-area');
if (!actionArea) return;
if (p.is_verified) actionArea.innerHTML = `<div class="p-6 bg-indigo-50 rounded-3xl text-center font-black text-indigo-600 border border-indigo-100">Verified Member</div>`;
else if (allMet) {
const btn = document.createElement('button');
btn.className = "w-full py-5 bg-indigo-600 text-white font-black rounded-2xl shadow-xl hover:bg-indigo-700 transition";
btn.innerText = "Claim Badge";
btn.onclick = async () => { if(!currentUser) return; await supabaseClient.from('profiles').update({ is_verified: true }).eq('id', currentUser.id); loadAll(); };
actionArea.innerHTML = '';
actionArea.appendChild(btn);
} else actionArea.innerHTML = `<div class="p-6 bg-slate-100 rounded-3xl text-center text-slate-400 text-xs font-bold">Complete all tasks to verify</div>`;
feather.replace();
}
function updatePreview() {
const p = cachedProfile;
if(!p) return;
const theme = themeConfig[selectedTheme] || themeConfig.default;
const preview = document.getElementById('phone-preview');
preview.style.background = theme.bg;
preview.style.backgroundSize = 'cover';
preview.className = `mx-auto w-[320px] h-[640px] rounded-[3.5rem] border-[8px] border-slate-800 shadow-2xl overflow-hidden flex flex-col ${theme.text}`;
document.getElementById('preview-name').innerText = `@${p.handle || 'username'}`;
document.getElementById('preview-bio').innerText = p.bio || '';
document.getElementById('preview-img').src = p.avatar_url || `https://ui-avatars.com/api/?name=${encodeURIComponent(p.handle || 'U')}`;
const sd = p.socials_data || {};
const socialIcons = [
{ id: 'instagram', icon: 'instagram' },
{ id: 'youtube', icon: 'youtube' },
{ id: 'twitter', icon: 'twitter' },
{ id: 'tiktok', icon: 'music' },
{ id: 'linkedin', icon: 'linkedin' },
{ id: 'twitch', icon: 'tv' },
{ id: 'discord', icon: 'hash' },
{ id: 'spotify', icon: 'disc' }
];
const activeSocials = socialIcons.filter(s => sd[s.id]);
document.getElementById('preview-socials').innerHTML = activeSocials.map(s => `
<div class="w-8 h-8 rounded-full flex items-center justify-center border ${theme.btn} opacity-80 hover:opacity-100 transition-opacity">
<i data-feather="${s.icon}" class="w-4 h-4"></i>
</div>
`).join('');
document.getElementById('preview-links').innerHTML = cachedLinks.map(l => `<div class="p-3 rounded-xl border font-bold text-sm ${theme.btn}">${escapeHtml(l.label)}</div>`).join('');
const badge = document.getElementById('verification-badge-container');
badge.innerHTML = p.is_verified ? (p.handle === 'james' ? goldBadge : standardBadge) : '';
feather.replace();
}
async function loadAnalytics() {
if(!currentUser) return;
let visitsData = [];
let clicksData = [];
try {
const { data: v } = await supabaseClient.from('visits').select('*').eq('profile_id', currentUser.id);
visitsData = v || [];
} catch(e) {}
try {
const { data: c } = await supabaseClient.from('clicks').select('*').eq('profile_id', currentUser.id);
clicksData = c || [];
} catch(e) {}
const visitCount = visitsData.length;
const clickCount = clicksData.length;
const ctr = visitCount > 0 ? ((clickCount / visitCount) * 100).toFixed(1) : 0;
document.getElementById('stat-visits').innerText = visitCount;
document.getElementById('stat-clicks').innerText = clickCount;
document.getElementById('stat-ctr').innerText = ctr + '%';
const countryMap = {};
visitsData.forEach(v => { if(v.country) countryMap[v.country] = (countryMap[v.country] || 0) + 1; });
document.getElementById('stat-countries').innerText = Object.keys(countryMap).length;
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const visitFreq = [0,0,0,0,0,0,0];
visitsData.forEach(v => {
const d = new Date(v.created_at).getDay();
visitFreq[d]++;
});
const canvas = document.getElementById('visitsChart');
if (canvas) {
if (chartInstance) chartInstance.destroy();
chartInstance = new Chart(canvas.getContext('2d'), {
type: 'line',
data: {
labels: days,
datasets: [{
label: 'Visits',
data: visitFreq,
borderColor: '#6366f1',
backgroundColor: 'rgba(99, 102, 241, 0.1)',
fill: true,
tension: 0.4,
borderWidth: 3,
pointRadius: 4,
pointBackgroundColor: '#fff'
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: { legend: { display: false } },
scales: { y: { beginAtZero: true, grid: { display: false } }, x: { grid: { display: false } } }
}
});
}
const mapEl = document.getElementById('map');
if (mapEl) {
mapEl.innerHTML = '';
mapInstance = new maplibregl.Map({
container: 'map',
style: `https://api.maptiler.com/maps/streets/style.json?key=${MAPTILER_KEY}`,
center: [0, 20],
zoom: 1
});
const countryCoords = {
'US': [-95.7, 37.1],
'GB': [-3.4, 55.4],
'FR': [2.2, 46.2],
'DE': [10.5, 51.2],
'IN': [79.0, 20.6],
'CA': [-106.3, 56.1],
'AU': [133.8, -25.3],
'BR': [-51.9, -14.2],
'CN': [104.2, 35.9]
};
Object.entries(countryMap).forEach(([code, count]) => {
const coords = countryCoords[code] || [0, 0];
if(coords[0] !== 0) {
const el = document.createElement('div');
el.className = 'w-6 h-6 bg-indigo-600 rounded-full border-2 border-white shadow-lg flex items-center justify-center text-[8px] text-white font-bold';
el.innerText = count;
new maplibregl.Marker(el).setLngLat(coords).addTo(mapInstance);
}
});
}
}
function setTheme(id) {
selectedTheme = id;
document.querySelectorAll('.theme-card').forEach(c => c.classList.remove('active'));
const el = document.getElementById('theme-' + id);
if (el) el.classList.add('active');
updatePreview();
}
function showModal(t, m, i) {
document.getElementById('modal-title').innerText = t;
document.getElementById('modal-message').innerText = m;
if (i) document.getElementById('modal-feather-icon').setAttribute('data-feather', i);
document.getElementById('modal-container').classList.remove('hidden');
feather.replace();
}
// small helper for safely inserting user content into innerHTML snippets
function escapeHtml(str) {
if (typeof str !== 'string') return '';
return str.replace(/[&<>"']/g, function (s) {
return ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[s];
});
}
init();
</script>
</body>
</html>