peppa/apps/web/app/(app)/page.tsx
Асель 412f5f05ce PEP-61: top menu — Home instead of Inbox, Runners and Projects pages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:02:37 +05:00

37 lines
1.7 KiB
TypeScript
Raw 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 Link from "next/link";
import { listUserProjects } from "@peppa/core";
import { AutoRefresh } from "@/components/AutoRefresh";
import { Flash, ProjectList, QuestionCard, SessionCard } from "@/components/ui";
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 (
<>
<AutoRefresh />
<Flash error={error} />
<h1>Главная</h1>
<section>
<h2>Вопросы агентов {items.length > 0 && <span className="count">{items.length}</span>}</h2>
{items.length === 0 ? <p className="empty">Агентам от тебя ничего не нужно.</p> : items.map((q) => <QuestionCard key={q.id} q={q} taskKey={q.taskKey} taskStatus={q.taskStatus} back="/" />)}
</section>
<section>
<h2>
Активные раннеры <Link href="/runners" className="more">все раннеры →</Link>
</h2>
{sessions.length === 0 ? <p className="empty">Сейчас ничего не запущено.</p> : sessions.map((s) => <SessionCard key={s.id} s={s} back="/" />)}
</section>
<section>
<h2>
Мои проекты <Link href="/projects" className="more">все проекты →</Link>
</h2>
<ProjectList projects={projects} userId={user.id} />
</section>
</>
);
}