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.

Add rewards info + external ID

Tim Wilsond4a84abe33d4
diff --git a/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/customers/[customerId]/page-client.tsx b/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/customers/[customerId]/page-client.tsx
index 2b75b8ca4c..120b4069fe 100644
--- a/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/customers/[customerId]/page-client.tsx
+++ b/apps/web/app/partners.dub.co/(dashboard)/programs/[programSlug]/customers/[customerId]/page-client.tsx
@@ -1,5 +1,6 @@
"use client";
+import useProgramEnrollment from "@/lib/swr/use-program-enrollment";
import {
CustomerActivityResponse,
CustomerEnriched,
@@ -8,14 +9,16 @@ import {
import { CustomerActivityList } from "@/ui/customers/customer-activity-list";
import { CustomerDetailsColumn } from "@/ui/customers/customer-details-column";
import { CustomerSalesTable } from "@/ui/customers/customer-sales-table";
+import { ProgramRewardList } from "@/ui/partners/program-reward-list";
import { BackLink } from "@/ui/shared/back-link";
-import { User } from "@dub/ui";
+import { MoneyBill2, Tooltip, User } from "@dub/ui";
import { fetcher } from "@dub/utils";
import { notFound, useParams } from "next/navigation";
import { memo } from "react";
import useSWR from "swr";
export function ProgramCustomerPageClient() {
+ const { programEnrollment } = useProgramEnrollment();
const { programSlug, customerId } = useParams<{
programSlug: string;
customerId: string;
@@ -63,9 +66,27 @@ export function ProgramCustomerPageClient() {
{/* Main content */}
<div className="flex flex-col gap-10">
<section className="flex flex-col">
- <h2 className="py-3 text-lg font-semibold text-neutral-900">
- Earnings
- </h2>
+ <div className="flex items-center justify-between">
+ <h2 className="py-3 text-lg font-semibold text-neutral-900">
+ Earnings
+ </h2>
+ {programEnrollment?.rewards && (
+ <Tooltip
+ content={
+ <div>
+ <ProgramRewardList
+ rewards={programEnrollment?.rewards}
+ className="gap-2 border-none p-3"
+ />
+ </div>
+ }
+ >
+ <div className="border-border-subtle flex size-8 items-center justify-center rounded-full border hover:bg-neutral-50">
+ <MoneyBill2 className="size-4 text-neutral-800" />
+ </div>
+ </Tooltip>
+ )}
+ </div>
<EarningsTable customerId={customerId} />
</section>
diff --git a/apps/web/ui/customers/customer-details-column.tsx b/apps/web/ui/customers/customer-details-column.tsx
index abdc5cdaa3..aa3db0fefc 100644
--- a/apps/web/ui/customers/customer-details-column.tsx
+++ b/apps/web/ui/customers/customer-details-column.tsx
@@ -1,5 +1,5 @@
import { CustomerActivityResponse, CustomerProps } from "@/lib/types";
-import { ArrowUpRight, UTM_PARAMETERS } from "@dub/ui";
+import { ArrowUpRight, CopyButton, UTM_PARAMETERS } from "@dub/ui";
import {
capitalize,
cn,
@@ -175,7 +175,24 @@ export function CustomerDetailsColumn({
)}
</div>
- {utmParams && (
+ {customer && (customer?.externalId ?? null) !== null && (
+ <div className="flex flex-col gap-2">
+ <DetailHeading>External ID</DetailHeading>
+ {
+ <div className="flex items-center gap-1">
+ <span className="truncate">{customer.externalId}</span>
+ <CopyButton
+ value={customer.externalId}
+ variant="neutral"
+ className="p-1 [&>*]:h-3 [&>*]:w-3"
+ successMessage="Copied external ID to clipboard!"
+ />
+ </div>
+ }
+ </div>
+ )}
+
+ {utmParams && Boolean(utmParams.length) && (
<div className="flex flex-col gap-2">
<DetailHeading>UTM</DetailHeading>
<div className="grid w-full grid-cols-[min-content,minmax(0,1fr)] gap-x-4 gap-y-2 overflow-hidden">