The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix featured program pages
Steven Teyac393fc1f184
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page-client.tsxindex 54a8743633..c082d61850 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page-client.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page-client.tsx@@ -19,14 +19,13 @@ import {Button,ChevronRight,Gift,- Link4,Shop,StatusBadge,Tooltip,buttonVariants,useKeyboardShortcut,} from "@dub/ui";-import { OG_AVATAR_URL, cn, fetcher, getPrettyUrl } from "@dub/utils";+import { OG_AVATAR_URL, cn, fetcher } from "@dub/utils";import { useAction } from "next-safe-action/hooks";import Link from "next/link";import { useParams, useRouter } from "next/navigation";@@ -36,7 +35,7 @@ import useSWR from "swr";export function MarketplaceProgramPageClient() {const { programSlug } = useParams();- const { data: program, error } = useSWR<NetworkProgramExtendedProps>(+ const { data: program } = useSWR<NetworkProgramExtendedProps>(programSlug ? `/api/network/programs/${programSlug}` : null,fetcher,{@@ -48,6 +47,22 @@ export function MarketplaceProgramPageClient() {? ProgramNetworkStatusBadges[program.status]: null;+ if (!program)+ return (+ <PageContent>+ <PageWidthWrapper className="mb-10">+ <div className="mx-auto mt-10 w-full max-w-screen-sm">+ <div className="h-9 w-48 animate-pulse rounded bg-neutral-200" />+ <div className="mt-1 h-6 w-24 animate-pulse rounded bg-neutral-200" />+ <div className="mt-4 h-6 w-24 animate-pulse rounded bg-neutral-200" />+ <div className="mt-4 h-6 w-24 animate-pulse rounded bg-neutral-200" />+ </div>+ </PageWidthWrapper>+ </PageContent>+ );++ const isDarkImage = program.marketplaceHeaderImage?.includes("dark");+return (<PageContenttitle={@@ -96,137 +111,163 @@ export function MarketplaceProgramPageClient() {)}>- <PageWidthWrapper className="mb-10">- <div className="mx-auto mt-10 w-full max-w-screen-sm">- {program ? (- <img- src={program.logo || `${OG_AVATAR_URL}${program.name}`}- alt={program.name}- className="size-20 rounded-full"- />- ) : (- <div className="size-20 animate-pulse rounded-full bg-neutral-200" />- )}-- <div className="mt-6 flex flex-col">- {program ? (- <span className="text-content-emphasis text-3xl font-semibold">- {program.name}- </span>- ) : (- <div className="h-9 w-48 animate-pulse rounded bg-neutral-200" />+ <PageWidthWrapper>+ <div className="relative">+ {program.featuredOnMarketplaceAt &&+ program.marketplaceHeaderImage && (+ <img+ src={program.marketplaceHeaderImage}+ alt={program.name}+ className="border-border-subtle absolute inset-0 size-full overflow-hidden rounded-xl border object-cover"+ />)}-- <div className="text-content-default mt-1 flex items-center gap-1">- <Link4 className="size-3.5" />+ <div className="relative mx-auto max-w-screen-md p-8">+ <div className="flex items-start justify-between gap-4">{program ? (- <a- href={program.url || `https://${program.domain}`}- target="_blank"- rel="noreferrer noopener"- className="text-sm font-medium"- >- {getPrettyUrl(program.url) || program.domain}- </a>+ <img+ src={program.logo || `${OG_AVATAR_URL}${program.name}`}+ alt={program.name}+ className="size-16 rounded-full border-2 border-white/20"+ />) : (- <div className="h-4 w-24 animate-pulse rounded bg-neutral-200" />+ <div className="size-16 animate-pulse rounded-full bg-neutral-200" />)}</div>- </div>- <div className="mt-6 flex gap-8">- {program ? (- <>- {Boolean(program?.rewards?.length || program?.discount) && (- <div>- <span className="text-content-muted block text-xs font-medium">- Rewards- </span>- <div className="mt-1 flex items-center gap-1.5">- {program.rewards?.map((reward) => (- <ProgramRewardIcon- key={reward.id}- icon={REWARD_EVENTS[reward.event].icon}- description={formatRewardDescription(reward)}+ <div className="mt-6 flex flex-col">+ <span+ className={cn(+ "text-3xl font-semibold",+ isDarkImage && "text-content-inverted",+ )}+ >+ {program.name}+ </span>++ <div+ className={cn(+ "mt-2 flex max-w-md items-center gap-1",+ isDarkImage && "text-content-inverted/90",+ )}+ >+ {program.name} is a program in the Dub Partner Network. Join the+ network to start partnering with them.+ </div>+ </div>++ <div className="mt-6 flex gap-8">+ {Boolean(program.rewards?.length || program.discount) && (+ <div>+ <span+ className={cn(+ "block text-xs font-medium",+ isDarkImage && "text-content-inverted/70",+ )}+ >+ Rewards+ </span>+ <div className="mt-1 flex items-center gap-1.5">+ {program.rewards?.map((reward) => (+ <ProgramRewardIcon+ key={reward.id}+ icon={REWARD_EVENTS[reward.event].icon}+ description={formatRewardDescription(reward)}+ className={cn(isDarkImage && "text-content-inverted")}+ />+ ))}+ {program.discount && (+ <ProgramRewardIcon+ icon={Gift}+ description={formatDiscountDescription(+ program.discount,+ )}+ className={cn(isDarkImage && "text-content-inverted")}+ />+ )}+ </div>+ </div>+ )}+ {Boolean(program.categories?.length) && (+ <div className="min-w-0">+ <span+ className={cn(+ "block text-xs font-medium",+ isDarkImage && "text-content-inverted/70",+ )}+ >+ Category+ </span>+ <div className="mt-1 flex items-center gap-1.5">+ {program.categories+ .slice(0, 1)+ ?.map((category) => (+ <ProgramCategory+ key={category}+ category={category}+ className={cn(isDarkImage && "text-content-inverted")}/>))}- {program.discount && (- <ProgramRewardIcon- icon={Gift}- description={formatDiscountDescription(- program.discount,+ {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}+ className={cn(+ isDarkImage && "text-content-inverted",+ )}+ />+ ))}+ </div>+ }+ >+ <div+ className={cn(+ "-ml-1.5 flex size-6 items-center justify-center rounded-md text-xs font-medium",+ isDarkImage && "text-content-inverted/70",)}- />- )}- </div>- </div>- )}- {Boolean(program?.categories?.length) && (- <div className="min-w-0">- <span className="text-content-muted block text-xs font-medium">- Industry- </span>- <div className="mt-1 flex items-center gap-1.5">- {program.categories- .slice(0, 1)- ?.map((category) => (- <ProgramCategory key={category} category={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}- />- ))}- </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>- )}- </div>+ +{program.categories.length - 1}+ </div>+ </Tooltip>+ )}</div>- )}- </>- ) : (- <div>- <div className="h-3.5 w-12 animate-pulse rounded bg-neutral-200" />- <div className="mt-1 h-6 w-24 animate-pulse rounded bg-neutral-200" />- </div>- )}+ </div>+ )}+ </div></div>+ </div>- {program && (- <div>- <LanderHero- program={program}- landerData={program.landerData || {}}- showLabel={false}- className="mt-8 sm:mt-8"- />+ <div className="mx-auto max-w-screen-md">+ <LanderHero+ program={program}+ landerData={program.landerData || {}}+ showLabel={false}+ className="mt-8 sm:mt-8"+ heading="h2"+ titleClassName="text-2xl"+ />- <LanderRewards- className="mt-4"- rewards={program.rewards || []}- discount={program.discount || null}- />+ <LanderRewards+ className="mt-4"+ rewards={program.rewards || []}+ discount={program.discount || null}+ />- {program.landerData && (- <div className="mt-16 grid grid-cols-1 gap-10">- {program.landerData.blocks.map((block, idx) => {- const Component = BLOCK_COMPONENTS[block.type];- return Component ? (- <Component key={idx} block={block} program={program} />- ) : null;- })}- </div>- )}+ {program.landerData && (+ <div className="mt-16 grid grid-cols-1 gap-10">+ {program.landerData.blocks.map((block, idx) => {+ const Component = BLOCK_COMPONENTS[block.type];+ return Component ? (+ <Component+ key={idx}+ block={block}+ group={{ logo: program.logo }}+ />+ ) : null;+ })}</div>)}</div>diff --git a/apps/web/ui/partners/lander/lander-hero.tsx b/apps/web/ui/partners/lander/lander-hero.tsxindex 0301607399..8255c35eb8 100644--- a/apps/web/ui/partners/lander/lander-hero.tsx+++ b/apps/web/ui/partners/lander/lander-hero.tsx@@ -10,6 +10,8 @@ export function LanderHero({heading,preview,className,+ titleClassName,+ descriptionClassName,}: {program: Pick<Program, "name">;landerData: Pick<ProgramLanderData, "label" | "title" | "description">;@@ -17,11 +19,13 @@ export function LanderHero({heading?: ElementType;preview?: boolean;className?: string;+ titleClassName?: string;+ descriptionClassName?: string;}) {const Heading = heading || (preview ? "div" : "h1");return (- <div className="grid grid-cols-1 gap-5 py-6 sm:mt-14">+ <div className={cn("grid grid-cols-1 gap-5 py-6 sm:mt-14", className)}>{showLabel && (<div dir="auto"><span@@ -38,6 +42,7 @@ export function LanderHero({className={cn("text-4xl font-semibold","animate-slide-up-fade [--offset:5px] [animation-delay:100ms] [animation-duration:1s] [animation-fill-mode:both]",+ titleClassName,)}dir="auto">@@ -47,6 +52,7 @@ export function LanderHero({className={cn("text-base text-neutral-700","animate-slide-up-fade [--offset:5px] [animation-delay:200ms] [animation-duration:1s] [animation-fill-mode:both]",+ descriptionClassName,)}dir="auto">