Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

make summary more clear

Steven Tey1f30b6ea597e
diff --git a/apps/web/ui/partners/create-payout-sheet.tsx b/apps/web/ui/partners/create-payout-sheet.tsx
index 89f2a8d6eb..017bc22182 100644
--- a/apps/web/ui/partners/create-payout-sheet.tsx
+++ b/apps/web/ui/partners/create-payout-sheet.tsx
@@ -158,7 +158,14 @@ function CreatePayoutSheetContent({ setIsOpen }: CreatePayoutSheetProps) {
const invoiceData = useMemo(() => {
const quantity = totalEvents?.[payoutType];
- const payoutAmount = quantity && amount ? quantity * amount : undefined;
+ let payoutAmount: number | undefined = undefined;
+ if (payoutType === "custom") {
+ payoutAmount = amount;
+ } else if (payoutType === "sales") {
+ // TODO: get actual sales value using data from the Sale table
+ } else {
+ payoutAmount = quantity && amount ? quantity * amount : undefined;
+ }
return {
...(selectedPartner && {
@@ -188,7 +195,7 @@ function CreatePayoutSheetContent({ setIsOpen }: CreatePayoutSheetProps) {
})}-${formatDate(end, { month: "short" })}`,
}),
- ...(typeof quantity === "number" && {
+ ...(payoutType !== "custom" && {
[capitalize(payoutType) as string]: isValidating ? (
<div className="h-4 w-12 animate-pulse rounded-md bg-neutral-200" />
) : (
@@ -196,6 +203,13 @@ function CreatePayoutSheetContent({ setIsOpen }: CreatePayoutSheetProps) {
full: true,
})
),
+ [`Reward per ${payoutType.replace(/s$/, "")}`]: currencyFormatter(
+ amount,
+ {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ },
+ ),
}),
...(payoutAmount && {