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.

wip

Tim Wilsona7eae63a7567
diff --git a/apps/web/app/(ee)/api/programs/[programId]/route.ts b/apps/web/app/(ee)/api/programs/[programId]/route.ts
index 929bb45c5b..82dba7b1e5 100644
--- a/apps/web/app/(ee)/api/programs/[programId]/route.ts
+++ b/apps/web/app/(ee)/api/programs/[programId]/route.ts
@@ -1,20 +1,26 @@
import { getProgramOrThrow } from "@/lib/api/programs/get-program-or-throw";
import { withWorkspace } from "@/lib/auth";
+import { getProgramQuerySchema } from "@/lib/zod/schemas/programs";
import { NextResponse } from "next/server";
// GET /api/programs/[programId] - get a program by id
-export const GET = withWorkspace(async ({ workspace, params }) => {
- const program = await getProgramOrThrow(
- {
- workspaceId: workspace.id,
- programId: params.programId,
- },
- {
- includeDefaultDiscount: true,
- includeDefaultReward: true,
- includeRewards: true,
- },
- );
+export const GET = withWorkspace(
+ async ({ workspace, params, searchParams }) => {
+ const { includeLanderData } = getProgramQuerySchema.parse(searchParams);
- return NextResponse.json(program);
-});
+ const program = await getProgramOrThrow(
+ {
+ workspaceId: workspace.id,
+ programId: params.programId,
+ },
+ {
+ includeDefaultDiscount: true,
+ includeDefaultReward: true,
+ includeRewards: true,
+ includeLanderData: includeLanderData || false,
+ },
+ );
+
+ return NextResponse.json(program);
+ },
+);
diff --git a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/page.tsx b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/page.tsx
index 45241c8d89..de9b5d9f1a 100644
--- a/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/page.tsx
@@ -1,8 +1,8 @@
import { getProgram } from "@/lib/fetchers/get-program";
import { programLanderSchema } from "@/lib/zod/schemas/program-lander";
import { BLOCK_COMPONENTS } from "@/ui/partners/lander-blocks";
-import { ProgramRewardList } from "@/ui/partners/program-reward-list";
-import { cn } from "@dub/utils";
+import { LanderHero } from "@/ui/partners/lander-hero";
+import { LanderRewards } from "@/ui/partners/lander-rewards";
import { notFound } from "next/navigation";
import { CSSProperties } from "react";
import { ApplyButton } from "./apply-button";
@@ -36,56 +36,11 @@ export default async function ApplyPage({
>
<Header program={program} />
<div className="p-6">
- {/* Hero section */}
- <div className="grid grid-cols-1 gap-5 sm:pt-20">
- <span
- className={cn(
- "font-mono text-xs font-medium uppercase text-[var(--brand)]",
- "animate-slide-up-fade [--offset:5px] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- Affiliate Program
- </span>
- <h1
- className={cn(
- "text-4xl font-semibold",
- "animate-slide-up-fade [--offset:5px] [animation-delay:100ms] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- Join the {program.name} affiliate program
- </h1>
- <p
- className={cn(
- "text-base text-neutral-700",
- "animate-slide-up-fade [--offset:5px] [animation-delay:200ms] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- Share {program.name} with your audience and for each subscription
- generated through your referral, you'll earn a share of the revenue
- on any plans they purchase.
- </p>
- {/* <p className="text-xs text-neutral-500">
- Read our{" "}
- <a
- href="#"
- className="underline transition-colors duration-100 hover:text-neutral-600"
- >
- Terms of Service
- </a>{" "}
- for more details.
- </p> */}
- </div>
+ <LanderHero program={program} />
{/* Program details grid */}
<div className="mt-10">
- <h2 className="mb-2 text-base font-semibold text-neutral-800">
- Rewards
- </h2>
- <ProgramRewardList
- rewards={program.rewards}
- discount={program.defaultDiscount}
- className="bg-neutral-100"
- />
+ <LanderRewards program={program} />
</div>
{/* Buttons */}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/branding-preview.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/branding-preview.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/branding-preview.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/branding-preview.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/branding-settings.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/branding-settings.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/branding-settings.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/branding-settings.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/embed-docs-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/embed-docs-sheet.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/embed-docs-sheet.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/embed-docs-sheet.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/embed-section.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/embed-section.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/embed-section.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/embed-section.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/page.tsx
similarity index 76%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/page.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/page.tsx
index 87af1b686f..c66ecddcf1 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/branding/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/design/page.tsx
@@ -1,6 +1,6 @@
import { BrandingSettings } from "./branding-settings";
-export default function ProgramSettingsBrandingPage() {
+export default function ProgramBrandingDesignPage() {
return (
<div className="flex flex-col gap-10">
<BrandingSettings />
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/landing/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/landing/page-client.tsx
new file mode 100644
index 0000000000..0832c3f1f8
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/landing/page-client.tsx
@@ -0,0 +1,179 @@
+"use client";
+
+import useProgram from "@/lib/swr/use-program";
+import { ProgramWithLanderDataProps } from "@/lib/types";
+import { PreviewWindow } from "@/ui/partners/design/preview-window";
+import { BLOCK_COMPONENTS } from "@/ui/partners/lander-blocks";
+import { LanderHero } from "@/ui/partners/lander-hero";
+import { LanderRewards } from "@/ui/partners/lander-rewards";
+import { Brush, Button, useScroll, Wordmark } from "@dub/ui";
+import { cn, PARTNERS_DOMAIN } from "@dub/utils";
+import { CSSProperties, useRef, useState } from "react";
+
+export function ProgramBrandingLandingPageClient() {
+ const { program } = useProgram<ProgramWithLanderDataProps>({
+ query: { includeLanderData: true },
+ });
+ const [isSidePanelOpen, setIsSidePanelOpen] = useState(true);
+
+ return (
+ <div className="overflow-hidden rounded-lg border border-neutral-200 bg-neutral-100">
+ <div className="flex items-center justify-between border-b border-neutral-200 bg-white px-4 py-3">
+ <div className="grow basis-0">
+ <Button
+ type="button"
+ onClick={() => setIsSidePanelOpen(!isSidePanelOpen)}
+ data-state={isSidePanelOpen ? "open" : "closed"}
+ variant="secondary"
+ icon={<Brush className="size-4" />}
+ className="hidden size-8 p-0 lg:flex"
+ />
+ </div>
+ <span className="text-center text-xs font-medium text-neutral-500">
+ Landing page
+ </span>
+ <div className="flex grow basis-0 justify-end">
+ <Button
+ type="button"
+ onClick={() => alert("WIP")}
+ variant="primary"
+ text="Publish"
+ className="h-8 w-fit"
+ />
+ </div>
+ </div>
+ <div
+ className={cn(
+ "grid grid-cols-1 transition-[grid-template-columns]",
+ isSidePanelOpen
+ ? "lg:grid-cols-[240px_minmax(0,1fr)]"
+ : "lg:grid-cols-[0px_minmax(0,1fr)]",
+ )}
+ >
+ <div className="h-full overflow-hidden">
+ <div
+ className={cn(
+ "h-full border-neutral-200 p-5 transition-opacity max-lg:border-b lg:w-[240px] lg:border-r",
+ !isSidePanelOpen && "opacity-0",
+ )}
+ >
+ <div className="rounded-lg border border-neutral-300 bg-white p-3 text-sm text-neutral-500">
+ WIP
+ </div>
+ </div>
+ </div>
+ <div className="h-[calc(100vh-240px)] px-4 pt-4">
+ {program && <LanderPreview program={program} />}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function LanderPreview({ program }: { program: ProgramWithLanderDataProps }) {
+ const scrollRef = useRef<HTMLDivElement>(null);
+ const scrolled = useScroll(0, { container: scrollRef });
+
+ const landerData = program.landerData ?? { blocks: [] };
+
+ return (
+ <PreviewWindow
+ url={`${PARTNERS_DOMAIN}/${program?.slug}`}
+ scrollRef={scrollRef}
+ >
+ <div className="relative z-0 mx-auto min-h-screen w-full max-w-screen-sm bg-white">
+ <div className="pointer-events-none absolute left-0 top-0 h-screen w-full border-x border-neutral-200 [mask-image:linear-gradient(black,transparent)]" />
+ <div
+ style={
+ {
+ "--brand": program.brandColor || "#000000",
+ "--brand-ring": "rgb(from var(--brand) r g b / 0.2)",
+ } as CSSProperties
+ }
+ >
+ <header
+ className={
+ "sticky top-0 z-10 mx-px flex items-center justify-between bg-white/90 px-6 py-4 backdrop-blur-sm"
+ }
+ >
+ {/* Bottom border when scrolled */}
+ <div
+ className={cn(
+ "absolute inset-x-0 bottom-0 h-px bg-neutral-200 opacity-0 transition-opacity duration-300 [mask-image:linear-gradient(90deg,transparent,black,transparent)]",
+ scrolled && "opacity-100",
+ )}
+ />
+
+ <div className="animate-fade-in my-0.5 block">
+ {program.wordmark || program.logo ? (
+ <img
+ className="max-h-7 max-w-32"
+ src={(program.wordmark ?? program.logo) as string}
+ />
+ ) : (
+ <Wordmark className="h-7" />
+ )}
+ </div>
+
+ <div className="flex items-center gap-2" {...{ inert: true }}>
+ <Button
+ type="button"
+ variant="secondary"
+ text="Log in"
+ className="animate-fade-in h-8 w-fit text-neutral-600"
+ />
+ <Button
+ type="button"
+ text="Apply"
+ className="animate-fade-in h-8 w-fit border-[var(--brand)] bg-[var(--brand)] hover:bg-[var(--brand)] hover:ring-[var(--brand-ring)]"
+ />
+ </div>
+ </header>
+ <div className="p-6">
+ <LanderHero program={program} />
+
+ {/* Program details grid */}
+ <div className="mt-10">
+ <LanderRewards
+ program={{
+ rewards: program.rewards ?? [],
+ defaultDiscount:
+ program.discounts?.find(
+ (d) => d.id === program.defaultDiscountId,
+ ) || null,
+ }}
+ />
+ </div>
+
+ {/* Buttons */}
+ <div
+ className="animate-scale-in-fade mt-10 flex flex-col gap-2 [animation-delay:400ms] [animation-fill-mode:both]"
+ {...{ inert: true }}
+ >
+ <Button
+ type="button"
+ text="Apply today"
+ className="border-[var(--brand)] bg-[var(--brand)] hover:bg-[var(--brand)] hover:ring-[var(--brand-ring)]"
+ />
+ </div>
+
+ {/* Content blocks */}
+ <div className="mt-16 grid grid-cols-1 gap-10">
+ {landerData.blocks.map((block, idx) => {
+ const Component = BLOCK_COMPONENTS[block.type];
+ return Component ? (
+ <Component
+ key={idx}
+ block={block}
+ logo={program.logo}
+ preview
+ />
+ ) : null;
+ })}
+ </div>
+ </div>
+ </div>
+ </div>
+ </PreviewWindow>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/landing/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/landing/page.tsx
new file mode 100644
index 0000000000..b8241646b5
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/landing/page.tsx
@@ -0,0 +1,9 @@
+import { ProgramBrandingLandingPageClient } from "./page-client";
+
+export default function ProgramBrandingLandingPage() {
+ return (
+ <div className="flex flex-col gap-10">
+ <ProgramBrandingLandingPageClient />
+ </div>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/layout.tsx
new file mode 100644
index 0000000000..c8f4061b8e
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/layout.tsx
@@ -0,0 +1,21 @@
+import { PageContent } from "@/ui/layout/page-content";
+import { MaxWidthWrapper } from "@dub/ui";
+import { PropsWithChildren } from "react";
+import { ProgramBrandingHeader } from "./program-branding-header";
+
+export default function ProgramSettingsLayout({
+ children,
+ params,
+}: PropsWithChildren<{ params: { slug: string; programId: string } }>) {
+ return (
+ <PageContent title="Branding">
+ <MaxWidthWrapper>
+ <ProgramBrandingHeader
+ slug={params.slug}
+ programId={params.programId}
+ />
+ <div className="mb-10 mt-6 grid grid-cols-1 gap-8">{children}</div>
+ </MaxWidthWrapper>
+ </PageContent>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/program-branding-header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/program-branding-header.tsx
new file mode 100644
index 0000000000..6e2d28520c
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/program-branding-header.tsx
@@ -0,0 +1,43 @@
+"use client";
+
+import { TabSelect } from "@dub/ui";
+import { useSelectedLayoutSegment } from "next/navigation";
+
+export function ProgramBrandingHeader({
+ slug,
+ programId,
+}: {
+ slug: string;
+ programId: string;
+}) {
+ const selectedLayoutSegment = useSelectedLayoutSegment();
+ const page = selectedLayoutSegment === null ? "" : selectedLayoutSegment;
+
+ return (
+ <div className="border-b border-gray-200">
+ <div className="scrollbar-hide overflow-x-auto">
+ <TabSelect
+ variant="accent"
+ options={[
+ {
+ id: "design",
+ label: "Design",
+ href: `/${slug}/programs/${programId}/branding/design`,
+ },
+ {
+ id: "resources",
+ label: "Resources",
+ href: `/${slug}/programs/${programId}/branding/resources`,
+ },
+ {
+ id: "landing",
+ label: "Landing Page",
+ href: `/${slug}/programs/${programId}/branding/landing`,
+ },
+ ]}
+ selected={page}
+ />
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/add-color-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/add-color-modal.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/add-color-modal.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/add-color-modal.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/add-file-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/add-file-modal.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/add-file-modal.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/add-file-modal.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/add-logo-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/add-logo-modal.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/add-logo-modal.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/add-logo-modal.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/page-client.tsx
new file mode 100644
index 0000000000..32014cf1ae
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/page-client.tsx
@@ -0,0 +1,148 @@
+"use client";
+
+import { deleteProgramResourceAction } from "@/lib/actions/partners/program-resources/delete-program-resource";
+import useProgramResources from "@/lib/swr/use-program-resources";
+import useWorkspace from "@/lib/swr/use-workspace";
+import { ProgramResourceType } from "@/lib/zod/schemas/program-resources";
+import { ResourceCard } from "@/ui/partners/resources/resource-card";
+import { ResourceSection } from "@/ui/partners/resources/resource-section";
+import { FileContent } from "@dub/ui";
+import { capitalize, formatFileSize } from "@dub/utils";
+import { useAction } from "next-safe-action/hooks";
+import { useParams } from "next/navigation";
+import { toast } from "sonner";
+import { useAddColorModal } from "./add-color-modal";
+import { useAddFileModal } from "./add-file-modal";
+import { useAddLogoModal } from "./add-logo-modal";
+
+export function ProgramResourcesPageClient() {
+ const { programId } = useParams();
+ const { id: workspaceId } = useWorkspace();
+
+ const { resources, mutate, isLoading, isValidating } = useProgramResources({
+ workspaceId: workspaceId!,
+ programId: programId as string,
+ });
+ const { setShowAddLogoModal, AddLogoModal } = useAddLogoModal();
+ const { setShowAddColorModal, AddColorModal } = useAddColorModal();
+ const { setShowAddFileModal, AddFileModal } = useAddFileModal();
+
+ const { executeAsync } = useAction(deleteProgramResourceAction, {
+ onSuccess: ({ input }) => {
+ toast.success(`${capitalize(input.resourceType)} deleted successfully`);
+ mutate();
+ },
+ onError: ({ input, error }) => {
+ toast.error(
+ error.serverError || `Failed to delete ${input.resourceType}`,
+ );
+ },
+ });
+
+ const handleDelete = async (
+ resourceType: ProgramResourceType,
+ resourceId: string,
+ ) => {
+ const result = await executeAsync({
+ workspaceId: workspaceId as string,
+ programId: programId as string,
+ resourceType,
+ resourceId,
+ });
+
+ return !!result?.data?.success;
+ };
+
+ return (
+ <>
+ <AddLogoModal />
+ <AddColorModal />
+ <AddFileModal />
+ <div>
+ <p className="text-base text-neutral-500">
+ Logos, colors, and additional documents for your partners to download
+ and use
+ </p>
+ <div className="mt-6 flex flex-col gap-10">
+ <ResourceSection
+ resource="logo"
+ title="Brand logos"
+ description="SVG, JPG, or PNG, max size of 10 MB"
+ isLoading={isLoading}
+ isValidating={isValidating}
+ onAdd={() => setShowAddLogoModal(true)}
+ >
+ {resources?.logos?.map((logo) => (
+ <ResourceCard
+ key={logo.id}
+ resourceType="logo"
+ icon={
+ <div className="relative size-8 overflow-hidden">
+ <img
+ src={logo.url}
+ alt="thumbnail"
+ className="size-full object-contain"
+ />
+ </div>
+ }
+ title={logo.name || "Logo"}
+ description={formatFileSize(logo.size, 0)}
+ downloadUrl={logo.url}
+ onDelete={() => handleDelete("logo", logo.id)}
+ />
+ ))}
+ </ResourceSection>
+ <ResourceSection
+ resource="color"
+ title="Colors"
+ description="Provide affiliates with official colors"
+ isLoading={isLoading}
+ isValidating={isValidating}
+ onAdd={() => setShowAddColorModal(true)}
+ >
+ {resources?.colors?.map((color) => (
+ <ResourceCard
+ key={color.id}
+ resourceType="color"
+ icon={
+ <div
+ className="size-full"
+ style={{ backgroundColor: color.color }}
+ />
+ }
+ title={color.name || "Color"}
+ description={color.color.toUpperCase()}
+ copyText={color.color.toUpperCase()}
+ onDelete={() => handleDelete("color", color.id)}
+ />
+ ))}
+ </ResourceSection>
+ <ResourceSection
+ resource="file"
+ title="Additional files"
+ description="Any document or zip file, max size 10 MB"
+ isLoading={isLoading}
+ isValidating={isValidating}
+ onAdd={() => setShowAddFileModal(true)}
+ >
+ {resources?.files?.map((file) => (
+ <ResourceCard
+ key={file.id}
+ resourceType="file"
+ icon={
+ <div className="flex size-full items-center justify-center bg-neutral-50">
+ <FileContent className="size-4 text-neutral-800" />
+ </div>
+ }
+ title={file.name || "File"}
+ description={formatFileSize(file.size, 0)}
+ downloadUrl={file.url}
+ onDelete={() => handleDelete("file", file.id)}
+ />
+ ))}
+ </ResourceSection>
+ </div>
+ </div>
+ </>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/page.tsx
new file mode 100644
index 0000000000..ef7bc11d57
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/resources/page.tsx
@@ -0,0 +1,5 @@
+import { ProgramResourcesPageClient } from "./page-client";
+
+export default function ProgramResources() {
+ return <ProgramResourcesPageClient />;
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/page-client.tsx
deleted file mode 100644
index ffa5dece5e..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/page-client.tsx
+++ /dev/null
@@ -1,142 +0,0 @@
-"use client";
-
-import { deleteProgramResourceAction } from "@/lib/actions/partners/program-resources/delete-program-resource";
-import useProgramResources from "@/lib/swr/use-program-resources";
-import useWorkspace from "@/lib/swr/use-workspace";
-import { ProgramResourceType } from "@/lib/zod/schemas/program-resources";
-import { ResourceCard } from "@/ui/partners/resources/resource-card";
-import { ResourceSection } from "@/ui/partners/resources/resource-section";
-import { FileContent } from "@dub/ui";
-import { capitalize, formatFileSize } from "@dub/utils";
-import { useAction } from "next-safe-action/hooks";
-import { useParams } from "next/navigation";
-import { toast } from "sonner";
-import { useAddColorModal } from "./add-color-modal";
-import { useAddFileModal } from "./add-file-modal";
-import { useAddLogoModal } from "./add-logo-modal";
-
-export function ProgramResourcesPageClient() {
- const { programId } = useParams();
- const { id: workspaceId } = useWorkspace();
-
- const { resources, mutate, isLoading, isValidating } = useProgramResources({
- workspaceId: workspaceId!,
- programId: programId as string,
- });
- const { setShowAddLogoModal, AddLogoModal } = useAddLogoModal();
- const { setShowAddColorModal, AddColorModal } = useAddColorModal();
- const { setShowAddFileModal, AddFileModal } = useAddFileModal();
-
- const { executeAsync } = useAction(deleteProgramResourceAction, {
- onSuccess: ({ input }) => {
- toast.success(`${capitalize(input.resourceType)} deleted successfully`);
- mutate();
- },
- onError: ({ input, error }) => {
- toast.error(
- error.serverError || `Failed to delete ${input.resourceType}`,
- );
- },
- });
-
- const handleDelete = async (
- resourceType: ProgramResourceType,
- resourceId: string,
- ) => {
- const result = await executeAsync({
- workspaceId: workspaceId as string,
- programId: programId as string,
- resourceType,
- resourceId,
- });
-
- return !!result?.data?.success;
- };
-
- return (
- <>
- <AddLogoModal />
- <AddColorModal />
- <AddFileModal />
- <div className="flex flex-col gap-10">
- <ResourceSection
- resource="logo"
- title="Brand logos"
- description="SVG, JPG, or PNG, max size of 10 MB"
- isLoading={isLoading}
- isValidating={isValidating}
- onAdd={() => setShowAddLogoModal(true)}
- >
- {resources?.logos?.map((logo) => (
- <ResourceCard
- key={logo.id}
- resourceType="logo"
- icon={
- <div className="relative size-8 overflow-hidden">
- <img
- src={logo.url}
- alt="thumbnail"
- className="size-full object-contain"
- />
- </div>
- }
- title={logo.name || "Logo"}
- description={formatFileSize(logo.size, 0)}
- downloadUrl={logo.url}
- onDelete={() => handleDelete("logo", logo.id)}
- />
- ))}
- </ResourceSection>
- <ResourceSection
- resource="color"
- title="Colors"
- description="Provide affiliates with official colors"
- isLoading={isLoading}
- isValidating={isValidating}
- onAdd={() => setShowAddColorModal(true)}
- >
- {resources?.colors?.map((color) => (
- <ResourceCard
- key={color.id}
- resourceType="color"
- icon={
- <div
- className="size-full"
- style={{ backgroundColor: color.color }}
- />
- }
- title={color.name || "Color"}
- description={color.color.toUpperCase()}
- copyText={color.color.toUpperCase()}
- onDelete={() => handleDelete("color", color.id)}
- />
- ))}
- </ResourceSection>
- <ResourceSection
- resource="file"
- title="Additional files"
- description="Any document or zip file, max size 10 MB"
- isLoading={isLoading}
- isValidating={isValidating}
- onAdd={() => setShowAddFileModal(true)}
- >
- {resources?.files?.map((file) => (
- <ResourceCard
- key={file.id}
- resourceType="file"
- icon={
- <div className="flex size-full items-center justify-center bg-neutral-50">
- <FileContent className="size-4 text-neutral-800" />
- </div>
- }
- title={file.name || "File"}
- description={formatFileSize(file.size, 0)}
- downloadUrl={file.url}
- onDelete={() => handleDelete("file", file.id)}
- />
- ))}
- </ResourceSection>
- </div>
- </>
- );
-}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/page.tsx
deleted file mode 100644
index 0109a5f495..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/resources/page.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { PageContent } from "@/ui/layout/page-content";
-import { MaxWidthWrapper } from "@dub/ui";
-import { ProgramResourcesPageClient } from "./page-client";
-
-export default function ProgramResources() {
- return (
- <PageContent
- title="Resources"
- description="Shared brand logos, colors, and additional documents for your partners"
- >
- <MaxWidthWrapper className="mb-10">
- <ProgramResourcesPageClient />
- </MaxWidthWrapper>
- </PageContent>
- );
-}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/program-settings-header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/program-settings-header.tsx
index 7e5155a21e..db9b172e28 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/program-settings-header.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/settings/program-settings-header.tsx
@@ -36,11 +36,6 @@ export function ProgramSettingsHeader({
label: "Links",
href: `/${slug}/programs/${programId}/settings/links`,
},
- {
- id: "branding",
- label: "Branding",
- href: `/${slug}/programs/${programId}/settings/branding`,
- },
{
id: "communication",
label: "Communication",