Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

872 B
Raw Blame
import { useRouter } from "next/router";
import { api } from "@/src/utils/api";
import { formatLocalIsoDate } from "@/src/utils/dates";
import { BillingCurrentPlanLabel } from "./BillingCurrentPlanLabel";

export const BillingPlanPeriodView = () => {
  const router = useRouter();
  const orgId = router.query.organizationId as string | undefined;

  const { data, isLoading } = api.cloudBilling.getSubscriptionInfo.useQuery(
    { orgId: orgId ?? "" },
    { enabled: Boolean(orgId) },
  );

  return (
    <div className="text-muted-foreground flex flex-col gap-1 text-sm">
      <BillingCurrentPlanLabel />
      <p>
        Billing period:{" "}
        {!isLoading &&
          data?.billingPeriod &&
          `${formatLocalIsoDate(data.billingPeriod.start, false, "day")} - ${formatLocalIsoDate(data.billingPeriod.end, false, "day")}`}
      </p>
    </div>
  );
};