Cartoon pug (inline SVG) on Home: sleeps when nothing waits, perks up with a speech bubble and question count when agents ask. Motion only without prefers-reduced-motion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
2.2 KiB
TypeScript
36 lines
2.2 KiB
TypeScript
import { listUserProjects, onboardingChecklist } from "@peppa/core";
|
||
import { OnboardingChecklist } from "@/components/Onboarding";
|
||
import { PugBanner } from "@/components/PugMascot";
|
||
import { LiveRefresh } from "@/components/LiveRefresh";
|
||
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, onboarding] = await Promise.all([inbox(user.id), activeSessions(user.id), listUserProjects(db, user.id), onboardingChecklist(db, user)]);
|
||
return (
|
||
<Workspace aside={<ActivityAside questions={false} />}>
|
||
<LiveRefresh scope="home" />
|
||
<Flash error={error} />
|
||
<PageHeader title="Главная">{items.length ? "Агенты ждут твоего решения — ответь здесь, в Telegram или через MCP." : "Всё идёт само: агентам от тебя ничего не нужно."}</PageHeader>
|
||
{onboarding.visible && <OnboardingChecklist data={onboarding} />}
|
||
<Section title="Вопросы агентов" count={items.length}>
|
||
<PugBanner count={items.length} />
|
||
{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>
|
||
);
|
||
}
|