Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
♻️ Simplify the billing page cards (#3321)
Luke Vellaa969716fabfe
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex 724f66215..7dacfb33c 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -94,13 +94,8 @@"basicPollsDescription": "Create simple scheduling polls","billing": "Billing","billingDescription": "Manage your billing information and subscription.",- "billingDetails": "Billing details",- "billingDetailsDescription": "The name, address and tax ID on your invoices.",- "billingDetailsHint": "Stored with Stripe and applied to future invoices.",- "billingPlanTitle": "Plan","billingSettings": "Billing settings","billingSettingsDescription": "View and manage your space's subscription and billing information.",- "billingSubscriptionDescription": "Manage your current subscription plan.","branding": "Branding","brandingCardDescription": "How this space looks to members and participants","brandingGeneralDescription": "Set the name of your instance",@@ -284,7 +279,6 @@"earlySupporterRateEndsNoPrice": "Your early supporter rate ends with your subscription.","earlySupporterRateKept": "You keep this rate for as long as your subscription stays active.","edit": "Edit",- "editBillingDetails": "Edit billing details","editDetails": "Edit details","editDetailsDescription": "Change the details of your event.","editEventTypeTitle": "Edit event type",@@ -510,7 +504,7 @@"makeAdmin": "Make admin","makeMember": "Make member","manage": "Manage",- "managePaymentMethods": "Manage payment methods",+ "manageBilling": "Manage billing","manageSeats": "Manage seats","manageSeatsDescription": "Adjust the number of seats for your space.","maxAttendees": "Max attendees",@@ -675,11 +669,11 @@"pastDueAlertTitle": "Payment failed","pastEventsEmptyStateDescription": "Past events will show up here.","pastEventsEmptyStateTitle": "No past events",+ "paymentAndBilling": "Payment and billing",+ "paymentAndBillingDescription": "How you pay and what appears on your invoices.","paymentMethodExpires": "Expires {month}/{year}","paymentMethodNone": "No saved payment method.","paymentMethodOthers": "{count, plural, one {# other saved} other {# others saved}}",- "paymentMethods": "Payment method",- "paymentMethodsDescription": "The card your subscription is charged to.","paymentMethodUpdatedAlertDescription": "Future invoices will be charged to your new payment method.","paymentMethodUpdatedAlertTitle": "Payment method updated","pending": "Pending",diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/components/billing-details-card.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/billing-details-card.tsxdeleted file mode 100644index e0db3ad35..000000000--- a/apps/web/src/app/[locale]/(space)/settings/billing/components/billing-details-card.tsx+++ /dev/null@@ -1,57 +0,0 @@-"use client";--import { Button } from "@rallly/ui/button";-import { ArrowUpRightIcon } from "lucide-react";-import { openBillingDetailsAction } from "@/features/billing/actions";-import { Trans } from "@/i18n/client";-import { useSafeAction } from "@/lib/safe-action/client";-import {- PlanCard,- PlanCardContent,- PlanCardDescription,- PlanCardFooter,- PlanCardHeader,- PlanCardHeading,- PlanCardHeadingDescription,- PlanCardHeadingTitle,-} from "./plan-card";--export function BillingDetailsCard({ className }: { className?: string }) {- const openBillingDetails = useSafeAction(openBillingDetailsAction);-- return (- <PlanCard className={className}>- <PlanCardHeading>- <PlanCardHeadingTitle>- <Trans i18nKey="billingDetails" defaults="Billing details" />- </PlanCardHeadingTitle>- <PlanCardHeadingDescription>- <Trans- i18nKey="billingDetailsDescription"- defaults="The name, address and tax ID on your invoices."- />- </PlanCardHeadingDescription>- </PlanCardHeading>- <PlanCardHeader>- <PlanCardContent>- <PlanCardDescription>- <Trans- i18nKey="billingDetailsHint"- defaults="Stored with Stripe and applied to future invoices."- />- </PlanCardDescription>- </PlanCardContent>- </PlanCardHeader>- <PlanCardFooter className="flex-row items-center">- <Button- className="ml-auto"- loading={openBillingDetails.isExecuting}- onClick={() => openBillingDetails.execute()}- >- <Trans i18nKey="editBillingDetails" defaults="Edit billing details" />- <ArrowUpRightIcon className="text-muted-foreground" />- </Button>- </PlanCardFooter>- </PlanCard>- );-}diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/components/hobby-plan-card.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/hobby-plan-card.tsxindex b8d99dab5..f62e815ef 100644--- a/apps/web/src/app/[locale]/(space)/settings/billing/components/hobby-plan-card.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/billing/components/hobby-plan-card.tsx@@ -10,26 +10,12 @@ import {PlanCardContent,PlanCardDescription,PlanCardHeader,- PlanCardHeading,- PlanCardHeadingDescription,- PlanCardHeadingTitle,PlanCardTitle,} from "./plan-card";export function HobbyPlanCard({ className }: { className?: string }) {return (<PlanCard className={className}>- <PlanCardHeading>- <PlanCardHeadingTitle>- <Trans i18nKey="billingPlanTitle" defaults="Plan" />- </PlanCardHeadingTitle>- <PlanCardHeadingDescription>- <Trans- i18nKey="billingSubscriptionDescription"- defaults="Manage your current subscription plan."- />- </PlanCardHeadingDescription>- </PlanCardHeading><PlanCardHeader><PlanCardContent><PlanCardTitle>diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/components/payment-methods-card.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/payment-and-billing-card.tsxsimilarity index 82%rename from apps/web/src/app/[locale]/(space)/settings/billing/components/payment-methods-card.tsxrename to apps/web/src/app/[locale]/(space)/settings/billing/components/payment-and-billing-card.tsxindex 0e1fdb39c..aaa0645b8 100644--- a/apps/web/src/app/[locale]/(space)/settings/billing/components/payment-methods-card.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/billing/components/payment-and-billing-card.tsx@@ -8,9 +8,9 @@ import { Trans } from "@/i18n/client";import { useSafeAction } from "@/lib/safe-action/client";import {PlanCard,+ PlanCardActions,PlanCardContent,PlanCardDescription,- PlanCardFooter,PlanCardHeader,PlanCardHeading,PlanCardHeadingDescription,@@ -30,7 +30,7 @@ const brandNames: Record<string, string> = {visa: "Visa",};-export function PaymentMethodsCard({+export function PaymentAndBillingCard({paymentMethods,className,}: {@@ -48,12 +48,12 @@ export function PaymentMethodsCard({<PlanCard className={className}><PlanCardHeading><PlanCardHeadingTitle>- <Trans i18nKey="paymentMethods" defaults="Payment method" />+ <Trans i18nKey="paymentAndBilling" defaults="Payment and billing" /></PlanCardHeadingTitle><PlanCardHeadingDescription><Trans- i18nKey="paymentMethodsDescription"- defaults="The card your subscription is charged to."+ i18nKey="paymentAndBillingDescription"+ defaults="How you pay and what appears on your invoices."/></PlanCardHeadingDescription></PlanCardHeading>@@ -100,20 +100,16 @@ export function PaymentMethodsCard({</PlanCardDescription>)}</PlanCardContent>+ <PlanCardActions>+ <Button+ loading={openBillingDetails.isExecuting}+ onClick={() => openBillingDetails.execute()}+ >+ <Trans i18nKey="manageBilling" defaults="Manage billing" />+ <ArrowUpRightIcon className="text-muted-foreground" />+ </Button>+ </PlanCardActions></PlanCardHeader>- <PlanCardFooter className="flex-row items-center">- <Button- className="ml-auto"- loading={openBillingDetails.isExecuting}- onClick={() => openBillingDetails.execute()}- >- <Trans- i18nKey="managePaymentMethods"- defaults="Manage payment methods"- />- <ArrowUpRightIcon className="text-muted-foreground" />- </Button>- </PlanCardFooter></PlanCard>);}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 b98a58747..1543853a8 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@@ -30,9 +30,6 @@ import {PlanCardDescription,PlanCardFooter,PlanCardHeader,- PlanCardHeading,- PlanCardHeadingDescription,- PlanCardHeadingTitle,PlanCardTitle,} from "./plan-card";import { SwitchToYearlyDialog } from "./switch-to-yearly-dialog";@@ -112,17 +109,6 @@ export function ProPlanCard({return (<PlanCard className={className}>- <PlanCardHeading>- <PlanCardHeadingTitle>- <Trans i18nKey="billingPlanTitle" defaults="Plan" />- </PlanCardHeadingTitle>- <PlanCardHeadingDescription>- <Trans- i18nKey="billingSubscriptionDescription"- defaults="Manage your current subscription plan."- />- </PlanCardHeadingDescription>- </PlanCardHeading><PlanCardHeader><PlanCardContent><PlanCardTitle>diff --git a/apps/web/src/app/[locale]/(space)/settings/billing/page.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/page.tsxindex 7e6e73e18..68301d317 100644--- a/apps/web/src/app/[locale]/(space)/settings/billing/page.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/billing/page.tsx@@ -25,9 +25,8 @@ import { requireUser } from "@/features/user/loaders";import { Trans } from "@/i18n/client";import { getTranslation } from "@/i18n/server";import { isFeatureEnabled } from "@/lib/feature-flags/server";-import { BillingDetailsCard } from "./components/billing-details-card";import { HobbyPlanCard } from "./components/hobby-plan-card";-import { PaymentMethodsCard } from "./components/payment-methods-card";+import { PaymentAndBillingCard } from "./components/payment-and-billing-card";import { ProPlanCard } from "./components/pro-plan-card";import { SupportCard } from "./components/support-card";@@ -107,10 +106,7 @@ export default async function BillingSettingsPage() {)}<BillingFlashAlert />{overview?.subscription.active ? (- <div className="grid gap-4 lg:grid-cols-2">- <PaymentMethodsCard paymentMethods={paymentMethods} />- <BillingDetailsCard />- </div>+ <PaymentAndBillingCard paymentMethods={paymentMethods} />) : null}<SupportCard /></div>