peppa/apps/web/app/(app)/page.tsx
Асель c03b679a1d PEP-38: all pages on the console components, globals.css removed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:21:44 +05:00

32 lines
2.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { listUserProjects } from "@peppa/core";
import { AutoRefresh } from "@/components/AutoRefresh";
import { ActivityAside } from "@/components/ActivityAside";
import { ProjectList, QuestionCard, SessionCard } from "@/components/cards";
import { Empty, Flash, MoreLink, PageHeader, Section } from "@/components/common";
import { Workspace } from "@/components/Workspace";
import { requireUser } from "@/lib/auth";
import { db } from "@/lib/db";
import { activeSessions, inbox } from "@/lib/queries";
export default async function Home({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
const user = await requireUser();
const { error } = await searchParams;
const [items, sessions, projects] = await Promise.all([inbox(user.id), activeSessions(user.id), listUserProjects(db, user.id)]);
return (
<Workspace aside={<ActivityAside questions={false} />}>
<AutoRefresh />
<Flash error={error} />
<PageHeader title="Главная">{items.length ? "Агенты ждут твоего решения — ответь здесь, в Telegram или через MCP." : "Всё идёт само: агентам от тебя ничего не нужно."}</PageHeader>
<Section title="Вопросы агентов" count={items.length}>
{items.length === 0 ? <Empty>Агентам от тебя ничего не нужно.</Empty> : items.map((q) => <QuestionCard key={q.id} q={q} taskKey={q.taskKey} taskStatus={q.taskStatus} back="/" />)}
</Section>
<Section title="Активные раннеры" actions={<MoreLink href="/runners">все раннеры</MoreLink>}>
{sessions.length === 0 ? <Empty>Сейчас ничего не запущено.</Empty> : sessions.map((s) => <SessionCard key={s.id} s={s} back="/" showTitle />)}
</Section>
<Section title="Мои проекты" actions={<MoreLink href="/projects">все проекты</MoreLink>}>
<ProjectList projects={projects} userId={user.id} />
</Section>
</Workspace>
);
}