"use client";
import Link from "next/link";
import { useLicense } from "@/lib/useLicense";
export function LicenseBanner() {
const { license } = useLicense();
if (!license) return null;
if (license.state === "expired") {
const when = license.expires_at ? new Date(license.expires_at).toLocaleDateString() : "recently";
return (
Your Vantage licence expired on {when}. Your servers and monitors are still running,
but changes are disabled until it is renewed.{" "}
Add a licence
);
}
if (license.state === "invalid") {
return (
This instance has no valid licence. Changes are disabled.{" "}
Add a licence
);
}
if (typeof license.days_remaining === "number" && license.days_remaining <= 14) {
return (
Your licence expires in {license.days_remaining} day
{license.days_remaining === 1 ? "" : "s"}.
);
}
return null;
}