peppa/apps/web/app/(app)/page.tsx
Асель 2b0f2fd984 PEP-1: web platform with Gitea login, projects, goals, tasks, sessions
- web: Gitea OAuth2 login, signed session cookie, everything behind login;
  inbox with answers, project board (goals → tasks), task page with
  OpenSpec artifacts, questions and session controls; new project form;
  auto-refresh, light/dark, mobile
- users + projects.owner_id; tokens AES-256-GCM encrypted; owner-only access
- provisionProject (runner): new or existing Gitea repo, peppa-bot
  collaborator, template + openspec init, push, rollback; used by web and
  peppa project create (replaces scripts/bootstrap-project.sh)
- peppa web login-link, peppa project owner; Gitea OAuth app script
- bins/template resolved via PEPPA_ROOT (works inside the Next build)
- testkit: mock-gitea + 10 tests (42 e2e total, all green)
- OpenSpec: pep-1-web-platform archived into specs web-auth,
  project-provisioning, web-workspace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 20:55:02 +05:00

47 lines
1.9 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, 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 Inbox({ 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} />
<section>
<h1>Входящие {items.length > 0 && <span className="count">{items.length}</span>}</h1>
{items.length === 0 ? <p className="empty">Агентам от тебя ничего не нужно.</p> : items.map((q) => <QuestionCard key={q.id} q={q} taskKey={q.taskKey} back="/" />)}
</section>
<section>
<h2>Активные сессии</h2>
{sessions.length === 0 ? <p className="empty">Сейчас ничего не запущено.</p> : sessions.map((s) => <SessionCard key={s.id} s={s} back="/" />)}
</section>
<section>
<h2>Мои проекты</h2>
{projects.length === 0 ? (
<p className="empty">
Проектов пока нет. <Link href="/projects/new">Создать первый</Link>
</p>
) : (
<ul className="projects">
{projects.map((p) => (
<li key={p.id}>
<Link href={`/p/${p.key}`}>
<span className="mono">{p.key}</span> {p.name}
</Link>
<span className="muted">{p.giteaOwner}/{p.giteaRepo}</span>
</li>
))}
</ul>
)}
</section>
</>
);
}