From f869ad995cc9e871ea59d99844c231e7bd035db4 Mon Sep 17 00:00:00 2001 From: "sp.wack" <83104063+amanape@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:58:09 +0400 Subject: [PATCH 1/3] hotfix: Remove external link in billing settings UI (#6841) --- .../components/features/payment/payment-form.test.tsx | 6 ------ frontend/src/components/features/payment/payment-form.tsx | 8 -------- 2 files changed, 14 deletions(-) diff --git a/frontend/__tests__/components/features/payment/payment-form.test.tsx b/frontend/__tests__/components/features/payment/payment-form.test.tsx index 815d0530d103..323597693901 100644 --- a/frontend/__tests__/components/features/payment/payment-form.test.tsx +++ b/frontend/__tests__/components/features/payment/payment-form.test.tsx @@ -78,12 +78,6 @@ describe("PaymentForm", () => { expect(createCheckoutSessionSpy).toHaveBeenCalledWith(50.13); }); - it("should render the payment method link", async () => { - renderPaymentForm(); - - screen.getByTestId("payment-methods-link"); - }); - it("should disable the top-up button if the user enters an invalid amount", async () => { const user = userEvent.setup(); renderPaymentForm(); diff --git a/frontend/src/components/features/payment/payment-form.tsx b/frontend/src/components/features/payment/payment-form.tsx index e42a9e7894d0..db57a3667286 100644 --- a/frontend/src/components/features/payment/payment-form.tsx +++ b/frontend/src/components/features/payment/payment-form.tsx @@ -5,7 +5,6 @@ import { cn } from "#/utils/utils"; import MoneyIcon from "#/icons/money.svg?react"; import { SettingsInput } from "../settings/settings-input"; import { BrandButton } from "../settings/brand-button"; -import { HelpLink } from "../settings/help-link"; import { LoadingSpinner } from "#/components/shared/loading-spinner"; import { amountIsValid } from "#/utils/amount-is-valid"; @@ -80,13 +79,6 @@ export function PaymentForm() { {isPending && } - - ); } From 3f8bc8a7ea2fc634c2cc98c1349fef85862eabb8 Mon Sep 17 00:00:00 2001 From: "sp.wack" <83104063+amanape@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:58:23 +0400 Subject: [PATCH 2/3] hotfix: Set proper minimum and maximum defaults that can be entered in billing input (#6842) --- .../features/payment/payment-form.test.tsx | 2 +- frontend/__tests__/utils/amount-is-valid.test.ts | 12 +++++++++--- frontend/src/utils/amount-is-valid.ts | 4 +++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/__tests__/components/features/payment/payment-form.test.tsx b/frontend/__tests__/components/features/payment/payment-form.test.tsx index 323597693901..2d30f45fad5a 100644 --- a/frontend/__tests__/components/features/payment/payment-form.test.tsx +++ b/frontend/__tests__/components/features/payment/payment-form.test.tsx @@ -149,7 +149,7 @@ describe("PaymentForm", () => { renderPaymentForm(); const topUpInput = await screen.findByTestId("top-up-input"); - await user.type(topUpInput, "20"); // test assumes the minimum is 25 + await user.type(topUpInput, "9"); // test assumes the minimum is 10 const topUpButton = screen.getByText("Add credit"); await user.click(topUpButton); diff --git a/frontend/__tests__/utils/amount-is-valid.test.ts b/frontend/__tests__/utils/amount-is-valid.test.ts index 30181e1b48c9..3a940f77e0ad 100644 --- a/frontend/__tests__/utils/amount-is-valid.test.ts +++ b/frontend/__tests__/utils/amount-is-valid.test.ts @@ -24,9 +24,15 @@ describe("amountIsValid", () => { }); test("when an amount less than the minimum is passed", () => { - // test assumes the minimum is 25 - expect(amountIsValid("24")).toBe(false); - expect(amountIsValid("24.99")).toBe(false); + // test assumes the minimum is 10 + expect(amountIsValid("9")).toBe(false); + expect(amountIsValid("9.99")).toBe(false); + }); + + test("when an amount more than the maximum is passed", () => { + // test assumes the minimum is 25000 + expect(amountIsValid("25001")).toBe(false); + expect(amountIsValid("25000.01")).toBe(false); }); }); }); diff --git a/frontend/src/utils/amount-is-valid.ts b/frontend/src/utils/amount-is-valid.ts index c987fcecff17..0912221f9352 100644 --- a/frontend/src/utils/amount-is-valid.ts +++ b/frontend/src/utils/amount-is-valid.ts @@ -1,10 +1,12 @@ -const MINIMUM_AMOUNT = 25; +const MINIMUM_AMOUNT = 10; +const MAXIMUM_AMOUNT = 25_000; export const amountIsValid = (amount: string) => { const float = parseFloat(amount); if (Number.isNaN(float)) return false; if (float < 0) return false; if (float < MINIMUM_AMOUNT) return false; + if (float > MAXIMUM_AMOUNT) return false; return true; }; From 42f1fc92fa4330a9af38ac700aeb762a9a8cc1ad Mon Sep 17 00:00:00 2001 From: tofarr Date: Thu, 20 Feb 2025 14:56:20 +0000 Subject: [PATCH 3/3] Fix: Less squashed logo (#6853) --- .../src/components/shared/buttons/all-hands-logo-button.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/shared/buttons/all-hands-logo-button.tsx b/frontend/src/components/shared/buttons/all-hands-logo-button.tsx index e068f152af13..dfa015839f0d 100644 --- a/frontend/src/components/shared/buttons/all-hands-logo-button.tsx +++ b/frontend/src/components/shared/buttons/all-hands-logo-button.tsx @@ -12,7 +12,7 @@ export function AllHandsLogoButton({ onClick }: AllHandsLogoButtonProps) { ariaLabel="All Hands Logo" onClick={onClick} > - + ); }