// Project page «Баги» (PEP-58, PEP-66): incidents list (tab) and Bugsink settings (⋯ Настройки проекта). import { Bug, CircleCheck, EyeOff, Inbox, MapPin, Play } from "lucide-react"; import { INCIDENT_STATUS_RU, incidentPolicies, POLICY_RU, type ErrorSource, type Incident, type IncidentSettings } from "@peppa/core"; import { connectErrorTrackingAction, decideIncidentAction, resolveIncidentAction, saveIncidentSettings } from "@/app/(app)/actions"; import { Hidden } from "@/components/cards"; import { ago, Disclosure, Empty, Key, Section } from "@/components/common"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Input, Label, NativeSelect, Textarea } from "@/components/ui/input"; import type { Words } from "@peppa/shared/wording"; import { getT } from "@/lib/i18n"; const STATUS_TONE: Record = { new: "danger", open: "warn", pending: "warn", task: "info", ignored: "muted", resolved: "ok", regressed: "danger" }; function Code({ children }: { children: React.ReactNode }) { return {children}; } /** Tab «Баги»: the incidents list. Settings live in «⋯ Настройки проекта» (PEP-66). */ export async function IncidentsSection(props: { projectId: number; back: string; settings: IncidentSettings | null; incidents: Incident[]; taskKeys: Map; w: Words; }) { const { settings: s, w } = props; const t = await getT(); if (!s) { return (

{w.engineer ? t("Ошибки фронта и бэка из прода (Bugsink, SDK Sentry) приходят сюда и становятся стори по политике проекта.") : t("Когда ваш продукт заработает, его ошибки будут приходить сюда и становиться задачами для агентов.")}

{t("Отслеживание ошибок не подключено — подключает владелец в «Настройках проекта».")}
); } const active = props.incidents.filter((i) => !["ignored", "resolved"].includes(i.status)); const rest = props.incidents.filter((i) => ["ignored", "resolved"].includes(i.status)); return (
{t("политика: {policy}", { policy: t(POLICY_RU[s.policy]) })} : undefined}> {active.length === 0 ? {t("Открытых ошибок нет.")} : active.map((i) => )} {rest.length > 0 && (
{rest.map((i) => ( ))}
)}
); } /** «⋯ Настройки проекта» → Баги: connect Bugsink, DSN, webhook, incident policy (PEP-66). */ export async function IncidentSettingsPanel(props: { projectId: number; back: string; isOwner: boolean; settings: IncidentSettings | null; sources: ErrorSource[]; webhookUrl: string | null; w: Words; }) { const { projectId, back, settings: s, w } = props; const t = await getT(); if (!s) { return (

{w.engineer ? t("Ошибки фронта и бэка из прода (Bugsink, SDK Sentry) приходят во вкладку «Баги» и становятся стори по политике проекта.") : t("Ошибки вашего продукта будут приходить во вкладку «Баги» и становиться задачами для агентов.")}

{props.isOwner ? (
) : ( {t("Не подключено — подключает владелец проекта.")} )}
); } // PEP-123: addresses, variables and the policy of incidents are an engineer's settings. if (w.product) return

{t("Подключено: ошибки вашего продукта приходят во вкладку «Баги» и становятся задачами для агентов.")}

; return (
{props.sources.map((src) => (
{src.kind === "web" ? t("DSN фронта (web)") : t("DSN бэка (api)")} {src.dsn}
))}

{t("В коде:")} NEXT_PUBLIC_SENTRY_DSN / SENTRY_DSN {t("из окружения,")} release = {t("SHA деплоя,")}{" "} environment = prod, sendDefaultPii: false.

{!s.webhookAuto && props.webhookUrl && (
{t("Вебхук не настроен автоматически.")} {t("В Bugsink: проект → Alerts → Custom webhook:")} {props.webhookUrl} {t("Пока его нет, FORGE опрашивает Bugsink раз в 2 минуты.")}
)}