Spaces:
Paused
Paused
CBV01 commited on
Commit ·
0eb786d
1
Parent(s): c5f08c6
Fix Telegram login, redesign account modal, and remove dashboard shadows
Browse files- backend/main.py +24 -22
- frontend/src/app/accounts/page.tsx +73 -116
- frontend/src/app/page.tsx +31 -25
backend/main.py
CHANGED
|
@@ -294,10 +294,9 @@ async def send_code(req: PhoneLoginRequest, user_id: str = Depends(get_current_u
|
|
| 294 |
api_hash = req.api_hash or TELEGRAM_API_HASH
|
| 295 |
|
| 296 |
if not api_id or not api_hash:
|
| 297 |
-
#
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
api_hash = "b18441a1ed607c10e14913251fd1c390"
|
| 301 |
|
| 302 |
try:
|
| 303 |
# Each login can use its own API ID and Hash
|
|
@@ -412,24 +411,27 @@ async def get_dialogs(req: FetchDialogsRequest, user_id: str = Depends(get_curre
|
|
| 412 |
|
| 413 |
@app.post("/api/telegram/qr/init")
|
| 414 |
async def qr_init(user_id: str = Depends(get_current_user_id)):
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
|
|
|
|
|
|
|
|
|
| 433 |
|
| 434 |
@app.get("/api/telegram/qr/status/{token}")
|
| 435 |
async def qr_status(token: str):
|
|
|
|
| 294 |
api_hash = req.api_hash or TELEGRAM_API_HASH
|
| 295 |
|
| 296 |
if not api_id or not api_hash:
|
| 297 |
+
# Telegram iOS credentials - more stable than Android ones
|
| 298 |
+
api_id = "2040"
|
| 299 |
+
api_hash = "b18441a1ff607e10a989891a5462e627"
|
|
|
|
| 300 |
|
| 301 |
try:
|
| 302 |
# Each login can use its own API ID and Hash
|
|
|
|
| 411 |
|
| 412 |
@app.post("/api/telegram/qr/init")
|
| 413 |
async def qr_init(user_id: str = Depends(get_current_user_id)):
|
| 414 |
+
try:
|
| 415 |
+
api_id = int(os.getenv("TELEGRAM_API_ID", "2040"))
|
| 416 |
+
api_hash = os.getenv("TELEGRAM_API_HASH", "b18441a1ff607e10a989891a5462e627")
|
| 417 |
+
|
| 418 |
+
client = TelegramClient(StringSession(''), api_id, api_hash)
|
| 419 |
+
await client.connect()
|
| 420 |
+
|
| 421 |
+
qr = await client.qr_login()
|
| 422 |
+
token = str(uuid.uuid4())
|
| 423 |
+
qr_sessions[token] = {
|
| 424 |
+
"client": client,
|
| 425 |
+
"qr": qr,
|
| 426 |
+
"user_id": user_id,
|
| 427 |
+
"api_id": api_id,
|
| 428 |
+
"api_hash": api_hash,
|
| 429 |
+
"created_at": datetime.now()
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
return {"token": token, "url": qr.url}
|
| 433 |
+
except Exception as e:
|
| 434 |
+
raise HTTPException(status_code=500, detail=f"QR init failed: {str(e)}")
|
| 435 |
|
| 436 |
@app.get("/api/telegram/qr/status/{token}")
|
| 437 |
async def qr_status(token: str):
|
frontend/src/app/accounts/page.tsx
CHANGED
|
@@ -40,11 +40,6 @@ export default function AccountsPage() {
|
|
| 40 |
const [showCountrySelector, setShowCountrySelector] = useState(false);
|
| 41 |
const [countrySearch, setCountrySearch] = useState('');
|
| 42 |
|
| 43 |
-
// API Id and Hash are now optional/hidden by default
|
| 44 |
-
const [apiId, setApiId] = useState('');
|
| 45 |
-
const [apiHash, setApiHash] = useState('');
|
| 46 |
-
const [showAdvanced, setShowAdvanced] = useState(false);
|
| 47 |
-
|
| 48 |
// QR Login State
|
| 49 |
const [loginMode, setLoginMode] = useState<'phone' | 'qr'>('phone');
|
| 50 |
const [qrUrl, setQrUrl] = useState('');
|
|
@@ -94,8 +89,6 @@ export default function AccountsPage() {
|
|
| 94 |
|
| 95 |
try {
|
| 96 |
const body: any = { phone_number: fullPhoneNumber };
|
| 97 |
-
if (apiId) body.api_id = apiId;
|
| 98 |
-
if (apiHash) body.api_hash = apiHash;
|
| 99 |
|
| 100 |
const res = await apiFetch('/api/telegram/send-code', {
|
| 101 |
method: 'POST',
|
|
@@ -280,7 +273,7 @@ export default function AccountsPage() {
|
|
| 280 |
return (
|
| 281 |
<div className="animate-in fade-in slide-in-from-bottom-4 duration-700 min-h-screen">
|
| 282 |
{successMsg && (
|
| 283 |
-
<div className="fixed top-8 right-8 z-[100] bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 px-6 py-4 rounded-2xl
|
| 284 |
<CheckCircle2 size={20} />
|
| 285 |
<span className="font-bold text-sm tracking-tight">{successMsg}</span>
|
| 286 |
</div>
|
|
@@ -300,7 +293,7 @@ export default function AccountsPage() {
|
|
| 300 |
setStep('phone');
|
| 301 |
setIsConnecting(true);
|
| 302 |
}}
|
| 303 |
-
className="group bg-indigo-600 hover:bg-indigo-500 transition-all text-white px-8 py-4 rounded-2xl text-sm font-bold
|
| 304 |
>
|
| 305 |
<div className="absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:animate-shimmer" />
|
| 306 |
<Plus size={20} /> Connect New Account
|
|
@@ -318,7 +311,7 @@ export default function AccountsPage() {
|
|
| 318 |
</p>
|
| 319 |
</div>
|
| 320 |
) : accounts.length === 0 ? (
|
| 321 |
-
<div className="bg-card/50 backdrop-blur-xl border border-border rounded-[48px] p-24 text-center
|
| 322 |
<div className="w-24 h-24 bg-gradient-to-br from-indigo-500/10 to-purple-500/10 rounded-[32px] flex items-center justify-center mx-auto mb-8 text-indigo-500 transition-transform group-hover:scale-110 duration-700">
|
| 323 |
<Users size={48} />
|
| 324 |
</div>
|
|
@@ -336,11 +329,11 @@ export default function AccountsPage() {
|
|
| 336 |
) : (
|
| 337 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 animate-in fade-in slide-in-from-bottom-8 duration-1000">
|
| 338 |
{accounts.map((acc, idx) => (
|
| 339 |
-
<div key={idx} className="bg-card/60 backdrop-blur-2xl border border-border rounded-[36px] p-8 group hover:border-indigo-500/30 transition-all
|
| 340 |
<div className="absolute top-0 right-0 w-48 h-48 bg-indigo-500/10 rounded-full blur-[80px] -mr-16 -mt-16 transition-all group-hover:bg-indigo-500/20"></div>
|
| 341 |
|
| 342 |
<div className="flex items-center gap-6 mb-8 relative z-10">
|
| 343 |
-
<div className="w-16 h-16 rounded-3xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center text-white text-2xl font-black
|
| 344 |
{(acc.phone_number?.slice(-2) || 'N').toUpperCase()}
|
| 345 |
</div>
|
| 346 |
<div className="flex-1 min-w-0">
|
|
@@ -396,79 +389,77 @@ export default function AccountsPage() {
|
|
| 396 |
|
| 397 |
{/* Premium Connection Modal Overay */}
|
| 398 |
{isConnecting && (
|
| 399 |
-
<div className="fixed inset-0 bg-
|
| 400 |
-
<div className="relative w-full max-w-
|
| 401 |
-
{/* Glow effect behind card */}
|
| 402 |
-
<div className="absolute -inset-1 bg-gradient-to-r from-blue-600 to-indigo-600 rounded-[36px] blur-xl opacity-20 animate-pulse"></div>
|
| 403 |
|
| 404 |
-
<div className="relative bg-
|
| 405 |
{/* Close Button */}
|
| 406 |
<button
|
| 407 |
onClick={() => { setIsConnecting(false); setStep('phone'); setError(''); }}
|
| 408 |
-
className="absolute top-
|
| 409 |
>
|
| 410 |
-
<X size={
|
| 411 |
</button>
|
| 412 |
|
| 413 |
{/* Modal Content */}
|
| 414 |
-
<div className="
|
| 415 |
{step === 'phone' && (
|
| 416 |
<div className="text-center">
|
| 417 |
{/* Icon */}
|
| 418 |
-
<div className="mb-
|
| 419 |
-
<div className="absolute inset-0 bg-
|
| 420 |
-
<div className="relative w-
|
| 421 |
-
<Rocket className="text-white
|
| 422 |
</div>
|
| 423 |
</div>
|
| 424 |
|
| 425 |
-
<h3 className="text-
|
| 426 |
-
<p className="text-
|
| 427 |
Choose your preferred method to link your Telegram node.
|
| 428 |
</p>
|
| 429 |
|
| 430 |
-
<div className="flex bg-
|
| 431 |
<button
|
| 432 |
onClick={() => setLoginMode('phone')}
|
| 433 |
-
className={`flex-1 py-
|
| 434 |
>
|
| 435 |
Phone Number
|
| 436 |
</button>
|
| 437 |
<button
|
| 438 |
onClick={handleInitQrLogin}
|
| 439 |
-
className={`flex-1 py-
|
| 440 |
>
|
| 441 |
QR Code
|
| 442 |
</button>
|
| 443 |
</div>
|
| 444 |
|
| 445 |
{error && (
|
| 446 |
-
<div className="mb-
|
| 447 |
-
<AlertCircle size={
|
| 448 |
<span>{error}</span>
|
| 449 |
</div>
|
| 450 |
)}
|
| 451 |
|
| 452 |
{loginMode === 'phone' ? (
|
| 453 |
-
<form onSubmit={handleSendCode} className="space-y-
|
| 454 |
-
<div className="space-y-
|
| 455 |
-
<label className="text-[10px] font-black uppercase tracking-[0.2em] text-
|
| 456 |
<Phone size={10} className="text-indigo-500" />
|
| 457 |
Your Telegram Number
|
| 458 |
</label>
|
| 459 |
|
| 460 |
-
<div className="flex gap-
|
| 461 |
{/* Country Selector */}
|
| 462 |
<div className="relative">
|
| 463 |
<button
|
| 464 |
type="button"
|
| 465 |
onClick={() => setShowCountrySelector(!showCountrySelector)}
|
| 466 |
-
className="h-
|
| 467 |
>
|
| 468 |
-
<span className="text-
|
| 469 |
-
<span className="text-
|
| 470 |
-
<span className="text-
|
| 471 |
-
<ChevronDown size={14} className={`text-
|
| 472 |
</button>
|
| 473 |
|
| 474 |
{showCountrySelector && (
|
|
@@ -477,37 +468,37 @@ export default function AccountsPage() {
|
|
| 477 |
className="fixed inset-0 z-30"
|
| 478 |
onClick={() => setShowCountrySelector(false)}
|
| 479 |
/>
|
| 480 |
-
<div className="absolute top-full left-0 mt-2 w-
|
| 481 |
-
<div className="p-
|
| 482 |
<div className="relative">
|
| 483 |
-
<Search className="absolute left-3 top-1/2 -translate-y-1/2 text-
|
| 484 |
<input
|
| 485 |
type="text"
|
| 486 |
placeholder="Search countries..."
|
| 487 |
-
className="w-full bg-
|
| 488 |
value={countrySearch}
|
| 489 |
onChange={(e) => setCountrySearch(e.target.value)}
|
| 490 |
autoFocus
|
| 491 |
/>
|
| 492 |
</div>
|
| 493 |
</div>
|
| 494 |
-
<div className="max-h-
|
| 495 |
{filteredCountries.map((c) => (
|
| 496 |
<button
|
| 497 |
key={c.code}
|
| 498 |
type="button"
|
| 499 |
-
className="w-full px-
|
| 500 |
onClick={() => {
|
| 501 |
setSelectedCountry(c);
|
| 502 |
setShowCountrySelector(false);
|
| 503 |
setCountrySearch('');
|
| 504 |
}}
|
| 505 |
>
|
| 506 |
-
<div className="flex items-center gap-
|
| 507 |
-
<span className="text-
|
| 508 |
-
<span className="text-
|
| 509 |
</div>
|
| 510 |
-
<span className="text-
|
| 511 |
</button>
|
| 512 |
))}
|
| 513 |
</div>
|
|
@@ -523,69 +514,35 @@ export default function AccountsPage() {
|
|
| 523 |
value={phoneNumber}
|
| 524 |
onChange={(e) => setPhoneNumber(e.target.value)}
|
| 525 |
placeholder="234 567 8900"
|
| 526 |
-
className="w-full h-
|
| 527 |
required
|
| 528 |
/>
|
| 529 |
</div>
|
| 530 |
</div>
|
| 531 |
</div>
|
| 532 |
|
| 533 |
-
{/* Advanced Settings Link */}
|
| 534 |
-
<div className="relative">
|
| 535 |
-
<button
|
| 536 |
-
type="button"
|
| 537 |
-
onClick={() => setShowAdvanced(!showAdvanced)}
|
| 538 |
-
className="text-[10px] font-black uppercase tracking-widest text-indigo-500/40 hover:text-indigo-500 transition-colors"
|
| 539 |
-
>
|
| 540 |
-
{showAdvanced ? '- Hide Custom API Auth' : '+ Custom API Auth (Advanced)'}
|
| 541 |
-
</button>
|
| 542 |
-
|
| 543 |
-
{showAdvanced && (
|
| 544 |
-
<div className="grid grid-cols-2 gap-3 mt-4 animate-in slide-in-from-top-2 duration-300">
|
| 545 |
-
<div className="space-y-2">
|
| 546 |
-
<input
|
| 547 |
-
type="text"
|
| 548 |
-
value={apiId}
|
| 549 |
-
onChange={(e) => setApiId(e.target.value)}
|
| 550 |
-
placeholder="API ID"
|
| 551 |
-
className="w-full h-12 bg-white/[0.02] border border-white/5 rounded-xl px-4 text-xs font-mono text-white/60 focus:outline-none focus:border-indigo-500/30"
|
| 552 |
-
/>
|
| 553 |
-
</div>
|
| 554 |
-
<div className="space-y-2">
|
| 555 |
-
<input
|
| 556 |
-
type="text"
|
| 557 |
-
value={apiHash}
|
| 558 |
-
onChange={(e) => setApiHash(e.target.value)}
|
| 559 |
-
placeholder="API Hash"
|
| 560 |
-
className="w-full h-12 bg-white/[0.02] border border-white/5 rounded-xl px-4 text-xs font-mono text-white/60 focus:outline-none focus:border-indigo-500/30"
|
| 561 |
-
/>
|
| 562 |
-
</div>
|
| 563 |
-
</div>
|
| 564 |
-
)}
|
| 565 |
-
</div>
|
| 566 |
-
|
| 567 |
<button
|
| 568 |
type="submit"
|
| 569 |
disabled={loading || !phoneNumber}
|
| 570 |
-
className="w-full h-
|
| 571 |
>
|
| 572 |
{loading ? (
|
| 573 |
-
<Loader2 size={
|
| 574 |
) : (
|
| 575 |
<>
|
| 576 |
Send Login Code
|
| 577 |
-
<ChevronRight size={
|
| 578 |
</>
|
| 579 |
)}
|
| 580 |
</button>
|
| 581 |
|
| 582 |
-
<p className="text-center text-[
|
| 583 |
We'll send a secure code to your Telegram app.
|
| 584 |
</p>
|
| 585 |
</form>
|
| 586 |
) : (
|
| 587 |
-
<div className="space-y-
|
| 588 |
-
<div className="relative mx-auto w-
|
| 589 |
{qrUrl ? (
|
| 590 |
<img
|
| 591 |
src={`https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=${encodeURIComponent(qrUrl)}`}
|
|
@@ -600,11 +557,11 @@ export default function AccountsPage() {
|
|
| 600 |
)}
|
| 601 |
|
| 602 |
{qrStatus === 'success' && (
|
| 603 |
-
<div className="absolute inset-0 flex flex-col items-center justify-center gap-3 animate-in zoom-in-95 duration-500">
|
| 604 |
-
<div className="w-16 h-16 bg-emerald-500 rounded-full flex items-center justify-center
|
| 605 |
-
<CheckCircle2 size={32} className="text-
|
| 606 |
</div>
|
| 607 |
-
<span className="text-sm font-bold text-emerald-
|
| 608 |
</div>
|
| 609 |
)}
|
| 610 |
|
|
@@ -614,7 +571,7 @@ export default function AccountsPage() {
|
|
| 614 |
<span className="text-sm font-bold text-white">QR Expired</span>
|
| 615 |
<button
|
| 616 |
onClick={handleInitQrLogin}
|
| 617 |
-
className="mt-2 text-[10px] font-black uppercase tracking-widest text-indigo-400 bg-
|
| 618 |
>
|
| 619 |
Regenerate
|
| 620 |
</button>
|
|
@@ -623,17 +580,17 @@ export default function AccountsPage() {
|
|
| 623 |
</div>
|
| 624 |
|
| 625 |
<div className="space-y-4">
|
| 626 |
-
<div className="flex items-center gap-4 text-left bg-
|
| 627 |
-
<div className="w-8 h-8 rounded-full bg-
|
| 628 |
-
<p className="text-xs text-
|
| 629 |
</div>
|
| 630 |
-
<div className="flex items-center gap-4 text-left bg-
|
| 631 |
-
<div className="w-8 h-8 rounded-full bg-
|
| 632 |
-
<p className="text-xs text-
|
| 633 |
</div>
|
| 634 |
-
<div className="flex items-center gap-4 text-left bg-
|
| 635 |
-
<div className="w-8 h-8 rounded-full bg-
|
| 636 |
-
<p className="text-xs text-
|
| 637 |
</div>
|
| 638 |
</div>
|
| 639 |
</div>
|
|
@@ -646,13 +603,13 @@ export default function AccountsPage() {
|
|
| 646 |
{/* Icon */}
|
| 647 |
<div className="mb-8 relative inline-block">
|
| 648 |
<div className="absolute inset-0 bg-indigo-500/20 blur-xl rounded-full scale-150" />
|
| 649 |
-
<div className="relative w-16 h-16 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-2xl flex items-center justify-center
|
| 650 |
<KeyRound className="text-white fill-white/10" size={32} />
|
| 651 |
</div>
|
| 652 |
</div>
|
| 653 |
|
| 654 |
-
<h3 className="text-3xl font-bold text-
|
| 655 |
-
<p className="text-
|
| 656 |
Enter the 5-digit verification code sent to your active Telegram session.
|
| 657 |
</p>
|
| 658 |
|
|
@@ -671,7 +628,7 @@ export default function AccountsPage() {
|
|
| 671 |
onChange={(e) => setOtp(e.target.value)}
|
| 672 |
placeholder="•••••"
|
| 673 |
maxLength={5}
|
| 674 |
-
className="w-full h-20 bg-
|
| 675 |
required
|
| 676 |
autoFocus
|
| 677 |
/>
|
|
@@ -681,14 +638,14 @@ export default function AccountsPage() {
|
|
| 681 |
<button
|
| 682 |
type="submit"
|
| 683 |
disabled={loading || otp.length < 5}
|
| 684 |
-
className="w-full h-16 bg-
|
| 685 |
>
|
| 686 |
{loading ? <Loader2 size={24} className="animate-spin" /> : 'Complete Link'}
|
| 687 |
</button>
|
| 688 |
<button
|
| 689 |
type="button"
|
| 690 |
onClick={() => setStep('phone')}
|
| 691 |
-
className="text-
|
| 692 |
>
|
| 693 |
← Change Number
|
| 694 |
</button>
|
|
@@ -705,12 +662,12 @@ export default function AccountsPage() {
|
|
| 705 |
<CheckCircle2 className="text-white" size={48} />
|
| 706 |
</div>
|
| 707 |
</div>
|
| 708 |
-
<h4 className="text-
|
| 709 |
-
<p className="text-
|
| 710 |
-
|
| 711 |
</p>
|
| 712 |
-
<div className="w-full h-1 bg-
|
| 713 |
-
<div className="h-full bg-
|
| 714 |
</div>
|
| 715 |
</div>
|
| 716 |
)}
|
|
|
|
| 40 |
const [showCountrySelector, setShowCountrySelector] = useState(false);
|
| 41 |
const [countrySearch, setCountrySearch] = useState('');
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// QR Login State
|
| 44 |
const [loginMode, setLoginMode] = useState<'phone' | 'qr'>('phone');
|
| 45 |
const [qrUrl, setQrUrl] = useState('');
|
|
|
|
| 89 |
|
| 90 |
try {
|
| 91 |
const body: any = { phone_number: fullPhoneNumber };
|
|
|
|
|
|
|
| 92 |
|
| 93 |
const res = await apiFetch('/api/telegram/send-code', {
|
| 94 |
method: 'POST',
|
|
|
|
| 273 |
return (
|
| 274 |
<div className="animate-in fade-in slide-in-from-bottom-4 duration-700 min-h-screen">
|
| 275 |
{successMsg && (
|
| 276 |
+
<div className="fixed top-8 right-8 z-[100] bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 px-6 py-4 rounded-2xl flex items-center gap-3 animate-in fade-in slide-in-from-top-4 duration-500">
|
| 277 |
<CheckCircle2 size={20} />
|
| 278 |
<span className="font-bold text-sm tracking-tight">{successMsg}</span>
|
| 279 |
</div>
|
|
|
|
| 293 |
setStep('phone');
|
| 294 |
setIsConnecting(true);
|
| 295 |
}}
|
| 296 |
+
className="group bg-indigo-600 hover:bg-indigo-500 transition-all text-white px-8 py-4 rounded-2xl text-sm font-bold active:scale-95 flex items-center gap-3 relative overflow-hidden"
|
| 297 |
>
|
| 298 |
<div className="absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:animate-shimmer" />
|
| 299 |
<Plus size={20} /> Connect New Account
|
|
|
|
| 311 |
</p>
|
| 312 |
</div>
|
| 313 |
) : accounts.length === 0 ? (
|
| 314 |
+
<div className="bg-card/50 backdrop-blur-xl border border-border rounded-[48px] p-24 text-center group transition-all hover:border-indigo-500/20">
|
| 315 |
<div className="w-24 h-24 bg-gradient-to-br from-indigo-500/10 to-purple-500/10 rounded-[32px] flex items-center justify-center mx-auto mb-8 text-indigo-500 transition-transform group-hover:scale-110 duration-700">
|
| 316 |
<Users size={48} />
|
| 317 |
</div>
|
|
|
|
| 329 |
) : (
|
| 330 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 animate-in fade-in slide-in-from-bottom-8 duration-1000">
|
| 331 |
{accounts.map((acc, idx) => (
|
| 332 |
+
<div key={idx} className="bg-card/60 backdrop-blur-2xl border border-border rounded-[36px] p-8 group hover:border-indigo-500/30 transition-all relative overflow-hidden flex flex-col">
|
| 333 |
<div className="absolute top-0 right-0 w-48 h-48 bg-indigo-500/10 rounded-full blur-[80px] -mr-16 -mt-16 transition-all group-hover:bg-indigo-500/20"></div>
|
| 334 |
|
| 335 |
<div className="flex items-center gap-6 mb-8 relative z-10">
|
| 336 |
+
<div className="w-16 h-16 rounded-3xl bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center text-white text-2xl font-black transition-all group-hover:rotate-6 group-hover:scale-110 duration-500">
|
| 337 |
{(acc.phone_number?.slice(-2) || 'N').toUpperCase()}
|
| 338 |
</div>
|
| 339 |
<div className="flex-1 min-w-0">
|
|
|
|
| 389 |
|
| 390 |
{/* Premium Connection Modal Overay */}
|
| 391 |
{isConnecting && (
|
| 392 |
+
<div className="fixed inset-0 bg-background/60 backdrop-blur-sm z-[100] flex items-center justify-center p-4 animate-in fade-in duration-300">
|
| 393 |
+
<div className="relative w-full max-w-[380px]">
|
|
|
|
|
|
|
| 394 |
|
| 395 |
+
<div className="relative bg-card border border-border rounded-[32px] w-full overflow-hidden animate-in zoom-in-95 slide-in-from-bottom-2 duration-400">
|
| 396 |
{/* Close Button */}
|
| 397 |
<button
|
| 398 |
onClick={() => { setIsConnecting(false); setStep('phone'); setError(''); }}
|
| 399 |
+
className="absolute top-5 right-5 z-20 text-foreground/40 hover:text-foreground transition-colors p-2 bg-foreground/5 rounded-full"
|
| 400 |
>
|
| 401 |
+
<X size={18} />
|
| 402 |
</button>
|
| 403 |
|
| 404 |
{/* Modal Content */}
|
| 405 |
+
<div className="p-8">
|
| 406 |
{step === 'phone' && (
|
| 407 |
<div className="text-center">
|
| 408 |
{/* Icon */}
|
| 409 |
+
<div className="mb-6 relative inline-block">
|
| 410 |
+
<div className="absolute inset-0 bg-indigo-500/20 blur-xl rounded-full scale-150" />
|
| 411 |
+
<div className="relative w-14 h-14 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-2xl flex items-center justify-center transform -rotate-6">
|
| 412 |
+
<Rocket className="text-white" size={28} />
|
| 413 |
</div>
|
| 414 |
</div>
|
| 415 |
|
| 416 |
+
<h3 className="text-2xl font-bold text-foreground mb-2 tracking-tight">Connect Account</h3>
|
| 417 |
+
<p className="text-foreground/50 text-xs font-medium mb-6 max-w-[280px] mx-auto leading-relaxed">
|
| 418 |
Choose your preferred method to link your Telegram node.
|
| 419 |
</p>
|
| 420 |
|
| 421 |
+
<div className="flex bg-foreground/5 p-1 rounded-xl mb-6">
|
| 422 |
<button
|
| 423 |
onClick={() => setLoginMode('phone')}
|
| 424 |
+
className={`flex-1 py-2.5 rounded-lg text-xs font-bold transition-all ${loginMode === 'phone' ? 'bg-indigo-600 text-white' : 'text-foreground/50 hover:text-foreground/80'}`}
|
| 425 |
>
|
| 426 |
Phone Number
|
| 427 |
</button>
|
| 428 |
<button
|
| 429 |
onClick={handleInitQrLogin}
|
| 430 |
+
className={`flex-1 py-2.5 rounded-lg text-xs font-bold transition-all ${loginMode === 'qr' ? 'bg-indigo-600 text-white' : 'text-foreground/50 hover:text-foreground/80'}`}
|
| 431 |
>
|
| 432 |
QR Code
|
| 433 |
</button>
|
| 434 |
</div>
|
| 435 |
|
| 436 |
{error && (
|
| 437 |
+
<div className="mb-6 p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-500 text-[11px] font-bold flex items-center gap-2 animate-in shake duration-500 text-left">
|
| 438 |
+
<AlertCircle size={14} className="shrink-0" />
|
| 439 |
<span>{error}</span>
|
| 440 |
</div>
|
| 441 |
)}
|
| 442 |
|
| 443 |
{loginMode === 'phone' ? (
|
| 444 |
+
<form onSubmit={handleSendCode} className="space-y-6 text-left">
|
| 445 |
+
<div className="space-y-2">
|
| 446 |
+
<label className="text-[10px] font-black uppercase tracking-[0.2em] text-foreground/40 flex items-center gap-2 px-1">
|
| 447 |
<Phone size={10} className="text-indigo-500" />
|
| 448 |
Your Telegram Number
|
| 449 |
</label>
|
| 450 |
|
| 451 |
+
<div className="flex gap-2">
|
| 452 |
{/* Country Selector */}
|
| 453 |
<div className="relative">
|
| 454 |
<button
|
| 455 |
type="button"
|
| 456 |
onClick={() => setShowCountrySelector(!showCountrySelector)}
|
| 457 |
+
className="h-12 px-3 bg-foreground/5 border border-border rounded-xl flex items-center gap-2 hover:bg-foreground/10 transition-all group"
|
| 458 |
>
|
| 459 |
+
<span className="text-base">{selectedCountry.flag}</span>
|
| 460 |
+
<span className="text-foreground font-bold text-xs">{selectedCountry.code}</span>
|
| 461 |
+
<span className="text-foreground/50 font-medium text-xs">{selectedCountry.dial}</span>
|
| 462 |
+
<ChevronDown size={14} className={`text-foreground/30 transition-transform duration-300 ${showCountrySelector ? 'rotate-180' : ''}`} />
|
| 463 |
</button>
|
| 464 |
|
| 465 |
{showCountrySelector && (
|
|
|
|
| 468 |
className="fixed inset-0 z-30"
|
| 469 |
onClick={() => setShowCountrySelector(false)}
|
| 470 |
/>
|
| 471 |
+
<div className="absolute top-full left-0 mt-2 w-64 bg-card border border-border rounded-xl shadow-2xl z-40 overflow-hidden animate-in fade-in zoom-in-95 duration-200">
|
| 472 |
+
<div className="p-2 border-b border-border">
|
| 473 |
<div className="relative">
|
| 474 |
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 text-foreground/30" size={12} />
|
| 475 |
<input
|
| 476 |
type="text"
|
| 477 |
placeholder="Search countries..."
|
| 478 |
+
className="w-full bg-foreground/5 border-none rounded-lg py-1.5 pl-8 pr-3 text-[11px] text-foreground focus:outline-none focus:ring-1 focus:ring-indigo-500/30"
|
| 479 |
value={countrySearch}
|
| 480 |
onChange={(e) => setCountrySearch(e.target.value)}
|
| 481 |
autoFocus
|
| 482 |
/>
|
| 483 |
</div>
|
| 484 |
</div>
|
| 485 |
+
<div className="max-h-52 overflow-y-auto custom-scrollbar bg-card">
|
| 486 |
{filteredCountries.map((c) => (
|
| 487 |
<button
|
| 488 |
key={c.code}
|
| 489 |
type="button"
|
| 490 |
+
className="w-full px-3 py-2.5 flex items-center justify-between hover:bg-foreground/5 transition-colors"
|
| 491 |
onClick={() => {
|
| 492 |
setSelectedCountry(c);
|
| 493 |
setShowCountrySelector(false);
|
| 494 |
setCountrySearch('');
|
| 495 |
}}
|
| 496 |
>
|
| 497 |
+
<div className="flex items-center gap-2">
|
| 498 |
+
<span className="text-base">{c.flag}</span>
|
| 499 |
+
<span className="text-xs font-medium text-foreground/80">{c.name}</span>
|
| 500 |
</div>
|
| 501 |
+
<span className="text-[10px] font-bold text-foreground/40">{c.dial}</span>
|
| 502 |
</button>
|
| 503 |
))}
|
| 504 |
</div>
|
|
|
|
| 514 |
value={phoneNumber}
|
| 515 |
onChange={(e) => setPhoneNumber(e.target.value)}
|
| 516 |
placeholder="234 567 8900"
|
| 517 |
+
className="w-full h-12 bg-foreground/5 border border-border rounded-xl px-4 text-sm font-medium text-foreground placeholder:text-foreground/30 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:bg-background transition-all"
|
| 518 |
required
|
| 519 |
/>
|
| 520 |
</div>
|
| 521 |
</div>
|
| 522 |
</div>
|
| 523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 524 |
<button
|
| 525 |
type="submit"
|
| 526 |
disabled={loading || !phoneNumber}
|
| 527 |
+
className="w-full h-12 bg-gradient-to-r from-indigo-600 to-indigo-500 hover:from-indigo-500 hover:to-indigo-400 disabled:opacity-50 disabled:grayscale text-white rounded-xl text-sm font-bold transition-all flex items-center justify-center gap-2 active:scale-[0.98] group"
|
| 528 |
>
|
| 529 |
{loading ? (
|
| 530 |
+
<Loader2 size={20} className="animate-spin" />
|
| 531 |
) : (
|
| 532 |
<>
|
| 533 |
Send Login Code
|
| 534 |
+
<ChevronRight size={16} className="group-hover:translate-x-1 transition-transform" />
|
| 535 |
</>
|
| 536 |
)}
|
| 537 |
</button>
|
| 538 |
|
| 539 |
+
<p className="text-center text-[9px] text-foreground/20 font-bold uppercase tracking-widest mt-6">
|
| 540 |
We'll send a secure code to your Telegram app.
|
| 541 |
</p>
|
| 542 |
</form>
|
| 543 |
) : (
|
| 544 |
+
<div className="space-y-6 animate-in fade-in duration-500">
|
| 545 |
+
<div className="relative mx-auto w-56 h-56 bg-foreground/[0.03] border border-border rounded-3xl p-4 group">
|
| 546 |
{qrUrl ? (
|
| 547 |
<img
|
| 548 |
src={`https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=${encodeURIComponent(qrUrl)}`}
|
|
|
|
| 557 |
)}
|
| 558 |
|
| 559 |
{qrStatus === 'success' && (
|
| 560 |
+
<div className="absolute inset-0 flex flex-col items-center justify-center gap-3 animate-in zoom-in-95 duration-500 bg-background/80 backdrop-blur-sm rounded-3xl">
|
| 561 |
+
<div className="w-16 h-16 bg-emerald-500/20 border border-emerald-500/30 rounded-full flex items-center justify-center">
|
| 562 |
+
<CheckCircle2 size={32} className="text-emerald-500" />
|
| 563 |
</div>
|
| 564 |
+
<span className="text-sm font-bold text-emerald-500">Authorized!</span>
|
| 565 |
</div>
|
| 566 |
)}
|
| 567 |
|
|
|
|
| 571 |
<span className="text-sm font-bold text-white">QR Expired</span>
|
| 572 |
<button
|
| 573 |
onClick={handleInitQrLogin}
|
| 574 |
+
className="mt-2 text-[10px] font-black uppercase tracking-widest text-indigo-400 bg-foreground/10 px-4 py-2 rounded-xl"
|
| 575 |
>
|
| 576 |
Regenerate
|
| 577 |
</button>
|
|
|
|
| 580 |
</div>
|
| 581 |
|
| 582 |
<div className="space-y-4">
|
| 583 |
+
<div className="flex items-center gap-4 text-left bg-foreground/5 p-4 rounded-2xl">
|
| 584 |
+
<div className="w-8 h-8 rounded-full bg-foreground/10 flex items-center justify-center text-xs font-bold shrink-0 text-foreground">1</div>
|
| 585 |
+
<p className="text-xs text-foreground/60 leading-relaxed">Open <b className="text-foreground">Telegram</b> on your phone</p>
|
| 586 |
</div>
|
| 587 |
+
<div className="flex items-center gap-4 text-left bg-foreground/5 p-4 rounded-2xl">
|
| 588 |
+
<div className="w-8 h-8 rounded-full bg-foreground/10 flex items-center justify-center text-xs font-bold shrink-0 text-foreground">2</div>
|
| 589 |
+
<p className="text-xs text-foreground/60 leading-relaxed">Go to <b className="text-foreground">Settings</b> > <b className="text-foreground">Devices</b> > <b className="text-foreground">Link Desktop Device</b></p>
|
| 590 |
</div>
|
| 591 |
+
<div className="flex items-center gap-4 text-left bg-foreground/5 p-4 rounded-2xl">
|
| 592 |
+
<div className="w-8 h-8 rounded-full bg-foreground/10 flex items-center justify-center text-xs font-bold shrink-0 text-foreground">3</div>
|
| 593 |
+
<p className="text-xs text-foreground/60 leading-relaxed">Point your phone's camera at this screen to scan the QR code</p>
|
| 594 |
</div>
|
| 595 |
</div>
|
| 596 |
</div>
|
|
|
|
| 603 |
{/* Icon */}
|
| 604 |
<div className="mb-8 relative inline-block">
|
| 605 |
<div className="absolute inset-0 bg-indigo-500/20 blur-xl rounded-full scale-150" />
|
| 606 |
+
<div className="relative w-16 h-16 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-2xl flex items-center justify-center transform rotate-6">
|
| 607 |
<KeyRound className="text-white fill-white/10" size={32} />
|
| 608 |
</div>
|
| 609 |
</div>
|
| 610 |
|
| 611 |
+
<h3 className="text-3xl font-bold text-foreground mb-3 tracking-tight">Security Code</h3>
|
| 612 |
+
<p className="text-foreground/40 text-sm font-medium mb-12 max-w-[280px] mx-auto leading-relaxed">
|
| 613 |
Enter the 5-digit verification code sent to your active Telegram session.
|
| 614 |
</p>
|
| 615 |
|
|
|
|
| 628 |
onChange={(e) => setOtp(e.target.value)}
|
| 629 |
placeholder="•••••"
|
| 630 |
maxLength={5}
|
| 631 |
+
className="w-full h-20 bg-foreground/5 border border-border rounded-[24px] text-center text-4xl font-black tracking-[0.5em] text-foreground focus:outline-none focus:ring-4 focus:ring-indigo-500/20 focus:bg-foreground/10 transition-all"
|
| 632 |
required
|
| 633 |
autoFocus
|
| 634 |
/>
|
|
|
|
| 638 |
<button
|
| 639 |
type="submit"
|
| 640 |
disabled={loading || otp.length < 5}
|
| 641 |
+
className="w-full h-16 bg-foreground text-background hover:bg-foreground/90 disabled:opacity-30 text-base font-bold transition-all rounded-[20px] flex items-center justify-center gap-3 active:scale-[0.98]"
|
| 642 |
>
|
| 643 |
{loading ? <Loader2 size={24} className="animate-spin" /> : 'Complete Link'}
|
| 644 |
</button>
|
| 645 |
<button
|
| 646 |
type="button"
|
| 647 |
onClick={() => setStep('phone')}
|
| 648 |
+
className="text-foreground/40 hover:text-foreground text-[11px] font-black uppercase tracking-widest transition-colors py-2"
|
| 649 |
>
|
| 650 |
← Change Number
|
| 651 |
</button>
|
|
|
|
| 662 |
<CheckCircle2 className="text-white" size={48} />
|
| 663 |
</div>
|
| 664 |
</div>
|
| 665 |
+
<h4 className="text-2xl font-black text-foreground mb-4 tracking-tighter uppercase">Authorized</h4>
|
| 666 |
+
<p className="text-foreground/40 text-[11px] font-medium leading-relaxed max-w-[240px] mx-auto mb-10">
|
| 667 |
+
Neural Link Established. Synchronizing Cluster Data...
|
| 668 |
</p>
|
| 669 |
+
<div className="w-full h-1 bg-foreground/5 rounded-full overflow-hidden">
|
| 670 |
+
<div className="h-full bg-indigo-500 animate-loading-bar" />
|
| 671 |
</div>
|
| 672 |
</div>
|
| 673 |
)}
|
frontend/src/app/page.tsx
CHANGED
|
@@ -90,7 +90,7 @@ export default function Dashboard() {
|
|
| 90 |
<p className="text-sm text-foreground/60">Monitor your active automation services and metrics.</p>
|
| 91 |
</div>
|
| 92 |
<div className="flex gap-3">
|
| 93 |
-
<Link href="/campaigns" className="bg-indigo-500 hover:bg-indigo-600 transition-all text-white px-5 py-2.5 rounded-xl text-sm font-semibold
|
| 94 |
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 4v16m8-8H4" /></svg>
|
| 95 |
New Campaign
|
| 96 |
</Link>
|
|
@@ -99,7 +99,7 @@ export default function Dashboard() {
|
|
| 99 |
|
| 100 |
{/* Top Main Metrics */}
|
| 101 |
<div className="grid grid-cols-1 md:grid-cols-4 gap-5 mb-8">
|
| 102 |
-
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all
|
| 103 |
<div className="flex justify-between items-start mb-2">
|
| 104 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Transmission Count</div>
|
| 105 |
<div className="p-1.5 bg-blue-500/10 rounded-lg text-blue-400"><Activity size={16} /></div>
|
|
@@ -108,18 +108,18 @@ export default function Dashboard() {
|
|
| 108 |
<div className="flex items-center gap-1.5 text-[10px] text-foreground/30 font-medium italic">Verified broadcast throughput</div>
|
| 109 |
</div>
|
| 110 |
|
| 111 |
-
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all
|
| 112 |
<div className="flex justify-between items-start mb-2">
|
| 113 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Active Nodes</div>
|
| 114 |
<div className="p-1.5 bg-indigo-500/10 rounded-lg text-indigo-500"><Zap size={16} /></div>
|
| 115 |
</div>
|
| 116 |
<div className="text-2xl font-bold text-foreground mb-2">{stats?.counts?.accounts ?? '...'}</div>
|
| 117 |
<div className="flex items-center gap-1.5 text-[10px] text-emerald-400/60 font-medium">
|
| 118 |
-
<span className="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse
|
| 119 |
</div>
|
| 120 |
</div>
|
| 121 |
|
| 122 |
-
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all
|
| 123 |
<div className="flex justify-between items-start mb-2">
|
| 124 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Entity Leads</div>
|
| 125 |
<div className="p-1.5 bg-purple-500/10 rounded-lg text-purple-400"><Shield size={16} /></div>
|
|
@@ -128,7 +128,7 @@ export default function Dashboard() {
|
|
| 128 |
<div className="flex items-center gap-1.5 text-[10px] text-foreground/30 font-medium italic">Targeted leads analyzed</div>
|
| 129 |
</div>
|
| 130 |
|
| 131 |
-
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all
|
| 132 |
<div className="flex justify-between items-start mb-2">
|
| 133 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Queue Depth</div>
|
| 134 |
<div className="p-1.5 bg-amber-500/10 rounded-lg text-amber-500"><Activity size={16} /></div>
|
|
@@ -139,7 +139,7 @@ export default function Dashboard() {
|
|
| 139 |
</div>
|
| 140 |
|
| 141 |
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 mb-8">
|
| 142 |
-
<div className="lg:col-span-2 bg-card border border-border rounded-[32px] p-8
|
| 143 |
<div className="flex items-center gap-3 mb-2">
|
| 144 |
<div className="p-2 bg-emerald-500/10 rounded-xl text-emerald-500">
|
| 145 |
<TrendingUp size={24} />
|
|
@@ -148,24 +148,29 @@ export default function Dashboard() {
|
|
| 148 |
</div>
|
| 149 |
<p className="text-sm text-foreground/40 mb-10 font-medium">Message outreach over the last 7 days</p>
|
| 150 |
|
| 151 |
-
<div className="flex-1
|
| 152 |
-
{/*
|
| 153 |
-
<div className="
|
| 154 |
{[1400, 1050, 700, 350, 0].map(val => (
|
| 155 |
-
<
|
| 156 |
-
<span className="text-[10px] font-mono text-foreground/50 w-8">{val}</span>
|
| 157 |
-
<div className="flex-1 border-t border-dashed border-foreground/30" />
|
| 158 |
-
</div>
|
| 159 |
))}
|
| 160 |
</div>
|
| 161 |
|
| 162 |
-
<div className="
|
| 163 |
-
{
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
| 167 |
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
<defs>
|
| 170 |
<linearGradient id="areaGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
| 171 |
<stop offset="0%" stopColor="#6366f1" stopOpacity="0.3" />
|
|
@@ -212,10 +217,11 @@ export default function Dashboard() {
|
|
| 212 |
);
|
| 213 |
})}
|
| 214 |
</svg>
|
|
|
|
| 215 |
</div>
|
| 216 |
</div>
|
| 217 |
|
| 218 |
-
<div className="bg-card border border-border rounded-[32px] p-8
|
| 219 |
<div className="absolute -bottom-10 -right-10 opacity-[0.02] group-hover:scale-110 transition-transform duration-1000">
|
| 220 |
<Shield size={200} />
|
| 221 |
</div>
|
|
@@ -224,10 +230,10 @@ export default function Dashboard() {
|
|
| 224 |
<div className="space-y-3">
|
| 225 |
<div className="flex justify-between text-[11px] font-bold text-foreground/30 uppercase tracking-widest">
|
| 226 |
<span>Network Integrity</span>
|
| 227 |
-
<span className="text-emerald-500 tracking-tighter
|
| 228 |
</div>
|
| 229 |
<div className="h-2 bg-foreground/[0.03] rounded-full overflow-hidden border border-border/10 p-[1px]">
|
| 230 |
-
<div className="h-full bg-gradient-to-r from-emerald-600 to-emerald-400 w-[100%] rounded-full
|
| 231 |
</div>
|
| 232 |
</div>
|
| 233 |
<div className="space-y-3">
|
|
@@ -236,7 +242,7 @@ export default function Dashboard() {
|
|
| 236 |
<span className="text-indigo-500 tracking-tighter">{stats?.service_health?.poller || 'Active'}</span>
|
| 237 |
</div>
|
| 238 |
<div className="h-2 bg-foreground/[0.03] rounded-full overflow-hidden border border-border/10 p-[1px]">
|
| 239 |
-
<div className="h-full bg-gradient-to-r from-indigo-600 to-indigo-400 w-[85%] rounded-full
|
| 240 |
</div>
|
| 241 |
</div>
|
| 242 |
<div className="space-y-3">
|
|
@@ -258,7 +264,7 @@ export default function Dashboard() {
|
|
| 258 |
|
| 259 |
{/* Latest Activity Table */}
|
| 260 |
<h3 className="text-lg font-bold mb-5 text-foreground tracking-tight">Recent Live Tasks</h3>
|
| 261 |
-
<div className="bg-card border border-border rounded-[24px] overflow-hidden
|
| 262 |
<table className="w-full text-left border-collapse">
|
| 263 |
<thead>
|
| 264 |
<tr className="border-b border-border text-foreground/20 text-[11px] uppercase tracking-widest bg-foreground/[0.02]">
|
|
|
|
| 90 |
<p className="text-sm text-foreground/60">Monitor your active automation services and metrics.</p>
|
| 91 |
</div>
|
| 92 |
<div className="flex gap-3">
|
| 93 |
+
<Link href="/campaigns" className="bg-indigo-500 hover:bg-indigo-600 transition-all text-white px-5 py-2.5 rounded-xl text-sm font-semibold active:scale-95 flex items-center gap-2">
|
| 94 |
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 4v16m8-8H4" /></svg>
|
| 95 |
New Campaign
|
| 96 |
</Link>
|
|
|
|
| 99 |
|
| 100 |
{/* Top Main Metrics */}
|
| 101 |
<div className="grid grid-cols-1 md:grid-cols-4 gap-5 mb-8">
|
| 102 |
+
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all">
|
| 103 |
<div className="flex justify-between items-start mb-2">
|
| 104 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Transmission Count</div>
|
| 105 |
<div className="p-1.5 bg-blue-500/10 rounded-lg text-blue-400"><Activity size={16} /></div>
|
|
|
|
| 108 |
<div className="flex items-center gap-1.5 text-[10px] text-foreground/30 font-medium italic">Verified broadcast throughput</div>
|
| 109 |
</div>
|
| 110 |
|
| 111 |
+
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all">
|
| 112 |
<div className="flex justify-between items-start mb-2">
|
| 113 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Active Nodes</div>
|
| 114 |
<div className="p-1.5 bg-indigo-500/10 rounded-lg text-indigo-500"><Zap size={16} /></div>
|
| 115 |
</div>
|
| 116 |
<div className="text-2xl font-bold text-foreground mb-2">{stats?.counts?.accounts ?? '...'}</div>
|
| 117 |
<div className="flex items-center gap-1.5 text-[10px] text-emerald-400/60 font-medium">
|
| 118 |
+
<span className="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"></span> {Number(stats?.counts?.accounts) > 0 ? 'Cluster Online' : 'Status: Isolated'}
|
| 119 |
</div>
|
| 120 |
</div>
|
| 121 |
|
| 122 |
+
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all">
|
| 123 |
<div className="flex justify-between items-start mb-2">
|
| 124 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Entity Leads</div>
|
| 125 |
<div className="p-1.5 bg-purple-500/10 rounded-lg text-purple-400"><Shield size={16} /></div>
|
|
|
|
| 128 |
<div className="flex items-center gap-1.5 text-[10px] text-foreground/30 font-medium italic">Targeted leads analyzed</div>
|
| 129 |
</div>
|
| 130 |
|
| 131 |
+
<div className="bg-card border border-border p-5 rounded-[20px] relative overflow-hidden group hover:border-indigo-500/30 transition-all">
|
| 132 |
<div className="flex justify-between items-start mb-2">
|
| 133 |
<div className="text-foreground/40 text-[11px] font-bold tracking-wider uppercase font-mono">Queue Depth</div>
|
| 134 |
<div className="p-1.5 bg-amber-500/10 rounded-lg text-amber-500"><Activity size={16} /></div>
|
|
|
|
| 139 |
</div>
|
| 140 |
|
| 141 |
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 mb-8">
|
| 142 |
+
<div className="lg:col-span-2 bg-card border border-border rounded-[32px] p-8 relative overflow-hidden group flex flex-col min-h-[420px]">
|
| 143 |
<div className="flex items-center gap-3 mb-2">
|
| 144 |
<div className="p-2 bg-emerald-500/10 rounded-xl text-emerald-500">
|
| 145 |
<TrendingUp size={24} />
|
|
|
|
| 148 |
</div>
|
| 149 |
<p className="text-sm text-foreground/40 mb-10 font-medium">Message outreach over the last 7 days</p>
|
| 150 |
|
| 151 |
+
<div className="flex-1 mt-4 flex">
|
| 152 |
+
{/* Y-Axis Labels */}
|
| 153 |
+
<div className="flex flex-col justify-between py-10 pr-6 text-[10px] font-mono text-foreground/60 font-bold h-full w-20 shrink-0 text-right border-r border-border/30">
|
| 154 |
{[1400, 1050, 700, 350, 0].map(val => (
|
| 155 |
+
<span key={val}>{val}</span>
|
|
|
|
|
|
|
|
|
|
| 156 |
))}
|
| 157 |
</div>
|
| 158 |
|
| 159 |
+
<div className="flex-1 relative pl-6">
|
| 160 |
+
{/* Grid Lines */}
|
| 161 |
+
<div className="absolute inset-x-0 inset-y-0 flex flex-col justify-between pointer-events-none opacity-10 py-10 ml-6">
|
| 162 |
+
{[1400, 1050, 700, 350, 0].map(val => (
|
| 163 |
+
<div key={val} className="w-full border-t border-dashed border-foreground/50" />
|
| 164 |
+
))}
|
| 165 |
+
</div>
|
| 166 |
|
| 167 |
+
<div className="absolute inset-x-0 bottom-0 flex justify-between pointer-events-none ml-6">
|
| 168 |
+
{dateLabels.map(label => (
|
| 169 |
+
<span key={label} className="text-[10px] font-mono text-foreground/40 font-bold">{label}</span>
|
| 170 |
+
))}
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<svg className="w-full h-full pb-10" viewBox="0 0 1000 200" preserveAspectRatio="none">
|
| 174 |
<defs>
|
| 175 |
<linearGradient id="areaGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
| 176 |
<stop offset="0%" stopColor="#6366f1" stopOpacity="0.3" />
|
|
|
|
| 217 |
);
|
| 218 |
})}
|
| 219 |
</svg>
|
| 220 |
+
</div>
|
| 221 |
</div>
|
| 222 |
</div>
|
| 223 |
|
| 224 |
+
<div className="bg-card border border-border rounded-[32px] p-8 flex flex-col relative overflow-hidden group">
|
| 225 |
<div className="absolute -bottom-10 -right-10 opacity-[0.02] group-hover:scale-110 transition-transform duration-1000">
|
| 226 |
<Shield size={200} />
|
| 227 |
</div>
|
|
|
|
| 230 |
<div className="space-y-3">
|
| 231 |
<div className="flex justify-between text-[11px] font-bold text-foreground/30 uppercase tracking-widest">
|
| 232 |
<span>Network Integrity</span>
|
| 233 |
+
<span className="text-emerald-500 tracking-tighter">{stats?.service_health?.database || 'Stable'}</span>
|
| 234 |
</div>
|
| 235 |
<div className="h-2 bg-foreground/[0.03] rounded-full overflow-hidden border border-border/10 p-[1px]">
|
| 236 |
+
<div className="h-full bg-gradient-to-r from-emerald-600 to-emerald-400 w-[100%] rounded-full"></div>
|
| 237 |
</div>
|
| 238 |
</div>
|
| 239 |
<div className="space-y-3">
|
|
|
|
| 242 |
<span className="text-indigo-500 tracking-tighter">{stats?.service_health?.poller || 'Active'}</span>
|
| 243 |
</div>
|
| 244 |
<div className="h-2 bg-foreground/[0.03] rounded-full overflow-hidden border border-border/10 p-[1px]">
|
| 245 |
+
<div className="h-full bg-gradient-to-r from-indigo-600 to-indigo-400 w-[85%] rounded-full animate-pulse"></div>
|
| 246 |
</div>
|
| 247 |
</div>
|
| 248 |
<div className="space-y-3">
|
|
|
|
| 264 |
|
| 265 |
{/* Latest Activity Table */}
|
| 266 |
<h3 className="text-lg font-bold mb-5 text-foreground tracking-tight">Recent Live Tasks</h3>
|
| 267 |
+
<div className="bg-card border border-border rounded-[24px] overflow-hidden">
|
| 268 |
<table className="w-full text-left border-collapse">
|
| 269 |
<thead>
|
| 270 |
<tr className="border-b border-border text-foreground/20 text-[11px] uppercase tracking-widest bg-foreground/[0.02]">
|