'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { Sparkles, CheckCircle, ArrowRight, Loader2, Bot, Hash, Zap } from 'lucide-react'; const PLATFORMS = [ { v: 'telegram', label: 'Telegram', icon: '✈️', desc: 'Канал или группа' }, { v: 'vk', label: 'ВКонтакте', icon: '🔵', desc: 'Группа или паблик' }, { v: 'max', label: 'MAX', icon: '🟣', desc: 'Мессенджер MAX' }, ]; const NICHES = [ 'Технологии и ИИ', 'Бизнес и финансы', 'Маркетинг и SMM', 'Здоровье и спорт', 'Образование', 'Развлечения', 'Новости', 'Другое', ]; export default function OnboardingPage() { const router = useRouter(); const [step, setStep] = useState(1); const [platform, setPlatform] = useState('telegram'); const [name, setName] = useState(''); const [niche, setNiche] = useState(''); const [busy, setBusy] = useState(false); const [error, setError] = useState(''); const [done, setDone] = useState(false); const [channel, setChannel] = useState(null); async function createChannel() { if (!name.trim()) { setError('Введите название канала'); return; } setBusy(true); setError(''); try { const res = await fetch('/api/channels', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: name.trim(), platform, niche }), }).then(r => r.json()); if (res.error) { setError(res.error); setBusy(false); return; } setChannel(res); setDone(true); setStep(3); } catch { setError('Ошибка соединения'); } setBusy(false); } return (
{/* Progress */}
{[1,2,3].map(n => (
n ? 'bg-green-500 text-white' : step === n ? 'bg-accent text-white' : 'bg-surface2 text-gray-500' }`}> {step > n ? : n}
{n < 3 &&
n ? 'bg-green-500' : 'bg-surface2'}`} />}
))}
{/* Шаг 1 — платформа */} {step === 1 && ( <>
👋

Добро пожаловать!

Создадим первый канал за пару минут

Выберите платформу:

{PLATFORMS.map(p => ( ))}
)} {/* Шаг 2 — название и ниша */} {step === 2 && ( <>

Расскажите о канале

AI будет генерировать контент в нужном стиле

setName(e.target.value)} className="input w-full" placeholder="Например: Tech Insider RU" autoFocus />
{NICHES.map(n => ( ))}
{error &&

{error}

}
)} {/* Шаг 3 — готово */} {step === 3 && ( <>
🎉

Канал создан!

Что делать дальше:

{[ { icon: Bot, text: 'Подключите бота Telegram в настройках канала', color: 'text-blue-400' }, { icon: Hash, text: 'AI сгенерирует темы постов автоматически', color: 'text-purple-400' }, { icon: Zap, text: 'Напишите первый пост с помощью AI', color: 'text-yellow-400' }, ].map(({ icon: Icon, text, color }) => (
{text}
))}
)}

У вас 50 бесплатных кредитов для старта

); }