The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
show the `Reward amount` for sales
Kiran K35e8f4ddece4
diff --git a/apps/web/lib/actions/partners/create-manual-payout.ts b/apps/web/lib/actions/partners/create-manual-payout.tsindex 19c8a35ef3..fb3ca2f49b 100644--- a/apps/web/lib/actions/partners/create-manual-payout.ts+++ b/apps/web/lib/actions/partners/create-manual-payout.ts@@ -92,6 +92,10 @@ export const createManualPayoutAction = authActionClient});}+ if (!payout) {+ throw new Error("Failed to create payout. Please try again.");+ }+console.info("Manual payout created", payout);return payout;diff --git a/apps/web/ui/partners/create-payout-sheet.tsx b/apps/web/ui/partners/create-payout-sheet.tsxindex 190e353c2f..1eb79ada86 100644--- a/apps/web/ui/partners/create-payout-sheet.tsx+++ b/apps/web/ui/partners/create-payout-sheet.tsx@@ -69,6 +69,7 @@ function CreatePayoutSheetContent({ setIsOpen }: CreatePayoutSheetProps) {const { data: partners } = usePartners();const { id: workspaceId } = useWorkspace();const { queryParams } = useRouterStuff();+const {register,handleSubmit,@@ -79,6 +80,10 @@ function CreatePayoutSheetContent({ setIsOpen }: CreatePayoutSheetProps) {} = useForm<FormData>({defaultValues: {type: "sales",+ amount:+ program?.commissionType === "flat"+ ? Number(program.commissionAmount) / 100+ : undefined,},});@@ -376,6 +381,22 @@ function CreatePayoutSheetContent({ setIsOpen }: CreatePayoutSheetProps) {<select{...register("type", { required: true })}className="block w-full rounded-md border-gray-300 text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ onChange={(e) => {+ const type = e.target.value as PayoutType;++ setValue("type", type);++ if (+ type === "sales" &&+ program?.commissionAmount &&+ program.commissionType === "flat"+ ) {+ setValue("amount", program.commissionAmount / 100);+ } else {+ // @ts-expect-error+ setValue("amount", null);+ }+ }}>{Object.values(PayoutType).map((type) => (<option key={type} value={type}>@@ -385,38 +406,36 @@ function CreatePayoutSheetContent({ setIsOpen }: CreatePayoutSheetProps) {</select></div>- {payoutType !== "sales" && (- <div>- <label- htmlFor="amount"- className="text-sm font-medium text-neutral-800"- >- Reward amount- </label>- <div className="relative mt-2 rounded-md shadow-sm">- <span className="absolute inset-y-0 left-0 flex items-center pl-3 text-sm text-neutral-400">- $- </span>- <input- className={cn(- "block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",- "pl-6 pr-[6.5rem]",- payoutType === "custom" && "pr-12",- )}- {...register("amount", {- required: true,- })}- autoComplete="off"- placeholder="5"- />- <span className="absolute inset-y-0 right-0 flex items-center pr-3 text-sm text-neutral-400">- USD- {payoutType !== "custom" &&- ` per ${payoutType.replace(/s$/, "")}`}- </span>- </div>+ <div>+ <label+ htmlFor="amount"+ className="text-sm font-medium text-neutral-800"+ >+ Reward amount+ </label>+ <div className="relative mt-2 rounded-md shadow-sm">+ <span className="absolute inset-y-0 left-0 flex items-center pl-3 text-sm text-neutral-400">+ $+ </span>+ <input+ className={cn(+ "block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",+ "pl-6 pr-[6.5rem]",+ payoutType === "custom" && "pr-12",+ )}+ {...register("amount", {+ required: true,+ })}+ autoComplete="off"+ placeholder="5"+ />+ <span className="absolute inset-y-0 right-0 flex items-center pr-3 text-sm text-neutral-400">+ USD+ {payoutType !== "custom" &&+ ` per ${payoutType.replace(/s$/, "")}`}+ </span></div>- )}+ </div><div className="flex flex-col gap-2"><label