76 lines
2.1 KiB
TypeScript
76 lines
2.1 KiB
TypeScript
"use client";
|
||
|
||
import Link from "next/link";
|
||
import { Button, EmptyState } from "@/components/ds";
|
||
|
||
/**
|
||
* Honest unavailable surface when a platform foundation or entitlement is absent.
|
||
* Never invents data or demo cards.
|
||
*/
|
||
export function CapabilityUnavailable({
|
||
title,
|
||
description,
|
||
requiredCapability,
|
||
requiredBundle,
|
||
requiredPlan,
|
||
reason,
|
||
billingHref = "/billing",
|
||
secondaryHref,
|
||
secondaryLabel,
|
||
}: {
|
||
title: string;
|
||
description?: string;
|
||
requiredCapability?: string | null;
|
||
requiredBundle?: string | null;
|
||
requiredPlan?: string | null;
|
||
reason?: string | null;
|
||
billingHref?: string;
|
||
secondaryHref?: string;
|
||
secondaryLabel?: string;
|
||
}) {
|
||
return (
|
||
<div className="space-y-4" role="status">
|
||
<EmptyState
|
||
title={title}
|
||
description={
|
||
description ||
|
||
reason ||
|
||
"این قابلیت در entitlement یا باندل فعلی در دسترس نیست."
|
||
}
|
||
action={
|
||
<div className="flex flex-wrap justify-center gap-2">
|
||
<Link href={billingHref}>
|
||
<Button size="sm">مشاهده پلن و ارتقا</Button>
|
||
</Link>
|
||
{secondaryHref && secondaryLabel ? (
|
||
<Link href={secondaryHref}>
|
||
<Button size="sm" variant="outline">
|
||
{secondaryLabel}
|
||
</Button>
|
||
</Link>
|
||
) : null}
|
||
</div>
|
||
}
|
||
/>
|
||
<ul className="mx-auto max-w-md space-y-1 text-center text-xs text-[var(--muted)]">
|
||
{requiredPlan ? (
|
||
<li>
|
||
پلن لازم: <span className="font-mono text-secondary">{requiredPlan}</span>
|
||
</li>
|
||
) : null}
|
||
{requiredCapability ? (
|
||
<li>
|
||
قابلیت لازم:{" "}
|
||
<span className="font-mono text-secondary">{requiredCapability}</span>
|
||
</li>
|
||
) : null}
|
||
{requiredBundle ? (
|
||
<li>
|
||
باندل لازم: <span className="font-mono text-secondary">{requiredBundle}</span>
|
||
</li>
|
||
) : null}
|
||
</ul>
|
||
</div>
|
||
);
|
||
}
|