Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Remove section tabs from Usage & Billing (#8164)

ConnorYoh9b474c4f63a1
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.toml
index 04e9b9395f..1714c28661 100644
--- a/frontend/editor/public/locales/en-US/translation.toml
+++ b/frontend/editor/public/locales/en-US/translation.toml
@@ -8099,9 +8099,6 @@ limit = "Monthly spend limit {{amount}}/mo. Processing pauses at the limit."
limitNoCap = "No spend limit. Processing won't pause. Invoices post monthly."
[portal.billing.chip]
-invoices = "Invoices"
-nav = "Sections"
-payment = "Payment"
plan = "Plan"
procurement = "Procurement"
usage = "Usage"
diff --git a/frontend/editor/src/portal/views/Usage.test.tsx b/frontend/editor/src/portal/views/Usage.test.tsx
index 6ffeb8a2f5..4cdc966694 100644
--- a/frontend/editor/src/portal/views/Usage.test.tsx
+++ b/frontend/editor/src/portal/views/Usage.test.tsx
@@ -538,9 +538,7 @@ describe("Usage — link-free wallet renderer", () => {
renderUsage(<Usage />);
await waitFor(() => expect(fetchWallet).toHaveBeenCalled());
- expect(
- screen.queryByRole("button", { name: "License Key" }),
- ).not.toBeInTheDocument();
+ expect(document.getElementById("ub-license")).toBeNull();
});
it("places local license management at the end of billing and refreshes after a save", async () => {
@@ -558,10 +556,6 @@ describe("Usage — link-free wallet renderer", () => {
(section) => section.id,
);
expect(sections).toEqual(["ub-plan", "ub-usage", "ub-license"]);
- const scrollIntoView = vi.fn();
- document.getElementById("ub-license")!.scrollIntoView = scrollIntoView;
- fireEvent.click(screen.getByRole("button", { name: "License Key" }));
- expect(scrollIntoView).toHaveBeenCalled();
fetchWallet.mockClear();
fireEvent.click(
screen.getByRole("button", { name: "Activate local license" }),
@@ -570,7 +564,7 @@ describe("Usage — link-free wallet renderer", () => {
expect(refreshWalletCache).toHaveBeenCalledTimes(1);
});
- it("keeps the license section and navigation after payment and invoices", () => {
+ it("keeps the license section after payment and invoices", () => {
renderUsage(
<BillingScreen
wallet={freeWallet}
@@ -585,12 +579,6 @@ describe("Usage — link-free wallet renderer", () => {
(section) => section.id,
),
).toEqual(["ub-plan", "ub-usage", "ub-pay", "ub-inv", "ub-license"]);
- expect(
- Array.from(
- document.querySelectorAll(".billing-card__chip"),
- (chip) => chip.textContent,
- ),
- ).toEqual(["Plan", "Usage", "Payment", "Invoices", "License Key"]);
});
it.each([
@@ -635,12 +623,8 @@ describe("Usage — link-free wallet renderer", () => {
);
await screen.findByText("Wallet unavailable");
expect(screen.getByText("Local license form")).toBeInTheDocument();
- expect(
- screen.getByRole("button", { name: "License Key" }),
- ).toBeInTheDocument();
- expect(
- screen.queryByRole("button", { name: "Plan" }),
- ).not.toBeInTheDocument();
+ expect(document.getElementById("ub-license")).not.toBeNull();
+ expect(document.getElementById("ub-plan")).toBeNull();
});
it("starts procurement from the billing CTA without leaving Usage", async () => {
@@ -692,18 +676,14 @@ describe("Usage — link-free wallet renderer", () => {
).not.toBeInTheDocument();
});
- it("anchors an existing deal before Plan and connects its jump button", async () => {
+ it("anchors an existing deal before Plan", async () => {
procurement.started = true;
procurement.stage = "trial";
fetchWallet.mockResolvedValue({ ...walletOf("free"), role: "leader" });
- const scroll = vi.fn();
renderUsage(<Usage />);
await screen.findByText("The full PDF Editor.");
const section = screen.getByRole("region", { name: "Procurement" });
- section.scrollIntoView = scroll;
expect(section.nextElementSibling?.id).toBe("ub-plan");
- fireEvent.click(screen.getByRole("button", { name: "Procurement" }));
- expect(scroll).toHaveBeenCalled();
expect(
screen.queryByRole("button", { name: "Get an enterprise quote" }),
).not.toBeInTheDocument();
@@ -728,9 +708,7 @@ describe("Usage — link-free wallet renderer", () => {
expect(
screen.getByRole("region", { name: "Procurement" }),
).toBeInTheDocument();
- expect(
- screen.queryByRole("button", { name: "Plan" }),
- ).not.toBeInTheDocument();
+ expect(document.getElementById("ub-plan")).toBeNull();
});
it("hides stale purchase controls when the billing session becomes unavailable", async () => {
@@ -750,8 +728,8 @@ describe("Usage — link-free wallet renderer", () => {
expect(
screen.queryByRole("button", { name: "Switch on the Processor" }),
).not.toBeInTheDocument();
- expect(screen.getByRole("button", { name: "Plan" })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: "Usage" })).toBeInTheDocument();
+ expect(document.getElementById("ub-plan")).not.toBeNull();
+ expect(document.getElementById("ub-usage")).not.toBeNull();
});
it("shows one recovery notice without a separate expired-session banner", async () => {
diff --git a/frontend/editor/src/proprietary/billing/BillingScreen.test.tsx b/frontend/editor/src/proprietary/billing/BillingScreen.test.tsx
index 58163cf164..43805708dc 100644
--- a/frontend/editor/src/proprietary/billing/BillingScreen.test.tsx
+++ b/frontend/editor/src/proprietary/billing/BillingScreen.test.tsx
@@ -325,8 +325,8 @@ it("retains Plan and Usage while data is unavailable without inventing figures o
licenseSection={<span>Local license</span>}
/>,
);
- expect(screen.getByRole("button", { name: "Plan" })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: "Usage" })).toBeInTheDocument();
+ expect(document.getElementById("ub-plan")).not.toBeNull();
+ expect(document.getElementById("ub-usage")).not.toBeNull();
expect(
screen.getByText("Renew access to read billing data."),
).toBeInTheDocument();
diff --git a/frontend/editor/src/proprietary/billing/BillingScreen.tsx b/frontend/editor/src/proprietary/billing/BillingScreen.tsx
index cc7415ade1..3176a24213 100644
--- a/frontend/editor/src/proprietary/billing/BillingScreen.tsx
+++ b/frontend/editor/src/proprietary/billing/BillingScreen.tsx
@@ -1,5 +1,5 @@
import type { ReactNode } from "react";
-import { useCallback, useMemo, useState } from "react";
+import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Skeleton } from "@app/ui";
import {
@@ -98,8 +98,6 @@ function cycleDay(
* and the payment and invoice sections all arrive as props and slots. That is what lets one
* component serve the cloud, self-hosted and the desktop app, and it makes a member's read-only
* screen a matter of passing no callbacks rather than a role check.
- *
- * <p>A chip exists only where its section does, so an omitted slot removes both.
*/
export function BillingScreen({
usersInUse,
@@ -133,12 +131,6 @@ export function BillingScreen({
const { t } = useTranslation();
const [comparing, setComparing] = useState(false);
- const jump = useCallback((id: string) => {
- document
- .getElementById(id)
- ?.scrollIntoView({ behavior: "smooth", block: "start" });
- }, []);
-
const enterpriseProcessor = serverPlan?.licenseType === "ENTERPRISE";
const paying = Boolean(wallet?.processor?.active) && !enterpriseProcessor;
const teamHeld = Boolean(wallet?.team?.held);
@@ -147,39 +139,6 @@ export function BillingScreen({
? wallet?.docsProcessedThisPeriod
: pdfsProcessed;
- const chips = useMemo(() => {
- const out: Array<[string, string]> = [];
- if (procurementSection)
- out.push([
- "ub-procurement",
- t("portal.billing.chip.procurement", "Procurement"),
- ]);
- if (wallet || serverPlan || legacyPlan || unavailable)
- out.push(["ub-plan", t("portal.billing.chip.plan", "Plan")]);
- if (wallet || unavailable)
- out.push(["ub-usage", t("portal.billing.chip.usage", "Usage")]);
- if (wallet && paymentSection)
- out.push(["ub-pay", t("portal.billing.chip.payment", "Payment")]);
- if (wallet && invoicesSection)
- out.push(["ub-inv", t("portal.billing.chip.invoices", "Invoices")]);
- if (licenseSection)
- out.push([
- "ub-license",
- t("admin.settings.premium.inputMethod.text", "License Key"),
- ]);
- return out;
- }, [
- wallet,
- serverPlan,
- legacyPlan,
- unavailable,
- procurementSection,
- licenseSection,
- paymentSection,
- invoicesSection,
- t,
- ]);
-
const identity = useMemo(() => {
if (serverPlan)
return {
@@ -360,22 +319,6 @@ export function BillingScreen({
legacyPlan ||
unavailable) && (
<div className="billing-card">
- <nav
- className="billing-card__chips"
- aria-label={t("portal.billing.chip.nav", "Sections")}
- >
- {chips.map(([id, label]) => (
- <button
- key={id}
- type="button"
- className="billing-card__chip"
- onClick={() => jump(id)}
- >
- {label}
- </button>
- ))}
- </nav>
-
{procurementSection && (
<section
id="ub-procurement"
diff --git a/frontend/editor/src/proprietary/billing/billing-screen.css b/frontend/editor/src/proprietary/billing/billing-screen.css
index a42c328c63..c842805b46 100644
--- a/frontend/editor/src/proprietary/billing/billing-screen.css
+++ b/frontend/editor/src/proprietary/billing/billing-screen.css
@@ -55,39 +55,10 @@
border-radius: 0.75rem;
}
-.billing-card__chips {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 0.375rem;
- padding: 0.625rem 1.125rem;
- border-bottom: 1px solid var(--c-border-subtle);
-}
-
-.billing-card__chip {
- padding: 0.3125rem 0.6875rem;
- font: inherit;
- font-size: 0.75rem;
- font-weight: 600;
- color: var(--c-text-subtle);
- cursor: pointer;
- background: transparent;
- border: none;
- border-radius: 0.4375rem;
- transition:
- background-color 0.12s ease,
- color 0.12s ease;
-}
-
-.billing-card__chip:hover {
- color: var(--c-text);
- background: var(--c-hover);
-}
-
.billing-sec {
padding: 1.25rem 1.625rem 0.125rem;
border-top: 1px solid var(--c-border-subtle);
- /* Chips scroll to these, so clear the sticky page head. */
+ /* Deep links (#ub-license) scroll to these, so clear the sticky page head. */
scroll-margin-top: 3.25rem;
}