Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Fix billing plan card actions at narrow widths (#3323)
Luke Vellabaa245e44297
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex ab8658642..90863eb41 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -428,7 +428,6 @@"inviteStatusSending": "Sending","inviteStatusSent": "Sent","inviteUpdated": "Invitation updated with new role",- "invoices": "Invoices","jobTitle": "Your role","jobTitleAdministratorOrCoordinator": "Administrator or coordinator","jobTitleConsultantOrFreelancer": "Consultant or freelancer",diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/components/plan-card.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/plan-card.tsxindex fca283817..eb5849a37 100644--- a/apps/web/src/app/[locale]/(space)/settings/billing/components/plan-card.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/billing/components/plan-card.tsx@@ -38,7 +38,7 @@ export function PlanCardHeader({return (<divclassName={cn(- "flex @sm:flex-row flex-col @sm:items-center gap-4 p-4",+ "flex @sm:flex-row flex-col @sm:flex-wrap @sm:items-center gap-4 p-4",className,)}{...props}@@ -50,7 +50,14 @@ export function PlanCardContent({className,...props}: React.ComponentProps<"div">) {- return <div className={cn("min-w-0 space-y-1", className)} {...props} />;+ return (+ // basis-56 rather than auto so the row wraps once the text is squeezed to+ // that width, instead of letting the actions push past the card edge.+ <div+ className={cn("min-w-0 grow @sm:basis-56 space-y-1", className)}+ {...props}+ />+ );}export function PlanCardTitle({@@ -82,11 +89,11 @@ export function PlanCardActions({...props}: React.ComponentProps<"div">) {return (+ // No ml-auto: the content's grow already pushes the actions right while+ // they share its row, and once they wrap onto their own row there is+ // nothing to push against, so they stay left aligned.<div- className={cn(- "@sm:ml-auto flex shrink-0 flex-wrap items-center gap-2",- className,- )}+ className={cn("flex flex-wrap items-center gap-2", className)}{...props}/>);diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.test.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.test.tsxindex 8839853cd..c05450901 100644--- a/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.test.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.test.tsx@@ -73,9 +73,11 @@ describe("ProPlanCard", () => {expect(screen.getByRole("button", { name: /cancel plan/i }),).toBeInTheDocument();+ // Invoices live in the payment and billing card, which opens the same+ // portal, so the footer does not repeat the link.expect(- screen.getByRole("button", { name: /invoices/i }),- ).toBeInTheDocument();+ screen.queryByRole("button", { name: /invoices/i }),+ ).not.toBeInTheDocument();expect(screen.queryByRole("button", { name: /resume plan/i }),).not.toBeInTheDocument();@@ -123,10 +125,6 @@ describe("ProPlanCard", () => {expect(screen.queryByRole("button", { name: /cancel plan/i }),).not.toBeInTheDocument();- // Invoices stay reachable after cancellation is scheduled.- expect(- screen.getByRole("button", { name: /invoices/i }),- ).toBeInTheDocument();});it("hides resume while the account is scheduled for deletion", () => {diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.tsxindex 1543853a8..2e17af7d1 100644--- a/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/billing/components/pro-plan-card.tsx@@ -4,9 +4,8 @@ import { posthog } from "@rallly/posthog/client";import { Button } from "@rallly/ui/button";import { DialogTrigger, useDialog } from "@rallly/ui/dialog";import { toast } from "@rallly/ui/sonner";-import { ArrowUpRightIcon, TriangleAlertIcon } from "lucide-react";+import { TriangleAlertIcon } from "lucide-react";import {- openBillingDetailsAction,openCancelPlanAction,openPaymentMethodUpdateAction,resumePlanAction,@@ -76,7 +75,6 @@ export function ProPlanCard({const switchToYearlyDialog = useDialog();const openCancelPlan = useSafeAction(openCancelPlanAction);const openPaymentMethodUpdate = useSafeAction(openPaymentMethodUpdateAction);- const openBillingDetails = useSafeAction(openBillingDetailsAction);const resumePlan = useSafeAction(resumePlanAction, {onSuccess: () => {toast.success(@@ -263,27 +261,16 @@ export function ProPlanCard({values={{ count: seats }}/></span>- <div className="flex items-center gap-1">+ {endsAtPeriodEnd ? null : (<Buttonvariant="ghost"className="text-muted-foreground"- loading={openBillingDetails.isExecuting}- onClick={() => openBillingDetails.execute()}+ loading={openCancelPlan.isExecuting}+ onClick={() => openCancelPlan.execute()}>- <Trans i18nKey="invoices" defaults="Invoices" />- <ArrowUpRightIcon className="text-muted-foreground" />+ <Trans i18nKey="cancelPlan" defaults="Cancel plan" /></Button>- {endsAtPeriodEnd ? null : (- <Button- variant="ghost"- className="text-muted-foreground"- loading={openCancelPlan.isExecuting}- onClick={() => openCancelPlan.execute()}- >- <Trans i18nKey="cancelPlan" defaults="Cancel plan" />- </Button>- )}- </div>+ )}</PlanCardFooter></PlanCard>);