The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add conditional check
Kiran Kd1ca3b69c477
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/invoices/[payoutId]/route.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/invoices/[payoutId]/route.tsxindex 5191c9dcaa..d6ecebbd77 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/invoices/[payoutId]/route.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/invoices/[payoutId]/route.tsx@@ -61,6 +61,14 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {});}+ if (!["completed", "processing"].includes(payout.status)) {+ throw new DubApiError({+ code: "unauthorized",+ message:+ "This payout is not completed yet, hence no invoice is generated.",+ });+ }+const invoiceMetadata = [{label: "Program",diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-details-sheet.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-details-sheet.tsxindex 4af9e432f7..c8974e8b99 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-details-sheet.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-details-sheet.tsx@@ -89,18 +89,20 @@ function PayoutDetailsSheetContent({ payout }: PayoutDetailsSheetProps) {})}</strong>- <Tooltip content="View invoice">- <div className="flex h-5 w-5 items-center justify-center rounded-md transition-colors duration-150 hover:border hover:border-neutral-200 hover:bg-neutral-100">- <Link- href={`/invoices/${payout.id}`}- className="text-neutral-700"- target="_blank"- rel="noopener noreferrer"- >- <InvoiceDollar className="size-4" />- </Link>- </div>- </Tooltip>+ {["completed", "processing"].includes(payout.status) && (+ <Tooltip content="View invoice">+ <div className="flex h-5 w-5 items-center justify-center rounded-md transition-colors duration-150 hover:border hover:border-neutral-200 hover:bg-neutral-100">+ <Link+ href={`/invoices/${payout.id}`}+ className="text-neutral-700"+ target="_blank"+ rel="noopener noreferrer"+ >+ <InvoiceDollar className="size-4" />+ </Link>+ </div>+ </Tooltip>+ )}</div>),diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-table.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-table.tsxindex 921b3cc557..4f35efa788 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-table.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/settings/payouts/payout-table.tsx@@ -103,19 +103,22 @@ export function PayoutTable() {payoutsEnabled={Boolean(partner?.payoutsEnabledAt)}minPayoutAmount={row.original.program.minPayoutAmount}/>- <Tooltip content="View invoice">- <div className="flex h-5 w-5 items-center justify-center rounded-md transition-colors duration-150 hover:border hover:border-neutral-200 hover:bg-neutral-100">- <Link- href={`/invoices/${row.original.id}`}- className="text-neutral-700"- target="_blank"- rel="noopener noreferrer"- onClick={(e) => e.stopPropagation()}- >- <InvoiceDollar className="size-4" />- </Link>- </div>- </Tooltip>++ {["completed", "processing"].includes(row.original.status) && (+ <Tooltip content="View invoice">+ <div className="flex h-5 w-5 items-center justify-center rounded-md transition-colors duration-150 hover:border hover:border-neutral-200 hover:bg-neutral-100">+ <Link+ href={`/invoices/${row.original.id}`}+ className="text-neutral-700"+ target="_blank"+ rel="noopener noreferrer"+ onClick={(e) => e.stopPropagation()}+ >+ <InvoiceDollar className="size-4" />+ </Link>+ </div>+ </Tooltip>+ )}</div>),},