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.

Program Resources tab

Steven Teyea98cca9615a
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/layout.tsx
deleted file mode 100644
index bc678162c3..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/layout.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { PageContent } from "@/ui/layout/page-content";
-import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { PropsWithChildren } from "react";
-import { ProgramBrandingTabs } from "./program-branding-tabs";
-
-export default function ProgramSettingsLayout({
- children,
- params,
-}: PropsWithChildren<{ params: { slug: string; programId: string } }>) {
- return (
- <PageContent
- title="Branding"
- titleInfo={{
- title:
- "Customize your program's landing page, partner portal, and referral embed to ensure brand consistency.",
- href: "https://dub.co/help/article/program-branding",
- }}
- controls={
- <ProgramBrandingTabs slug={params.slug} programId={params.programId} />
- }
- >
- <PageWidthWrapper>
- <div className="mb-4 grid grid-cols-1 gap-8">{children}</div>
- </PageWidthWrapper>
- </PageContent>
- );
-}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/page.tsx
index b8241646b5..b8c16a3446 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/page.tsx
@@ -1,9 +1,22 @@
-import { ProgramBrandingLandingPageClient } from "./page-client";
+import { PageContent } from "@/ui/layout/page-content";
+import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
+import { PropsWithChildren } from "react";
-export default function ProgramBrandingLandingPage() {
+export default function ProgramBrandingLandingPage({
+ children,
+}: PropsWithChildren) {
return (
- <div className="flex flex-col gap-10">
- <ProgramBrandingLandingPageClient />
- </div>
+ <PageContent
+ title="Branding"
+ titleInfo={{
+ title:
+ "Customize your program's landing page, partner portal, and referral embed to ensure brand consistency.",
+ href: "https://dub.co/help/article/program-branding",
+ }}
+ >
+ <PageWidthWrapper>
+ <div className="mb-4 grid gap-10">{children}</div>
+ </PageWidthWrapper>
+ </PageContent>
);
}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/program-branding-tabs.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/program-branding-tabs.tsx
deleted file mode 100644
index bdc9cbd5de..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/program-branding-tabs.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-"use client";
-
-import { ToggleGroup } from "@dub/ui";
-import { useSelectedLayoutSegment } from "next/navigation";
-
-export function ProgramBrandingTabs({
- slug,
- programId,
-}: {
- slug: string;
- programId: string;
-}) {
- const selectedLayoutSegment = useSelectedLayoutSegment();
- const page =
- selectedLayoutSegment === null ? "elements" : selectedLayoutSegment;
-
- return (
- <ToggleGroup
- className="rounded-lg bg-neutral-50 p-0.5"
- indicatorClassName="rounded-md bg-white"
- optionClassName="text-xs py-[0.3125rem] px-2.5 normal-case"
- options={[
- {
- value: "elements",
- label: "Brand elements",
- href: `/${slug}/program/branding`,
- },
- {
- value: "resources",
- label: "Brand assets",
- href: `/${slug}/program/branding/resources`,
- },
- ]}
- selected={page}
- />
- );
-}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/page-client.tsx
deleted file mode 100644
index 572589340e..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/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 { 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 { id: workspaceId } = useWorkspace();
-
- const { resources, mutate, isLoading, isValidating } = useProgramResources();
- 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,
- 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)/program/branding/resources/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/page.tsx
deleted file mode 100644
index ef7bc11d57..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/page.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import { ProgramResourcesPageClient } from "./page-client";
-
-export default function ProgramResources() {
- return <ProgramResourcesPageClient />;
-}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/communication/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/communication/page.tsx
deleted file mode 100644
index b64b462aa3..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/communication/page.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { PageContent } from "@/ui/layout/page-content";
-import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { ProgramCommunication } from "./page-client";
-
-export default function ProgramSettingsCommunicationPage() {
- return (
- <PageContent title="Communication">
- <PageWidthWrapper className="mb-8">
- <ProgramCommunication />
- </PageWidthWrapper>
- </PageContent>
- );
-}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/page.tsx
new file mode 100644
index 0000000000..7d0bb30c33
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/page.tsx
@@ -0,0 +1,15 @@
+import { PageContent } from "@/ui/layout/page-content";
+import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
+import { ProgramBrandAssets } from "./program-brand-assets";
+import { ProgramHelpAndSupport } from "./program-help-and-support";
+
+export default function ProgramResourcesPage() {
+ return (
+ <PageContent title="Resources">
+ <PageWidthWrapper className="mb-8">
+ <ProgramHelpAndSupport />
+ <ProgramBrandAssets />
+ </PageWidthWrapper>
+ </PageContent>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/add-color-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/add-color-modal.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/add-color-modal.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/add-color-modal.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/add-file-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/add-file-modal.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/add-file-modal.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/add-file-modal.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/add-logo-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/add-logo-modal.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/branding/resources/add-logo-modal.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/add-logo-modal.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/index.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/index.tsx
new file mode 100644
index 0000000000..1a96832b20
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/index.tsx
@@ -0,0 +1,136 @@
+"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 { toast } from "sonner";
+import { useAddColorModal } from "./add-color-modal";
+import { useAddFileModal } from "./add-file-modal";
+import { useAddLogoModal } from "./add-logo-modal";
+
+export function ProgramBrandAssets() {
+ const { id: workspaceId } = useWorkspace();
+
+ const { resources, mutate, isLoading, isValidating } = useProgramResources();
+ 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,
+ resourceType,
+ resourceId,
+ });
+
+ return !!result?.data?.success;
+ };
+
+ return (
+ <>
+ <AddLogoModal />
+ <AddColorModal />
+ <AddFileModal />
+ <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>
+ </>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/communication/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsx
similarity index 99%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/communication/page-client.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsx
index 9c1c7e4027..a0ff95c180 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/communication/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsx
@@ -14,7 +14,7 @@ import { SettingsRow } from "../program-settings-row";
type FormData = Pick<ProgramProps, "supportEmail" | "helpUrl" | "termsUrl">;
-export function ProgramCommunication() {
+export function ProgramHelpAndSupport() {
const { program } = useProgram();
const { id: workspaceId } = useWorkspace();
diff --git a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
index 219c693316..17778cc33f 100644
--- a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
@@ -18,9 +18,9 @@ import {
Globe,
InvoiceDollar,
Key,
+ LifeRing,
LinesY as LinesYStatic,
MoneyBills2,
- PaperPlane,
Receipt2,
ShieldCheck,
ShieldKeyhole,
@@ -267,9 +267,9 @@ const NAV_AREAS: SidebarNavAreas<SidebarNavData> = {
href: `/${slug}/program/link-settings`,
},
{
- name: "Communication",
- icon: PaperPlane,
- href: `/${slug}/program/communication`,
+ name: "Resources",
+ icon: LifeRing,
+ href: `/${slug}/program/resources`,
},
],
},