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.

Update sales text/styles

Tim Wilsonfe6d572d731d
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/activity-list.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/activity-list.tsx
index 99e24162f3..740e858399 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/activity-list.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/activity-list.tsx
@@ -7,6 +7,7 @@ import { leadEventEnrichedSchema } from "@/lib/zod/schemas/leads";
import { saleEventEnrichedSchema } from "@/lib/zod/schemas/sales";
import { EventList } from "@dub/blocks";
import {
+ CaretUpFill,
ChartActivity2,
CursorRays,
Globe,
@@ -126,7 +127,8 @@ function LeadDescription({
const saleText = {
"Subscription creation": "upgraded their account",
- "Subscription update": "paid their subscription",
+ "Subscription paid": "paid their subscription",
+ "Plan upgraded": "upgraded their plan",
default: "made a payment",
};
@@ -156,7 +158,10 @@ function SaleDescription({
{saleText[event.event_name] || saleText.default}
</div>
{event.amount && event.amount > 0 && (
- <span className="font-medium text-gray-700 sm:pr-8 md:pr-12 lg:pr-20">
+ <span className="flex items-center gap-1 whitespace-nowrap font-medium text-gray-700 sm:pr-8 md:pr-12 lg:pr-20">
+ {event.event_name === "Plan upgraded" && (
+ <CaretUpFill className="size-3 text-green-600" />
+ )}
{currencyFormatter(
Math.floor(event.amount * REFERRAL_REVENUE_SHARE) / 100,
{
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx
index fd5bb89d58..02e42fdc5f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx
@@ -142,7 +142,7 @@ const placeholderEvents = {
country: "US",
}) as z.infer<typeof leadEventEnrichedSchema>,
),
- sales: [...Array(2)].map(
+ sales: [...Array(3)].map(
(_, idx) =>
({
timestamp: subDays(new Date(), idx).toISOString(),
@@ -152,7 +152,12 @@ const placeholderEvents = {
key: "",
url: "https://dub.co",
country: "US",
- amount: [11, 49][idx % 2],
+ event_name: [
+ "Subscription creation",
+ "Subscription paid",
+ "Plan upgraded",
+ ][idx % 3],
+ amount: [1100, 4900, 2400][idx % 3],
}) as z.infer<typeof saleEventEnrichedSchema>,
),
};
@@ -188,9 +193,12 @@ async function ActivityListRSC({
page,
});
- const totalEvents = (await getTotalEvents(link.id)) ?? 0;
+ const totalEvents = await getTotalEvents(link.id);
return (
- <ActivityList events={events as any} totalEvents={totalEvents[event]} />
+ <ActivityList
+ events={events as any}
+ totalEvents={totalEvents[event] ?? 0}
+ />
);
}
diff --git a/packages/blocks/src/event-list.tsx b/packages/blocks/src/event-list.tsx
index 93732439c0..dc37510212 100644
--- a/packages/blocks/src/event-list.tsx
+++ b/packages/blocks/src/event-list.tsx
@@ -22,7 +22,7 @@ export function EventList({ events, totalEvents, emptyState }: EventListProps) {
return (
<div className="rounded-xl border border-gray-200">
- {totalEvents === 0 ? (
+ {events.length === 0 && totalEvents === 0 ? (
<div className="px-4 py-8">
<EmptyState {...emptyState} />
</div>
diff --git a/packages/ui/src/icons/nucleo/caret-up-fill.tsx b/packages/ui/src/icons/nucleo/caret-up-fill.tsx
new file mode 100644
index 0000000000..c8c8cba3e7
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/caret-up-fill.tsx
@@ -0,0 +1,20 @@
+import { SVGProps } from "react";
+
+export function CaretUpFill(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <path
+ d="M10.478,3.389c-.323-.509-.875-.812-1.478-.812s-1.155,.304-1.478,.812L2.497,11.313c-.341,.539-.362,1.222-.055,1.781s.895,.906,1.533,.906H14.024c.638,0,1.226-.347,1.533-.906s.287-1.242-.055-1.781L10.478,3.389Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 1ff38292c3..7a02c183bb 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -8,6 +8,7 @@ export * from "./book2";
export * from "./box-archive";
export * from "./bullet-list";
export * from "./cards";
+export * from "./caret-up-fill";
export * from "./chart-activity2";
export * from "./chart-line";
export * from "./check";