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.

final touches

Steven Teyba521ad5ed6f
diff --git a/apps/web/app/app.dub.co/marketplace/[[...segments]]/page.tsx b/apps/web/app/app.dub.co/marketplace/[[...segments]]/page.tsx
index 9067610d7e..3002bd48da 100644
--- a/apps/web/app/app.dub.co/marketplace/[[...segments]]/page.tsx
+++ b/apps/web/app/app.dub.co/marketplace/[[...segments]]/page.tsx
@@ -49,7 +49,7 @@ export async function generateMetadata(props: {
// categoryMeta should always return a value, but just in case
const categoryMeta = PROGRAM_CATEGORIES_MAP[category];
const label = categoryMeta?.label ?? category.replaceAll("_", " ");
- title = `Best ${label} Affiliate Programs in ${currentYear}`;
+ title = `Best ${label} SaaS Affiliate Programs in ${currentYear}`;
description =
categoryMeta?.listPageDescription ??
`Browse the best ${label} affiliate programs on Dub's Program Marketplace.`;
diff --git a/apps/web/lib/network/program-categories.ts b/apps/web/lib/network/program-categories.ts
index fbcd110359..564c9aa86f 100644
--- a/apps/web/lib/network/program-categories.ts
+++ b/apps/web/lib/network/program-categories.ts
@@ -26,84 +26,84 @@ export const PROGRAM_CATEGORIES: {
label: "AI",
icon: Sparkle3,
listPageDescription:
- "Browse the best affiliate programs for AI tools, agents, and chatbots.",
+ "Browse the best SaaS affiliate programs for AI tools, agents, and chatbots.",
},
{
id: Category.Development,
label: "DevTools",
icon: Code,
listPageDescription:
- "Browse the best affiliate programs for developer tools, APIs, and no-code platforms.",
+ "Browse the best SaaS affiliate programs for developer tools, APIs, and no-code platforms.",
},
{
id: Category.Design,
label: "Design",
icon: Brush,
listPageDescription:
- "Browse the best affiliate programs for graphic design tools and creative software.",
+ "Browse the best SaaS affiliate programs for graphic design tools and creative software.",
},
{
id: Category.Productivity,
label: "Productivity",
icon: CircleHalfDottedClock,
listPageDescription:
- "Browse the best affiliate programs for productivity apps, email tools, and collaboration software.",
+ "Browse the best SaaS affiliate programs for productivity apps, email tools, and collaboration software.",
},
{
id: Category.Finance,
label: "FinTech",
icon: MoneyBill,
listPageDescription:
- "Browse the best affiliate programs for trading, crypto, and finance apps.",
+ "Browse the best SaaS affiliate programs for trading, crypto, and finance apps.",
},
{
id: Category.Marketing,
label: "Marketing",
icon: MarketingTarget,
listPageDescription:
- "Browse the best affiliate programs for marketing software, email marketing, and SEO tools.",
+ "Browse the best SaaS affiliate programs for marketing software, email marketing, and SEO tools.",
},
{
id: Category.Ecommerce,
label: "Ecommerce",
icon: CreditCard,
listPageDescription:
- "Browse the best affiliate programs for online stores, newsletters, and ecommerce platforms.",
+ "Browse the best SaaS affiliate programs for online stores, newsletters, and ecommerce platforms.",
},
{
id: Category.Security,
label: "Security",
icon: ShieldKeyhole,
listPageDescription:
- "Browse the best affiliate programs for cybersecurity software and privacy tools.",
+ "Browse the best SaaS affiliate programs for cybersecurity software and privacy tools.",
},
{
id: Category.Education,
label: "Education",
icon: BookOpen,
listPageDescription:
- "Browse the best affiliate programs for edtech, learning tools, and education software.",
+ "Browse the best SaaS affiliate programs for edtech, learning tools, and education software.",
},
{
id: Category.Health,
label: "Healthcare",
icon: Heart,
listPageDescription:
- "Browse the best affiliate programs for healthtech, wellness apps, and health software.",
+ "Browse the best SaaS affiliate programs for healthtech, wellness apps, and health software.",
},
{
id: Category.Consumer,
label: "Consumer",
icon: User,
listPageDescription:
- "Browse the best affiliate programs for consumer apps and lifestyle software.",
+ "Browse the best SaaS affiliate programs for consumer apps and lifestyle software.",
},
{
id: Category.Support,
label: "Support",
icon: Headset,
listPageDescription:
- "Browse the best affiliate programs for customer support software and agentic tools.",
+ "Browse the best SaaS affiliate programs for customer support software and agentic tools.",
},
];
diff --git a/apps/web/prisma/schema/commission.prisma b/apps/web/prisma/schema/commission.prisma
index e6d657f4b7..23d4cc28ff 100644
--- a/apps/web/prisma/schema/commission.prisma
+++ b/apps/web/prisma/schema/commission.prisma
@@ -60,6 +60,7 @@ model Commission {
@@index(payoutId)
@@index(customerId)
@@index(linkId)
+ @@index(type)
@@index(status)
@@index(rewardId)
@@index(userId)
diff --git a/apps/web/prisma/schema/schema.prisma b/apps/web/prisma/schema/schema.prisma
index dda1495405..3e704a4733 100644
--- a/apps/web/prisma/schema/schema.prisma
+++ b/apps/web/prisma/schema/schema.prisma
@@ -56,9 +56,10 @@ model User {
activityLogs ActivityLog[]
createdCommissions Commission[]
- @@index(sentMail)
- @@index(source)
+ @@index(createdAt)
@@index(defaultWorkspace)
+ @@index(source)
+ @@index(sentMail)
}
model Account {
diff --git a/apps/web/ui/program-marketplace/external/marketplace-external-apply-button.tsx b/apps/web/ui/program-marketplace/external/marketplace-external-apply-button.tsx
index e89c0941be..095c94a82d 100644
--- a/apps/web/ui/program-marketplace/external/marketplace-external-apply-button.tsx
+++ b/apps/web/ui/program-marketplace/external/marketplace-external-apply-button.tsx
@@ -1,28 +1,31 @@
"use client";
import { Button } from "@dub/ui";
-import { PARTNERS_DOMAIN } from "@dub/utils";
-import { useSession } from "next-auth/react";
+import { fetcher, PARTNERS_DOMAIN } from "@dub/utils";
+import useSWR from "swr";
export function MarketplaceExternalApplyButton({
programSlug,
}: {
programSlug: string;
}) {
- const { data: session } = useSession();
+ const { data: session } = useSWR("/api/auth/session", fetcher, {
+ dedupingInterval: 60000,
+ });
+
return (
<a
href={
- session
+ session && Object.keys(session).length > 0
? `${PARTNERS_DOMAIN}/marketplace/${programSlug}`
: `${PARTNERS_DOMAIN}/${programSlug}/apply`
}
target="_blank"
- className="inline-block w-fit"
+ className="inline-block"
>
<Button
text="Apply"
- className="h-10 w-fit rounded-lg px-6 text-sm font-medium"
+ className="h-9 w-fit rounded-lg px-5 text-sm font-medium"
/>
</a>
);
diff --git a/apps/web/ui/program-marketplace/external/marketplace-external-list-page-client.tsx b/apps/web/ui/program-marketplace/external/marketplace-external-list-page-client.tsx
index 401736adbf..75ee97c110 100644
--- a/apps/web/ui/program-marketplace/external/marketplace-external-list-page-client.tsx
+++ b/apps/web/ui/program-marketplace/external/marketplace-external-list-page-client.tsx
@@ -125,7 +125,7 @@ export function MarketplaceExternalListPageClient({
) : fetchedPrograms.length > 0 ? (
<MarketplaceProgramGrid
programs={fetchedPrograms}
- showStatus={false}
+ externalMarketplace
className={cn(isValidating && "opacity-50")}
/>
) : (
diff --git a/apps/web/ui/program-marketplace/external/marketplace-external-list-page.tsx b/apps/web/ui/program-marketplace/external/marketplace-external-list-page.tsx
index 0ae5526280..48d27d87b0 100644
--- a/apps/web/ui/program-marketplace/external/marketplace-external-list-page.tsx
+++ b/apps/web/ui/program-marketplace/external/marketplace-external-list-page.tsx
@@ -46,7 +46,7 @@ export async function MarketplaceExternalListPage({
const defaultGrid =
initialPrograms.length > 0 ? (
- <MarketplaceProgramGrid programs={initialPrograms} showStatus={false} />
+ <MarketplaceProgramGrid programs={initialPrograms} externalMarketplace />
) : (
<MarketplaceProgramGridEmpty />
);
@@ -57,9 +57,9 @@ export async function MarketplaceExternalListPage({
title={
categoryMeta ? (
<>
- {categoryMeta.label} affiliate
+ {categoryMeta.label} SaaS
<br />
- programs
+ affiliate programs
</>
) : undefined
}
diff --git a/apps/web/ui/program-marketplace/marketplace-program-grid.tsx b/apps/web/ui/program-marketplace/marketplace-program-grid.tsx
index d9ac0b4aa6..bba6c0e4cf 100644
--- a/apps/web/ui/program-marketplace/marketplace-program-grid.tsx
+++ b/apps/web/ui/program-marketplace/marketplace-program-grid.tsx
@@ -7,11 +7,11 @@ import {
export function MarketplaceProgramGrid({
programs,
- showStatus = true,
+ externalMarketplace = false,
className,
}: {
programs: NetworkProgramProps[];
- showStatus?: boolean;
+ externalMarketplace?: boolean;
className?: string;
}) {
return (
@@ -26,7 +26,7 @@ export function MarketplaceProgramGrid({
<MarketplaceProgramCard
key={program.id}
program={program}
- showStatus={showStatus}
+ externalMarketplace={externalMarketplace}
/>
))}
</div>
diff --git a/apps/web/ui/program-marketplace/program-card.tsx b/apps/web/ui/program-marketplace/program-card.tsx
index 22b6370b40..748b7933b0 100644
--- a/apps/web/ui/program-marketplace/program-card.tsx
+++ b/apps/web/ui/program-marketplace/program-card.tsx
@@ -15,11 +15,11 @@ import { ProgramStatusBadge } from "./program-status-badge";
export function MarketplaceProgramCard({
program,
- showStatus = true,
+ externalMarketplace = false,
className,
}: {
program: NetworkProgramProps;
- showStatus?: boolean;
+ externalMarketplace?: boolean;
className?: string;
}) {
const router = useRouter();
@@ -39,7 +39,7 @@ export function MarketplaceProgramCard({
className="size-12 shrink-0 rounded-full object-cover"
/>
- {showStatus ? <ProgramStatusBadge program={program} /> : null}
+ {!externalMarketplace ? <ProgramStatusBadge program={program} /> : null}
</div>
<div className="mt-6 flex flex-col sm:mt-8">
@@ -66,50 +66,57 @@ export function MarketplaceProgramCard({
)
}
className="mt-2"
+ {...(externalMarketplace
+ ? { descriptionClassName: "sm:max-w-[200px]" }
+ : {})}
/>
</div>
)}
- {Boolean(program.categories.length) && (
- <div className="hidden min-w-0 sm:block">
- <span className="text-content-muted block text-xs font-medium">
- Category
- </span>
- <div className="mt-2 flex items-center gap-1.5">
- {program.categories
- .slice(0, 1)
- ?.map((category) => (
- <ProgramCategory
- key={category}
- category={category}
- onClick={() =>
- router.push(getMarketplaceCategoryHref(category))
+ {Boolean(program.categories.length) &&
+ // hide categories for external marketplace (narrow max width)
+ !externalMarketplace && (
+ <div className="hidden min-w-0 sm:block">
+ <span className="text-content-muted block text-xs font-medium">
+ Category
+ </span>
+ <div className="mt-2 flex items-center gap-1.5">
+ {program.categories
+ .slice(0, 1)
+ ?.map((category) => (
+ <ProgramCategory
+ key={category}
+ category={category}
+ onClick={() =>
+ router.push(getMarketplaceCategoryHref(category))
+ }
+ />
+ ))}
+ {program.categories.length > 1 && (
+ <Tooltip
+ content={
+ <div className="flex flex-col gap-0.5 p-2">
+ {program.categories.slice(1).map((category) => (
+ <ProgramCategory
+ key={category}
+ category={category}
+ onClick={() =>
+ router.push(
+ getMarketplaceCategoryHref(category),
+ )
+ }
+ />
+ ))}
+ </div>
}
- />
- ))}
- {program.categories.length > 1 && (
- <Tooltip
- content={
- <div className="flex flex-col gap-0.5 p-2">
- {program.categories.slice(1).map((category) => (
- <ProgramCategory
- key={category}
- category={category}
- onClick={() =>
- router.push(getMarketplaceCategoryHref(category))
- }
- />
- ))}
+ >
+ <div className="text-content-subtle -ml-1.5 flex size-6 items-center justify-center rounded-md text-xs font-medium">
+ +{program.categories.length - 1}
</div>
- }
- >
- <div className="text-content-subtle -ml-1.5 flex size-6 items-center justify-center rounded-md text-xs font-medium">
- +{program.categories.length - 1}
- </div>
- </Tooltip>
- )}
+ </Tooltip>
+ )}
+ </div>
</div>
- </div>
- )}
+ )}
</div>
</div>
</Link>
diff --git a/packages/ui/src/nav/content/program-marketplace.tsx b/packages/ui/src/nav/content/program-marketplace.tsx
index eba1b1bf26..400f24b7e7 100644
--- a/packages/ui/src/nav/content/program-marketplace.tsx
+++ b/packages/ui/src/nav/content/program-marketplace.tsx
@@ -130,7 +130,7 @@ export function ProgramMarketplaceSection({ domain }: { domain: string }) {
</span>
</div>
<p className="text-xs font-medium text-neutral-500 dark:text-white/60">
- Browse our available affiliate programs{" "}
+ Browse our top affiliate programs{" "}
<span className="inline-block transition-transform duration-150 group-hover:translate-x-0.5">
→
</span>