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.

fix payoutsDisabled

Steven Teya0d43e5a3526
diff --git a/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx b/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx
index aab7356c6e..8b2fad5603 100644
--- a/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx
+++ b/apps/web/app/(ee)/app.dub.co/embed/referrals/page-client.tsx
@@ -251,7 +251,8 @@ export function ReferralsEmbedPageClient({
{selectedTab === "Quickstart" ? (
<ReferralsEmbedQuickstart
program={program}
- link={partnerLink ? links[0] : undefined}
+ links={links}
+ earnings={earnings}
hasResources={hasResources}
setSelectedTab={setSelectedTab}
/>
@@ -259,8 +260,8 @@ export function ReferralsEmbedPageClient({
<ReferralsEmbedEarnings salesCount={stats.sales} />
) : selectedTab === "Links" ? (
<ReferralsEmbedLinks
- links={links}
program={program}
+ links={links}
group={group}
/>
) : selectedTab === "Leaderboard" &&
diff --git a/apps/web/app/(ee)/app.dub.co/embed/referrals/quickstart.tsx b/apps/web/app/(ee)/app.dub.co/embed/referrals/quickstart.tsx
index 49795b999b..fe9321eb46 100644
--- a/apps/web/app/(ee)/app.dub.co/embed/referrals/quickstart.tsx
+++ b/apps/web/app/(ee)/app.dub.co/embed/referrals/quickstart.tsx
@@ -19,19 +19,24 @@ const BUTTON_CLASSNAME = "h-9 rounded-lg bg-bg-inverted hover:bg-neutral-800";
export function ReferralsEmbedQuickstart({
program,
- link,
+ links,
+ earnings,
hasResources,
setSelectedTab,
}: {
program: Program;
- link: ReferralsEmbedLink | undefined;
+ links: ReferralsEmbedLink[];
+ earnings: {
+ upcoming: number;
+ paid: number;
+ };
hasResources: boolean;
setSelectedTab: (tab: "Links" | "Resources") => void;
}) {
const [copied, copyToClipboard] = useCopyToClipboard();
const { isMobile } = useMediaQuery();
- const payoutsDisabled = !link || link.saleAmount === 0;
+ const payoutsDisabled = earnings.upcoming === 0 && earnings.paid === 0;
const items = [
{
@@ -42,15 +47,21 @@ export function ReferralsEmbedQuickstart({
<Button
className={BUTTON_CLASSNAME}
onClick={() => {
- if (link) {
- copyToClipboard(link.shortLink);
+ if (links.length > 0) {
+ copyToClipboard(links[0].shortLink);
} else {
setSelectedTab("Links");
}
}}
- text={link ? (copied ? "Copied link" : "Copy link") : "Create a link"}
+ text={
+ links.length > 0
+ ? copied
+ ? "Copied link"
+ : "Copy link"
+ : "Create a link"
+ }
icon={
- link ? (
+ links.length > 0 ? (
<div className="relative size-4">
<div
className={cn(