import Link from "next/link"; import { ExternalLink, KeyRound, Rocket, X } from "lucide-react"; import type { ProductNeedView, ProductReview, ProjectProduct } from "@peppa/core"; import { Hidden } from "@/components/cards"; import { ago } from "@/components/common"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { deployProdAction, removeNeedAction, saveProjectSecretAction, setNeedDoneAction } from "@/app/(app)/actions"; import { wording } from "@peppa/shared/wording"; const host = (url: string) => url.replace(/^https?:\/\//, ""); /** * PEP-111: «Ваш продукт» on the project page — where the result is and what to do next, for a * product manager who asks «где это работает?». Nothing is shown before the first accepted story. */ export function ProductCard({ product, projectKey, chat = true, engineer = false, projectId, needs = [], review = null, back, }: { product: ProjectProduct; projectKey: string; chat?: boolean; /** PEP-119: «Инженер» gets the link to the releases tab, «Продакт» — the button right here. */ engineer?: boolean; projectId?: number; /** PEP-112: what the owner has to give before the product is real. */ needs?: ProductNeedView[]; /** PEP-112: the product agent's last acceptance. */ review?: ProductReview | null; back?: string; }) { // «Показать всем»: the same action as the button in «Релизы», without sending a product manager there. const showAll = engineer ? ( <> показать её всем можно в Релизах. ) : (
); const { task } = wording(engineer ? "engineer" : "product"); const { live, check, doneStories } = product; const open = needs.filter((n) => n.open); if (!live && !check && doneStories === 0 && !open.length) return null; const deployed = !!(live || check); const mayEdit = chat && projectId != null && !!back; const next = chat && (

Что дальше: опишите следующую задачу аналитику в чате — он поможет сформулировать {task("acc")}, агенты сделают.

); return (
{live ? (
Ваш продукт работает Открыт для всех по адресу {host(live.url)} · обновлён {ago(live.at)} {live.stories.length > 0 && <> · вошли {task("pl")} {live.stories.slice(0, 6).join(", ")}}
) : check ? (
Версия для проверки готова Пока её видите только вы: {host(check.url)} · обновлена {ago(check.at)}. Посмотрите — и, если всё хорошо, {showAll}
) : doneStories === 0 ? null : (
Готово {task("genPl")}: {doneStories} Этот проект пока не открывается по ссылке как сайт. Что получилось — на странице каждой готовой {task("gen")}, вкладка «Результат»{engineer ? ", и во вкладке «Код»" : ""}. Хотите открывать продукт по ссылке — попросите аналитика в чате: «сделай, чтобы продукт открывался по ссылке».
)} {live && check && (

Есть новая версия для проверки:{" "} {host(check.url)} {check.stories.length > 0 && ({check.stories.slice(0, 6).join(", ")})} — {showAll}

)} {open.length > 0 && (
{deployed ? "Работает в демо-режиме" : "Продукт будет работать в демо-режиме"} — чтобы заработало по-настоящему, нужно от вас: Пока этого нет, продукт показывает примеры вместо настоящей работы. Ключи хранятся зашифрованными; Peppa FACTORY сама передаст их продукту и перезапустит его — через пару минут после сохранения.
    {open.map((n) => (
  • {n.title} {n.why && Зачем: {n.why}} {n.how && Где взять: {n.how}}
    {mayEdit && (
    )}
    {mayEdit && (n.secret ? (
    ) : (
    ))}
  • ))}
)} {review && deployed && (review.howto.length > 0 || review.notReal.length > 0) && (
Как пользоваться продуктом

{review.summary}

{review.howto.length > 0 && (
    {review.howto.map((step, i) => (
  1. {step}
  2. ))}
)} {review.notReal.length > 0 && (
Пока не настоящее
    {review.notReal.map((x, i) => (
  • {x}
  • ))}
)}

Продукт посмотрел продакт-агент {ago(new Date(review.at))} — подробности в обсуждении проекта.

)} {next}
); }