'use client'; import { useEffect, useState } from 'react'; import { api, timeAgo } from '@/lib/api'; import { Send, Users, ChevronLeft, MessageSquare } from 'lucide-react'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { PageSkeleton } from '@/components/page-skeleton'; export default function TelegramPage() { const router = useRouter(); const [info, setInfo] = useState(null); const [recent, setRecent] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { (async () => { const [infoResp, recentResp] = await Promise.all([ api.telegram.channelInfo(), api.telegram.recent(10), ]); if (infoResp.success) setInfo(infoResp); if (recentResp.success) setRecent(recentResp.broadcasts || []); setLoading(false); })(); }, []); if (loading) { return ; } const isConfigured = info?.configured; return (
{/* Top bar */}

Telegram Channel

{/* Channel card */}

{info?.channelTitle || 'Cellex Official'}

{info?.subscriberCount || 0} subscribers {isConfigured ? ( Active ) : ( Coming soon )}
{isConfigured && info?.channelUrl && ( )}
{/* What you'll get */}

What you'll get

{[ { title: 'Live alerts', desc: 'Get notified when sellers go live' }, { title: 'New products', desc: 'Be first to see fresh listings' }, { title: 'Group buys', desc: 'Join group buys before they fill up' }, { title: 'Flash deals', desc: 'Limited-time offers and discounts' }, ].map((item) => (
{item.title}
{item.desc}
))}
{/* Recent broadcasts */}

Recent broadcasts

{recent.length === 0 ? (

No broadcasts yet

) : (
{recent.map((b) => (
{b.broadcast_type?.replace(/_/g, ' ')} {timeAgo(b.created_at)}

{b.message}

))}
)}
{/* Bot commands */}

Telegram bot commands

Chat with our bot to interact with Cellex right from Telegram:

{[ { cmd: '/subscribe', desc: 'Subscribe to broadcasts' }, { cmd: '/latest', desc: 'See latest products' }, { cmd: '/live', desc: 'See active live sessions' }, { cmd: '/groupbuys', desc: 'See active group buys' }, { cmd: '/buy ', desc: 'Get checkout URL for product' }, { cmd: '/unsubscribe', desc: 'Stop receiving broadcasts' }, ].map((c) => (
{c.cmd} {c.desc}
))}
); }