import Link from "next/link"; import { ExternalLink, Rocket } from "lucide-react"; import type { ProjectProduct } from "@peppa/core"; import { ago } from "@/components/common"; import { Button } from "@/components/ui/button"; import { getT } from "@/lib/i18n"; import { Hidden } from "@/components/cards"; import { deployProdAction } from "@/app/(app)/actions"; 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 async function ProductCard({ product, projectKey, chat = true, engineer = false, back }: { product: ProjectProduct; projectKey: string; chat?: boolean; /** PEP-119: «Инженер» gets the link to the releases tab, «Продакт» — one button. */ engineer?: boolean; back?: string }) { const t = await getT(); // «Показать всем»: the same action as the button in «Релизы», without sending a product manager there. const showAll = engineer ? ( <> {t("показать её всем можно в")} {t("Релизах")}. ) : (
); const { live, check, doneStories } = product; if (!live && !check && doneStories === 0) return null; const next = chat && (

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

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

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

)} {next}
); }