import Link from "next/link"; import { ArrowRight, MessagesSquare } from "lucide-react"; import { chatOverview, syncChats } from "@peppa/core"; import { LiveRefresh } from "@/components/LiveRefresh"; import { AgentBadge } from "@/components/AgentBadge"; import { QuestionCard } from "@/components/cards"; import { ago, Empty, Flash, PageHeader, Section } from "@/components/common"; import { Workspace } from "@/components/Workspace"; import { requireUser } from "@/lib/auth"; import { db } from "@/lib/db"; import { inbox } from "@/lib/queries"; export const metadata = { title: "Чаты — Peppa FACTORY" }; /** * «Чаты» (PEP-117): the overview a product manager lands on — what waits for their answer and * where to write to the analyst of each project. The raw feed of events lives at /chats/master. */ export default async function Chats({ searchParams }: { searchParams: Promise<{ error?: string }> }) { const user = await requireUser(); const { error } = await searchParams; await syncChats(db).catch((e) => console.error("syncChats", e)); const [cards, waiting] = await Promise.all([chatOverview(db, user), inbox(user.id)]); return ( Здесь вы разговариваете с фабрикой: отвечаете агентам и пишете аналитику своего проекта — что узнать или что сделать.
{waiting.length === 0 ? ( Сейчас от вас ничего не нужно — агенты работают сами. ) : ( waiting.map((q) => ) )}
{cards.length === 0 ? ( Проектов пока нет. Создайте проект — и у него появится чат с аналитиком. ) : (
    {cards.map((c) => (
  • {c.key} {c.name} {c.unread > 0 && {c.unread} нов.} {c.open > 0 && ждут ответа: {c.open}} {c.last ? ( {c.last.who === "Аналитик" ? : {c.last.mine ? "вы" : c.last.who}} · {ago(c.last.at)} {c.last.text} ) : ( Здесь пока тихо. Спросите аналитика, что с проектом, или опишите новую задачу. )} Написать аналитику
  • ))}
)}

Нужна история? Все события по вашим проектам — что делали агенты, релизы и сбои, справочно.

); }