The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix invoice page tabs
Steven Tey73b9a160a5ca
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/payout-stats.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/payout-stats.tsxindex 611c8f63f0..64b861ca31 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/payout-stats.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/payout-stats.tsx@@ -142,7 +142,7 @@ export function PayoutStats() {<div className="text-sm text-neutral-500">Total paid</div></div><Link- href={`/${slug}/settings/billing/invoices?type=payout`}+ href={`/${slug}/settings/billing/invoices?type=partnerPayout`}className={cn(buttonVariants({ variant: "secondary" }),"flex h-7 items-center rounded-md border px-2 text-sm",diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/success/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/success/page-client.tsxindex ebb28e855f..6c828b88db 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/success/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/success/page-client.tsx@@ -187,7 +187,7 @@ export function PayoutsSuccessPageClient() {<div className="relative p-6"><Link- href={`/${slug}/settings/billing/invoices?type=payout`}+ href={`/${slug}/settings/billing/invoices?type=partnerPayout`}className={cn("flex h-9 w-full items-center justify-center whitespace-nowrap rounded-lg border px-5 text-sm",buttonVariants({ variant: "primary" }),diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsxindex 0a90602ef0..f19fc64a2c 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsx@@ -14,16 +14,29 @@ import {useRouterStuff,} from "@dub/ui";import { cn, currencyFormatter, fetcher } from "@dub/utils";+import { useMemo } from "react";import useSWR from "swr";+const INVOICE_TYPES = [+ { id: "subscription", label: "Subscription" },+ { id: "partnerPayout", label: "Partner payouts" },+ { id: "domainRenewal", label: "Domain renewals" },+];+export default function WorkspaceInvoicesClient() {const { slug, defaultProgramId } = useWorkspace();const { searchParams, queryParams } = useRouterStuff();- const invoiceType = searchParams.get("type") || "subscription";+ const selectedInvoiceType = useMemo(() => {+ let type = searchParams.get("type");+ if (type === "payout") {+ type = "partnerPayout";+ }+ return INVOICE_TYPES.find((t) => t.id === type)!;+ }, [searchParams]);const { data: invoices } = useSWR<InvoiceProps[]>(- `/api/workspaces/${slug}/billing/invoices?type=${invoiceType}`,+ `/api/workspaces/${slug}/billing/invoices?type=${selectedInvoiceType.id}`,fetcher,);@@ -37,24 +50,18 @@ export default function WorkspaceInvoicesClient() {</p></div></div>- {defaultProgramId && (- <TabSelect- className="px-4 md:px-5"- options={[- { id: "subscription", label: "Subscription" },- { id: "domainRenewal", label: "Domain Renewals" },- { id: "partnerPayout", label: "Partner Payouts" },- ]}- selected={invoiceType}- onSelect={(id) => {- queryParams({- set: {- type: id,- },- });- }}- />- )}+ <TabSelect+ className="px-4 md:px-5"+ options={INVOICE_TYPES}+ selected={selectedInvoiceType.id}+ onSelect={(id) => {+ queryParams({+ set: {+ type: id,+ },+ });+ }}+ /><div className="grid divide-y divide-neutral-200 border-t border-neutral-200">{invoices ? (invoices.length > 0 ? (@@ -63,8 +70,8 @@ export default function WorkspaceInvoicesClient() {))) : (<AnimatedEmptyState- title="No invoices found"- description="You don't have any invoices yet"+ title={`No ${selectedInvoiceType.label.toLowerCase()} invoices found`}+ description={`You don't have any ${selectedInvoiceType.label.toLowerCase()} invoices yet`}cardContent={() => (<><Receipt2 className="size-4 text-neutral-700" />