// PEP-224: a feature that depends on a failing service (Observability) — grey, inactive, with a // plain caption and the time it failed. Available — its children as they are; unstable — the // children with a note «может работать с задержками». For any new feature: pass `featureGateView`. import type { ReactNode } from "react"; import { CircleSlash, Clock } from "lucide-react"; import { serverTimezone, type FeatureGateView } from "@peppa/core"; import { getLocale, getT } from "@/lib/i18n"; import { intlLocale } from "@peppa/shared/i18n"; import { cn } from "@/lib/utils"; export async function FeatureGate({ view, label, title, children, className }: { view: FeatureGateView; /** The grey button's text (a button-like control). */ label?: ReactNode; /** A grey status instead (an instruction, a section). */ title?: ReactNode; children: ReactNode; className?: string }) { if (view.state === "available") return <>{children}>; const t = await getT(); if (view.state === "degraded") return ( <> {children}
{t.text(view.text)} {since ? " · " + t("с {time}", { time: since }) : ""}