import { redirect } from 'next/navigation'; import Link from 'next/link'; import { requireUser } from '@/lib/session'; import { engine } from '@/lib/engine'; import Header from '@/components/Header'; import { Plus, MessageSquare, Users, Target } from 'lucide-react'; const GOAL_LABELS = { educational: 'Обучение', news: 'Новости', entertainment: 'Развлечение', expert: 'Экспертный', sales: 'Продажи', }; export default async function HomePage() { const user = await requireUser(); if (!user) redirect('/landing'); let channels = []; try { channels = await engine.listChannels(user.id); } catch (err) { console.error('listChannels failed:', err.message); } return ( <>

Мои каналы

Управляй контентом и публикациями

Добавить канал
{channels.length === 0 ? (

Нет каналов

Добавь первый канал чтобы начать генерировать контент

Создать первый канал
) : (
{channels.map(ch => (

{ch.name}

{ch.tg_username && ( @{ch.tg_username} )}
{ch.platform || 'telegram'}
{ch.niche && (

{ch.niche}

)}
{ch.goal && ( {GOAL_LABELS[ch.goal] || ch.goal} )} {ch.language && ( {ch.language.toUpperCase()} )}
))}
)}
); }