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 card skeletons

Steven Tey049f8a8b0001
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.tsx
index aa39f60325..af455eb21e 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
@@ -176,7 +176,7 @@ export function MarketplaceProgramPageClient() {
className="border-border-subtle absolute inset-0 size-full overflow-hidden rounded-xl border object-cover"
/>
)}
- <div className="relative mx-auto max-w-screen-md p-8">
+ <div className="relative mx-auto max-w-screen-md py-8">
<div className="flex items-start justify-between gap-4">
{program ? (
<img
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx
index 75affb768c..04ace964b2 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx
@@ -14,7 +14,7 @@ import { useRouter } from "next/navigation";
export function FeaturedProgramCard({
program,
}: {
- program?: NetworkProgramProps;
+ program: NetworkProgramProps;
}) {
const { queryParams } = useRouterStuff();
const router = useRouter();
@@ -22,13 +22,12 @@ export function FeaturedProgramCard({
const statusBadge = program?.status
? ProgramNetworkStatusBadges[program.status]
: null;
- const url = program ? `/programs/marketplace/${program.slug}` : undefined;
const darkImage = program?.marketplaceHeaderImage?.includes("-dark");
return (
<div
className="border-border-subtle relative h-full cursor-pointer overflow-hidden rounded-xl border p-6"
- {...useClickHandlers(url, router)}
+ {...useClickHandlers(`/programs/marketplace/${program.slug}`, router)}
>
{program?.marketplaceHeaderImage && (
<>
@@ -43,15 +42,11 @@ export function FeaturedProgramCard({
<div className="relative">
<div className="flex justify-between gap-4">
- {program ? (
- <img
- src={program.logo || `${OG_AVATAR_URL}${program.name}`}
- alt={program.name}
- className="size-12 rounded-full border border-white/20"
- />
- ) : (
- <div className="size-12 animate-pulse rounded-full bg-neutral-200" />
- )}
+ <img
+ src={program.logo || `${OG_AVATAR_URL}${program.name}`}
+ alt={program.name}
+ className="size-12 rounded-full border border-white/20"
+ />
{statusBadge && (
<StatusBadge {...statusBadge} className="px-1.5 py-0.5">
@@ -62,18 +57,14 @@ export function FeaturedProgramCard({
<div className="mt-10 flex flex-col">
{/* Name */}
- {program ? (
- <span
- className={cn(
- "text-3xl font-semibold",
- darkImage && "text-content-inverted",
- )}
- >
- {program.name}
- </span>
- ) : (
- <div className="h-9 w-40 animate-pulse rounded bg-neutral-200" />
- )}
+ <span
+ className={cn(
+ "text-3xl font-semibold",
+ darkImage && "text-content-inverted",
+ )}
+ >
+ {program.name}
+ </span>
<div
className={cn(
@@ -82,120 +73,107 @@ export function FeaturedProgramCard({
)}
>
{/* Description */}
- {program ? (
- `${program.name} is a program in the Dub Partner Network. Join the network to start partnering with them.`
- ) : (
- <div className="h-5 w-24 animate-pulse rounded bg-neutral-200" />
- )}
+ {`${program.name} is a program in the Dub Partner Network. Join the network to start partnering with them.`}
</div>
<div className="mt-5 flex gap-8">
- {program ? (
- <>
- {Boolean(program?.rewards?.length || program?.discount) && (
- <div>
- <span
- className={cn(
- "text-content-subtle block text-xs font-medium",
- darkImage && "text-content-inverted/80",
- )}
- >
- Rewards
- </span>
- <ProgramRewardsDisplay
- rewards={program.rewards}
- discount={program.discount}
- isDarkImage={darkImage}
- onRewardClick={(reward) =>
- queryParams({
- set: {
- rewardType: reward.event,
- },
- del: "page",
- })
- }
- onDiscountClick={() =>
+ {Boolean(program?.rewards?.length || program?.discount) && (
+ <div>
+ <span
+ className={cn(
+ "text-content-subtle block text-xs font-medium",
+ darkImage && "text-content-inverted/80",
+ )}
+ >
+ Rewards
+ </span>
+ <ProgramRewardsDisplay
+ rewards={program.rewards}
+ discount={program.discount}
+ isDarkImage={darkImage}
+ onRewardClick={(reward) =>
+ queryParams({
+ set: {
+ rewardType: reward.event,
+ },
+ del: "page",
+ })
+ }
+ onDiscountClick={() =>
+ queryParams({
+ set: {
+ rewardType: "discount",
+ },
+ del: "page",
+ })
+ }
+ className="hover:bg-bg-default/10 active:bg-bg-default/20 mt-2"
+ iconClassName="hover:bg-bg-default/10 active:bg-bg-default/20"
+ descriptionClassName="max-w-[240px]"
+ />
+ </div>
+ )}
+ {Boolean(program.categories.length) && (
+ <div className="min-w-0">
+ <span
+ className={cn(
+ "text-content-subtle block text-xs font-medium",
+ darkImage && "text-content-inverted/80",
+ )}
+ >
+ 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={() =>
queryParams({
set: {
- rewardType: "discount",
+ category,
},
del: "page",
})
}
- className="hover:bg-bg-default/10 active:bg-bg-default/20 mt-2"
- iconClassName="hover:bg-bg-default/10 active:bg-bg-default/20"
- descriptionClassName="max-w-[240px]"
- />
- </div>
- )}
- {Boolean(program.categories.length) && (
- <div className="min-w-0">
- <span
className={cn(
- "text-content-subtle block text-xs font-medium",
- darkImage && "text-content-inverted/80",
+ "hover:bg-bg-default/10 active:bg-bg-default/20",
+ darkImage && "text-content-inverted",
)}
+ />
+ ))}
+ {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={() =>
+ queryParams({
+ set: {
+ category,
+ },
+ del: "page",
+ })
+ }
+ />
+ ))}
+ </div>
+ }
>
- 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={() =>
- queryParams({
- set: {
- category,
- },
- del: "page",
- })
- }
- className={cn(
- "hover:bg-bg-default/10 active:bg-bg-default/20",
- darkImage && "text-content-inverted",
- )}
- />
- ))}
- {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={() =>
- queryParams({
- set: {
- category,
- },
- del: "page",
- })
- }
- />
- ))}
- </div>
- }
- >
- <div
- className={cn(
- "-ml-1.5 flex size-6 items-center justify-center rounded-md text-xs font-medium",
- darkImage && "text-content-inverted/80",
- )}
- >
- +{program.categories.length - 1}
- </div>
- </Tooltip>
- )}
- </div>
- </div>
- )}
- </>
- ) : (
- <div>
- <div className="h-4 w-12 animate-pulse rounded bg-neutral-200" />
- <div className="mt-2 h-6 w-24 animate-pulse rounded bg-neutral-200" />
+ <div
+ className={cn(
+ "-ml-1.5 flex size-6 items-center justify-center rounded-md text-xs font-medium",
+ darkImage && "text-content-inverted/80",
+ )}
+ >
+ +{program.categories.length - 1}
+ </div>
+ </Tooltip>
+ )}
+ </div>
</div>
)}
</div>
@@ -204,3 +182,33 @@ export function FeaturedProgramCard({
</div>
);
}
+
+export function FeaturedProgramCardSkeleton() {
+ return (
+ <div className="border-border-subtle relative h-full overflow-hidden rounded-xl border p-6">
+ <div className="relative">
+ <div className="flex justify-between gap-4">
+ <div className="size-12 animate-pulse rounded-full bg-neutral-200" />
+ </div>
+
+ <div className="mt-10 flex flex-col">
+ {/* Name - text-3xl font-semibold is typically ~36px height */}
+ <div className="h-9 w-40 animate-pulse rounded bg-neutral-200" />
+
+ {/* Description - text-sm single line, ~20px height */}
+ <div className="mt-1 max-w-sm">
+ <div className="h-5 w-64 animate-pulse rounded bg-neutral-200" />
+ </div>
+
+ {/* Rewards/Category section - matches actual card structure with mt-5 */}
+ <div className="mt-5 flex gap-8">
+ <div>
+ <div className="h-4 w-12 animate-pulse rounded bg-neutral-200" />
+ <div className="mt-2 h-6 w-24 animate-pulse rounded bg-neutral-200" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx
index 8516b03168..564f70b4b4 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-programs.tsx
@@ -10,7 +10,10 @@ import {
import { fetcher } from "@dub/utils";
import { ComponentProps } from "react";
import useSWR from "swr";
-import { FeaturedProgramCard } from "./featured-program-card";
+import {
+ FeaturedProgramCard,
+ FeaturedProgramCardSkeleton,
+} from "./featured-program-card";
export function FeaturedPrograms() {
const { data: programs, error } = useSWR<NetworkProgramProps[]>(
@@ -33,8 +36,12 @@ export function FeaturedPrograms() {
))
) : (
<>
- <CarouselCard />
- <CarouselCard />
+ <CarouselItem className="basis-full">
+ <FeaturedProgramCardSkeleton />
+ </CarouselItem>
+ <CarouselItem className="basis-full">
+ <FeaturedProgramCardSkeleton />
+ </CarouselItem>
</>
)}
</CarouselContent>
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page-client.tsx
index c46b2cb412..9cb484a2c5 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/page-client.tsx
@@ -15,7 +15,7 @@ import { cn, fetcher } from "@dub/utils";
import useSWR from "swr";
import { FeaturedPrograms } from "./featured-programs";
import { MarketplaceEmptyState } from "./marketplace-empty-state";
-import { ProgramCard } from "./program-card";
+import { ProgramCard, ProgramCardSkeleton } from "./program-card";
import ProgramSort from "./program-sort";
import { useProgramNetworkFilters } from "./use-program-network-filters";
@@ -96,10 +96,12 @@ export function ProgramMarketplacePageClient() {
)}
>
{programs
- ? programs?.map((program) => (
+ ? programs.map((program) => (
<ProgramCard key={program.id} program={program} />
))
- : [...Array(5)].map((_, idx) => <ProgramCard key={idx} />)}
+ : [...Array(5)].map((_, idx) => (
+ <ProgramCardSkeleton key={idx} />
+ ))}
</div>
</div>
<div className="sticky bottom-0 mt-4 rounded-b-[inherit] border-t border-neutral-200 bg-white px-3.5 py-2">
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
index fd71165c58..62955db1b7 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
@@ -11,33 +11,27 @@ import {
import { OG_AVATAR_URL, cn } from "@dub/utils";
import { useRouter } from "next/navigation";
-export function ProgramCard({ program }: { program?: NetworkProgramProps }) {
+export function ProgramCard({ program }: { program: NetworkProgramProps }) {
const { queryParams } = useRouterStuff();
const router = useRouter();
const statusBadge = program?.status
? ProgramNetworkStatusBadges[program.status]
: null;
- const url = program ? `/programs/marketplace/${program.slug}` : undefined;
return (
<div
className={cn(
- program?.id &&
- "border-border-subtle hover:drop-shadow-card-hover cursor-pointer rounded-xl border bg-white p-6 transition-[filter]",
+ "border-border-subtle hover:drop-shadow-card-hover cursor-pointer rounded-xl border bg-white p-6 transition-[filter]",
)}
- {...useClickHandlers(url, router)}
+ {...useClickHandlers(`/programs/marketplace/${program.slug}`, router)}
>
<div className="flex justify-between gap-4">
- {program ? (
- <img
- src={program.logo || `${OG_AVATAR_URL}${program.name}`}
- alt={program.name}
- className="size-12 rounded-full"
- />
- ) : (
- <div className="size-12 animate-pulse rounded-full bg-neutral-200" />
- )}
+ <img
+ src={program.logo || `${OG_AVATAR_URL}${program.name}`}
+ alt={program.name}
+ className="size-12 rounded-full"
+ />
{statusBadge && (
<StatusBadge {...statusBadge} className="px-1.5 py-0.5">
@@ -48,108 +42,91 @@ export function ProgramCard({ program }: { program?: NetworkProgramProps }) {
<div className="mt-4 flex flex-col">
{/* Name */}
- {program ? (
- <span className="text-content-emphasis text-base font-semibold">
- {program.name}
- </span>
- ) : (
- <div className="h-6 w-32 animate-pulse rounded bg-neutral-200" />
- )}
+ <span className="text-content-emphasis text-base font-semibold">
+ {program.name}
+ </span>
<div className="text-content-subtle mt-1 line-clamp-2 text-sm">
{/* Domain */}
- {program ? (
- `${program.name} is a program in the Dub Partner Network. Join the network to start partnering with them.`
- ) : (
- <div className="h-4 w-24 animate-pulse rounded bg-neutral-200" />
- )}
+ {`${program.name} is a program in the Dub Partner Network. Join the network to start partnering with them.`}
</div>
<div className="mt-4 flex gap-4">
- {program ? (
- <>
- {Boolean(program.rewards?.length || program.discount) && (
- <div>
- <span className="text-content-muted block text-xs font-medium">
- Rewards
- </span>
- <ProgramRewardsDisplay
- rewards={program.rewards}
- discount={program.discount}
- onRewardClick={(reward) =>
- queryParams({
- set: {
- rewardType: reward.event,
- },
- del: "page",
- })
- }
- onDiscountClick={() =>
+ {Boolean(program.rewards?.length || program.discount) && (
+ <div>
+ <span className="text-content-muted block text-xs font-medium">
+ Rewards
+ </span>
+ <ProgramRewardsDisplay
+ rewards={program.rewards}
+ discount={program.discount}
+ onRewardClick={(reward) =>
+ queryParams({
+ set: {
+ rewardType: reward.event,
+ },
+ del: "page",
+ })
+ }
+ onDiscountClick={() =>
+ queryParams({
+ set: {
+ rewardType: "discount",
+ },
+ del: "page",
+ })
+ }
+ className="mt-1"
+ />
+ </div>
+ )}
+ {Boolean(program.categories.length) && (
+ <div className="min-w-0">
+ <span className="text-content-muted block text-xs font-medium">
+ Category
+ </span>
+ <div className="mt-1 flex items-center gap-1.5">
+ {program.categories.slice(0, 1)?.map((category) => (
+ <ProgramCategory
+ key={category}
+ category={category}
+ onClick={() =>
queryParams({
set: {
- rewardType: "discount",
+ category,
},
del: "page",
})
}
- className="mt-1"
/>
- </div>
- )}
- {Boolean(program.categories.length) && (
- <div className="min-w-0">
- <span className="text-content-muted block text-xs font-medium">
- Category
- </span>
- <div className="mt-1 flex items-center gap-1.5">
- {program.categories.slice(0, 1)?.map((category) => (
- <ProgramCategory
- key={category}
- category={category}
- onClick={() =>
- queryParams({
- set: {
- category,
- },
- del: "page",
- })
- }
- />
- ))}
- {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={() =>
- queryParams({
- set: {
- category,
- },
- del: "page",
- })
- }
- />
- ))}
- </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>
- </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" />
+ ))}
+ {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={() =>
+ queryParams({
+ set: {
+ category,
+ },
+ del: "page",
+ })
+ }
+ />
+ ))}
+ </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>
</div>
)}
</div>
@@ -157,3 +134,32 @@ export function ProgramCard({ program }: { program?: NetworkProgramProps }) {
</div>
);
}
+
+export function ProgramCardSkeleton() {
+ return (
+ <div className="border-border-subtle rounded-xl border bg-white p-6">
+ <div className="flex justify-between gap-4">
+ <div className="size-12 animate-pulse rounded-full bg-neutral-200" />
+ </div>
+
+ <div className="mt-4 flex flex-col">
+ {/* Name - text-base font-semibold is typically ~24px height */}
+ <div className="h-6 w-32 animate-pulse rounded bg-neutral-200" />
+
+ {/* Description - line-clamp-2 text-sm is 2 lines, ~28px total */}
+ <div className="mt-1 flex flex-col gap-1">
+ <div className="h-4 w-full animate-pulse rounded bg-neutral-200" />
+ <div className="h-4 w-3/4 animate-pulse rounded bg-neutral-200" />
+ </div>
+
+ {/* Rewards/Category section - matches actual card structure */}
+ <div className="mt-4 flex gap-4">
+ <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>
+ );
+}
diff --git a/apps/web/ui/partners/program-application-sheet.tsx b/apps/web/ui/partners/program-application-sheet.tsx
index b084b70756..dc617d9d5d 100644
--- a/apps/web/ui/partners/program-application-sheet.tsx
+++ b/apps/web/ui/partners/program-application-sheet.tsx
@@ -11,12 +11,12 @@ import {
import { createProgramApplicationSchema } from "@/lib/zod/schemas/programs";
import { X } from "@/ui/shared/icons";
import {
+ ArrowTurnRight2,
Button,
buttonVariants,
CircleCheck,
CircleCheckFill,
Grid,
- Link4,
LoadingSpinner,
Sheet,
} from "@dub/ui";
@@ -95,7 +95,6 @@ function ProgramApplicationSheetContent({
function ProgramApplicationSheetForm({
program,
- programEnrollment,
backDestination = "programs",
onSuccess,
group,
@@ -177,10 +176,15 @@ function ProgramApplicationSheetForm({
</span>
<div className="flex items-center gap-1 text-neutral-500">
- <Link4 className="size-3 shrink-0" />
- <span className="min-w-0 truncate text-sm font-medium">
+ <ArrowTurnRight2 className="size-3.5 shrink-0" />
+ <a
+ href={`https://${program.domain}`}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="min-w-0 cursor-alias truncate text-sm font-medium underline decoration-dotted underline-offset-2 hover:text-neutral-700"
+ >
{program.domain}
- </span>
+ </a>
</div>
</div>
</div>