Spaces:
Paused
Paused
CBV01 commited on
Commit ·
460b327
1
Parent(s): bee7763
UI Overhaul: Premium account cards with grid-based actions and Paystack gateway stability fix
Browse files
frontend/src/app/accounts/page.tsx
CHANGED
|
@@ -371,140 +371,145 @@ export default function AccountsPage() {
|
|
| 371 |
) : (
|
| 372 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 animate-in fade-in slide-in-from-bottom-8 duration-1000">
|
| 373 |
{accounts.map((acc) => (
|
| 374 |
-
<div key={acc.phone_number} className="bg-
|
| 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 |
-
</div>
|
| 405 |
</div>
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
|
|
|
|
|
|
|
|
|
| 410 |
{acc.profile_photo ? (
|
| 411 |
<img
|
| 412 |
src={acc.profile_photo.startsWith('http') ? acc.profile_photo : (process.env.NEXT_PUBLIC_API_URL ? `${process.env.NEXT_PUBLIC_API_URL}${acc.profile_photo}` : `http://localhost:8000${acc.profile_photo}`)}
|
| 413 |
-
className="w-full h-full rounded-
|
| 414 |
onError={(e) => {
|
| 415 |
const target = e.target as any;
|
| 416 |
target.src = `https://ui-avatars.com/api/?name=${encodeURIComponent(acc.first_name || 'A')}&background=6366f1&color=fff`;
|
| 417 |
}}
|
| 418 |
/>
|
| 419 |
) : (
|
| 420 |
-
<div className="w-full h-full rounded-
|
| 421 |
<Users size={32} />
|
| 422 |
</div>
|
| 423 |
)}
|
| 424 |
</div>
|
| 425 |
-
<h4 className="text-lg font-bold text-white tracking-tight px-4 text-center">{acc.first_name || 'Account'} {acc.last_name || ''}</h4>
|
| 426 |
-
<p className="text-[10px] font-black text-indigo-500 uppercase tracking-widest mt-1 max-w-full truncate px-4">@{acc.username || 'unknown_node'}</p>
|
| 427 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
<
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
<div className="flex flex-col gap-2.5">
|
| 437 |
-
<div className="flex items-center gap-3 text-xs font-bold text-foreground/70">
|
| 438 |
-
<div className="w-7 h-7 rounded-lg bg-indigo-500/10 flex items-center justify-center text-indigo-500"><Phone size={14} /></div>
|
| 439 |
-
{acc.phone_number}
|
| 440 |
</div>
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
<button
|
| 445 |
-
onClick={() => handleSyncProfile(acc.phone_number)}
|
| 446 |
-
className="col-span-1 p-3 bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-500 rounded-2xl flex items-center justify-center transition-all border border-indigo-500/10"
|
| 447 |
-
title="Sync Profile"
|
| 448 |
-
>
|
| 449 |
-
{actionLoading === acc.phone_number + '_sync' ? <Loader2 size={14} className="animate-spin" /> : <CloudSync size={16} />}
|
| 450 |
-
</button>
|
| 451 |
-
<button
|
| 452 |
-
onClick={() => handleValidateSession(acc.phone_number)}
|
| 453 |
-
className="col-span-1 p-3 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 rounded-2xl flex items-center justify-center transition-all border border-emerald-500/10"
|
| 454 |
-
title="Pulse Check"
|
| 455 |
-
>
|
| 456 |
-
{actionLoading === acc.phone_number + '_valid' ? <Loader2 size={14} className="animate-spin" /> : <Rocket size={16} />}
|
| 457 |
-
</button>
|
| 458 |
-
<button
|
| 459 |
-
onClick={() => handleSessionDump(acc.phone_number)}
|
| 460 |
-
className="col-span-1 p-3 bg-white/5 hover:bg-white/10 text-white/40 rounded-2xl flex items-center justify-center transition-all border border-white/10"
|
| 461 |
-
title="Export Key"
|
| 462 |
-
>
|
| 463 |
-
{actionLoading === acc.phone_number + '_dump' ? <Loader2 size={14} className="animate-spin" /> : <KeyRound size={16} />}
|
| 464 |
-
</button>
|
| 465 |
-
<button
|
| 466 |
-
onClick={() => handleDeleteAccount(acc.phone_number)}
|
| 467 |
-
className="col-span-1 p-3 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded-2xl flex items-center justify-center transition-all border border-red-500/10"
|
| 468 |
-
title="Delete"
|
| 469 |
-
>
|
| 470 |
-
{actionLoading === acc.phone_number ? <Loader2 size={14} className="animate-spin" /> : <X size={16} />}
|
| 471 |
-
</button>
|
| 472 |
</div>
|
| 473 |
</div>
|
|
|
|
|
|
|
|
|
|
| 474 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
<div className="flex
|
| 479 |
-
<div className="flex
|
| 480 |
-
<div className="
|
| 481 |
-
|
| 482 |
-
Identity Lock
|
| 483 |
-
</div>
|
| 484 |
-
{acc.status_detail && (
|
| 485 |
-
<p className="text-[8px] text-foreground/40 italic ml-4 leading-tight">{acc.status_detail}</p>
|
| 486 |
-
)}
|
| 487 |
-
</div>
|
| 488 |
-
<div className="flex flex-col items-end gap-1">
|
| 489 |
-
<div className="flex items-center gap-1.5 text-[9px] font-black text-foreground/30 uppercase">
|
| 490 |
-
<Rocket size={12} className="text-indigo-500" />
|
| 491 |
-
Last Active
|
| 492 |
-
</div>
|
| 493 |
-
<span className="text-[8px] font-bold text-foreground/20">
|
| 494 |
-
{acc.last_active ? new Date(acc.last_active).toLocaleTimeString() : 'N/A'}
|
| 495 |
-
</span>
|
| 496 |
</div>
|
|
|
|
| 497 |
</div>
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
<
|
| 503 |
-
|
| 504 |
-
|
|
|
|
| 505 |
</div>
|
| 506 |
</div>
|
| 507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
</div>
|
| 509 |
)}
|
| 510 |
|
|
|
|
| 371 |
) : (
|
| 372 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 animate-in fade-in slide-in-from-bottom-8 duration-1000">
|
| 373 |
{accounts.map((acc) => (
|
| 374 |
+
<div key={acc.phone_number} className="bg-[#111115] border border-white/5 rounded-[2.5rem] p-6 group relative hover:shadow-2xl hover:shadow-indigo-500/10 transition-all duration-500 flex flex-col min-h-[520px]">
|
| 375 |
+
{/* Header: Status and Active Indicator */}
|
| 376 |
+
<div className="flex justify-between items-center mb-8">
|
| 377 |
+
<span className={`px-4 py-1.5 text-[9px] font-black rounded-full flex items-center gap-2 uppercase tracking-widest transition-all ${
|
| 378 |
+
acc.status === 'active' ? 'bg-emerald-500/10 text-emerald-500 border border-emerald-500/20' :
|
| 379 |
+
(acc.status === 'resting' || acc.status === 'pending') ? 'bg-amber-500/10 text-amber-500 border border-amber-500/20' :
|
| 380 |
+
'bg-red-500/10 text-red-500 border border-red-500/20'
|
| 381 |
+
}`}>
|
| 382 |
+
<div className={`w-1.5 h-1.5 rounded-full ${
|
| 383 |
+
acc.status === 'active' ? 'bg-emerald-500 animate-pulse' :
|
| 384 |
+
(acc.status === 'resting' || acc.status === 'pending') ? 'bg-amber-500' :
|
| 385 |
+
'bg-red-500'
|
| 386 |
+
}`} />
|
| 387 |
+
{acc.status}
|
| 388 |
+
</span>
|
| 389 |
+
|
| 390 |
+
<div className="flex items-center gap-2">
|
| 391 |
+
{acc.is_active ? (
|
| 392 |
+
<div className="flex items-center gap-1.5 px-4 py-1.5 bg-indigo-500/10 text-indigo-500 rounded-full text-[9px] font-black uppercase tracking-widest border border-indigo-500/20">
|
| 393 |
+
<Star size={12} className="fill-indigo-500" />
|
| 394 |
+
Active
|
| 395 |
+
</div>
|
| 396 |
+
) : (
|
| 397 |
+
<button
|
| 398 |
+
onClick={() => handleSetActive(acc.phone_number)}
|
| 399 |
+
className="px-4 py-1.5 bg-white/5 hover:bg-white/10 text-foreground/40 hover:text-white rounded-full text-[9px] font-black uppercase tracking-widest transition-all border border-white/5 active:scale-95"
|
| 400 |
+
>
|
| 401 |
+
{actionLoading === acc.phone_number + '_active' ? <Loader2 size={10} className="animate-spin" /> : 'Activate'}
|
| 402 |
+
</button>
|
| 403 |
+
)}
|
|
|
|
| 404 |
</div>
|
| 405 |
+
</div>
|
| 406 |
+
|
| 407 |
+
{/* Profile Section */}
|
| 408 |
+
<div className="flex flex-col items-center mb-8">
|
| 409 |
+
<div className="relative mb-5 group-hover:scale-110 transition-transform duration-500">
|
| 410 |
+
<div className="absolute inset-0 bg-indigo-500/20 blur-2xl rounded-full opacity-0 group-hover:opacity-100 transition-opacity" />
|
| 411 |
+
<div className="relative w-24 h-24 rounded-[2.5rem] border-4 border-white/5 p-1 bg-[#18181b] shadow-2xl overflow-hidden flex items-center justify-center">
|
| 412 |
{acc.profile_photo ? (
|
| 413 |
<img
|
| 414 |
src={acc.profile_photo.startsWith('http') ? acc.profile_photo : (process.env.NEXT_PUBLIC_API_URL ? `${process.env.NEXT_PUBLIC_API_URL}${acc.profile_photo}` : `http://localhost:8000${acc.profile_photo}`)}
|
| 415 |
+
className="w-full h-full rounded-[2.2rem] object-cover"
|
| 416 |
onError={(e) => {
|
| 417 |
const target = e.target as any;
|
| 418 |
target.src = `https://ui-avatars.com/api/?name=${encodeURIComponent(acc.first_name || 'A')}&background=6366f1&color=fff`;
|
| 419 |
}}
|
| 420 |
/>
|
| 421 |
) : (
|
| 422 |
+
<div className="w-full h-full rounded-[2.2rem] bg-indigo-500/5 flex items-center justify-center text-indigo-500/40">
|
| 423 |
<Users size={32} />
|
| 424 |
</div>
|
| 425 |
)}
|
| 426 |
</div>
|
|
|
|
|
|
|
| 427 |
</div>
|
| 428 |
+
<h4 className="text-xl font-black text-white tracking-tight px-4 text-center leading-tight">
|
| 429 |
+
{acc.first_name || 'Neural'} {acc.last_name || 'Node'}
|
| 430 |
+
</h4>
|
| 431 |
+
<div className="mt-2 flex items-center gap-2 bg-indigo-500/5 px-3 py-1 rounded-full border border-indigo-500/10">
|
| 432 |
+
<span className="text-[10px] font-black text-indigo-400 uppercase tracking-[0.2em]">@{acc.username || 'arkitel_node'}</span>
|
| 433 |
+
</div>
|
| 434 |
+
</div>
|
| 435 |
|
| 436 |
+
{/* Info & Actions */}
|
| 437 |
+
<div className="bg-[#18181b] border border-white/5 rounded-[2.5rem] p-6 mb-8 flex-1 flex flex-col">
|
| 438 |
+
<div className="flex items-center justify-between mb-6">
|
| 439 |
+
<div className="flex items-center gap-3">
|
| 440 |
+
<div className="w-10 h-10 rounded-2xl bg-white/5 flex items-center justify-center text-white/40">
|
| 441 |
+
<Phone size={16} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
</div>
|
| 443 |
+
<div className="flex flex-col">
|
| 444 |
+
<span className="text-[9px] font-black text-white/20 uppercase tracking-widest leading-none mb-1 text-left">Identity</span>
|
| 445 |
+
<span className="text-xs font-bold text-white/70">{acc.phone_number}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
</div>
|
| 447 |
</div>
|
| 448 |
+
<div className="px-3 py-1 bg-white/5 rounded-lg border border-white/5">
|
| 449 |
+
<span className="text-[9px] font-black text-white/30 uppercase tracking-widest">{acc.country || 'GLOBAL'}</span>
|
| 450 |
+
</div>
|
| 451 |
</div>
|
| 452 |
+
|
| 453 |
+
<div className="mt-auto grid grid-cols-4 gap-3 pt-6 border-t border-white/5">
|
| 454 |
+
<button
|
| 455 |
+
onClick={() => handleSyncProfile(acc.phone_number)}
|
| 456 |
+
className="aspect-square bg-indigo-600/10 hover:bg-indigo-600 text-indigo-500 hover:text-white rounded-2xl flex items-center justify-center transition-all border border-indigo-500/10 active:scale-90"
|
| 457 |
+
title="Sync Profile"
|
| 458 |
+
>
|
| 459 |
+
{actionLoading === acc.phone_number + '_sync' ? <Loader2 size={16} className="animate-spin" /> : <CloudSync size={20} />}
|
| 460 |
+
</button>
|
| 461 |
+
<button
|
| 462 |
+
onClick={() => handleValidateSession(acc.phone_number)}
|
| 463 |
+
className="aspect-square bg-emerald-600/10 hover:bg-emerald-600 text-emerald-500 hover:text-white rounded-2xl flex items-center justify-center transition-all border border-emerald-500/10 active:scale-90"
|
| 464 |
+
title="Pulse Check"
|
| 465 |
+
>
|
| 466 |
+
{actionLoading === acc.phone_number + '_valid' ? <Loader2 size={16} className="animate-spin" /> : <Rocket size={20} />}
|
| 467 |
+
</button>
|
| 468 |
+
<button
|
| 469 |
+
onClick={() => handleSessionDump(acc.phone_number)}
|
| 470 |
+
className="aspect-square bg-white/5 hover:bg-white/20 text-white/40 hover:text-white rounded-2xl flex items-center justify-center transition-all border border-white/10 active:scale-90"
|
| 471 |
+
title="Export Key"
|
| 472 |
+
>
|
| 473 |
+
{actionLoading === acc.phone_number + '_dump' ? <Loader2 size={16} className="animate-spin" /> : <KeyRound size={20} />}
|
| 474 |
+
</button>
|
| 475 |
+
<button
|
| 476 |
+
onClick={() => handleDeleteAccount(acc.phone_number)}
|
| 477 |
+
className="aspect-square bg-red-600/10 hover:bg-red-600 text-red-500 hover:text-white rounded-2xl flex items-center justify-center transition-all border border-red-500/10 active:scale-90"
|
| 478 |
+
title="Delete"
|
| 479 |
+
>
|
| 480 |
+
{actionLoading === acc.phone_number ? <Loader2 size={16} className="animate-spin" /> : <X size={20} />}
|
| 481 |
+
</button>
|
| 482 |
+
</div>
|
| 483 |
+
</div>
|
| 484 |
|
| 485 |
+
{/* Card Footer: Metadata */}
|
| 486 |
+
<div className="flex items-center justify-between px-2 text-left">
|
| 487 |
+
<div className="flex flex-col gap-1">
|
| 488 |
+
<div className="flex items-center gap-2 text-[9px] font-black text-white/20 uppercase tracking-widest">
|
| 489 |
+
<div className="w-1 h-1 rounded-full bg-emerald-500" />
|
| 490 |
+
Encryption
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
</div>
|
| 492 |
+
<span className="text-[10px] font-bold text-white/40 ml-3">Level 4 Lock</span>
|
| 493 |
</div>
|
| 494 |
+
<div className="flex flex-col items-end gap-1">
|
| 495 |
+
<div className="flex items-center gap-2 text-[9px] font-black text-white/20 uppercase tracking-widest">
|
| 496 |
+
Active Log
|
| 497 |
+
<div className="w-1 h-1 rounded-full bg-indigo-500" />
|
| 498 |
+
</div>
|
| 499 |
+
<span className="text-[10px] font-bold text-white/40 mr-3">
|
| 500 |
+
{acc.last_active ? new Date(acc.last_active).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) : 'Standby'}
|
| 501 |
+
</span>
|
| 502 |
</div>
|
| 503 |
</div>
|
| 504 |
+
|
| 505 |
+
<div className="mt-6 pt-5 border-t border-white/5 flex items-center justify-between">
|
| 506 |
+
<span className="text-[9px] font-bold text-white/10 uppercase tracking-widest">Integrated {acc.created_at ? new Date(acc.created_at).toLocaleDateString('en-US', { month: 'short', year: 'numeric' }) : 'Just now'}</span>
|
| 507 |
+
<button className="text-[9px] font-black text-indigo-500 uppercase tracking-[0.2em] hover:text-indigo-400 flex items-center gap-2 transition-all group/btn">
|
| 508 |
+
Audit <ChevronRight size={12} className="group-hover/btn:translate-x-1 transition-transform" />
|
| 509 |
+
</button>
|
| 510 |
+
</div>
|
| 511 |
+
</div>
|
| 512 |
+
))}
|
| 513 |
</div>
|
| 514 |
)}
|
| 515 |
|
frontend/src/components/MonetizationOverlay.tsx
CHANGED
|
@@ -261,7 +261,7 @@ export const MonetizationOverlay: React.FC<MonetizationOverlayProps> = ({ childr
|
|
| 261 |
</button>
|
| 262 |
</div>
|
| 263 |
) : (
|
| 264 |
-
<
|
| 265 |
{/* Horizontal Plan Scroll/Tabs */}
|
| 266 |
<div className="grid grid-cols-3 gap-2">
|
| 267 |
{plans.map((plan) => {
|
|
@@ -349,7 +349,7 @@ export const MonetizationOverlay: React.FC<MonetizationOverlayProps> = ({ childr
|
|
| 349 |
{msg.text}
|
| 350 |
</div>
|
| 351 |
)}
|
| 352 |
-
</
|
| 353 |
)}
|
| 354 |
|
| 355 |
{/* Status Label */}
|
|
|
|
| 261 |
</button>
|
| 262 |
</div>
|
| 263 |
) : (
|
| 264 |
+
<div className="space-y-5">
|
| 265 |
{/* Horizontal Plan Scroll/Tabs */}
|
| 266 |
<div className="grid grid-cols-3 gap-2">
|
| 267 |
{plans.map((plan) => {
|
|
|
|
| 349 |
{msg.text}
|
| 350 |
</div>
|
| 351 |
)}
|
| 352 |
+
</div>
|
| 353 |
)}
|
| 354 |
|
| 355 |
{/* Status Label */}
|