The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
WIP program owner Resources tab
Tim Wilson03eba73e9a00
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page-client.tsxindex ddc9e7b8b5..cd2a4ad9a4 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page-client.tsx@@ -1,25 +1,58 @@"use client";-import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";+import { Button } from "@dub/ui";import { FileZip2, Palette2, Post } from "@dub/ui/icons";+import { PropsWithChildren } from "react";const emptyStateIcons = [Post, Palette2, FileZip2];export function ProgramResourcesPageClient() {return (- <AnimatedEmptyState- title="Resources"- description="Partner guides and materials to boost promotion and earnings"- cardContent={(idx) => {- const Icon = emptyStateIcons[idx % emptyStateIcons.length];- return (- <>- <Icon className="size-4 text-neutral-700" />- <div className="h-2.5 w-24 min-w-0 rounded-sm bg-neutral-200" />- </>- );- }}- pillContent="Coming soon"- />+ <div className="flex flex-col gap-10">+ <Section+ resource="logo"+ title="Brand logos"+ description="SVG, JPG, or PNG, max size of 10 MB"+ ></Section>+ <Section+ resource="color"+ title="Colors"+ description="Provide affiliates with official colors"+ ></Section>+ <Section+ resource="file"+ title="Additional files"+ description="Any document file format, max size 10 MB"+ ></Section>+ </div>+ );+}++function Section({+ resource,+ title,+ description,+ children,+}: PropsWithChildren<{+ resource: string;+ title: string;+ description: string;+}>) {+ return (+ <div className="grid grid-cols-1 rounded-lg border border-neutral-200 p-6 sm:grid-cols-2">+ <div>+ <h2 className="text-lg font-semibold text-neutral-900">{title}</h2>+ <p className="text-sm text-neutral-600">{description}</p>+ </div>+ <div className="flex flex-col items-end gap-4">+ {children}+ <Button+ type="button"+ text={`Add ${resource}`}+ onClick={() => alert("WIP")}+ className="h-8 w-fit px-3"+ />+ </div>+ </div>);}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page.tsxindex 464379cfbc..b5ca48a330 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/resources/page.tsx@@ -4,7 +4,10 @@ import { ProgramResourcesPageClient } from "./page-client";export default function ProgramResources() {return (- <PageContent title="Resources">+ <PageContent+ title="Resources"+ description="Shared brand logos, colors, and additional documents for your partners"+ ><MaxWidthWrapper><ProgramResourcesPageClient /></MaxWidthWrapper>diff --git a/apps/web/lib/zod/schemas/program-resources.ts b/apps/web/lib/zod/schemas/program-resources.tsnew file mode 100644index 0000000000..8f5370db2b--- /dev/null+++ b/apps/web/lib/zod/schemas/program-resources.ts@@ -0,0 +1,18 @@+import { z } from "zod";++export const programResourceFileSchema = z.object({+ name: z.string(),+ size: z.number(),+ url: z.string().url(),+});++export const programResourceColorSchema = z.object({+ name: z.string(),+ color: z.string(),+});++export const programResourcesSchema = z.object({+ logos: z.array(programResourceFileSchema),+ colors: z.array(programResourceColorSchema),+ files: z.array(programResourceFileSchema),+});diff --git a/packages/prisma/schema/program.prisma b/packages/prisma/schema/program.prismaindex 1bfc976a2f..c66ba5fdf1 100644--- a/packages/prisma/schema/program.prisma+++ b/packages/prisma/schema/program.prisma@@ -41,6 +41,7 @@ model Program {defaultRewardId String? @unique // default reward for the programdefaultDiscountId String? @unique // default discount for the programlanderData Json? @db.Json+ resources Json? @db.JsontermsUrl String? @db.LongTextageVerification Int?@@ -52,7 +53,6 @@ model Program {partners ProgramEnrollment[]payouts Payout[]invoices Invoice[]- resources ProgramResource[]applications ProgramApplication[]invites ProgramInvite[]links Link[]@@ -110,22 +110,6 @@ model ProgramApplication {@@index([partnerId])}-// TODO: Haven't finalized the resource table yet.-model ProgramResource {- id String @id @default(cuid())- programId String- type ProgramResourceType- name String- url String- size Int?- createdAt DateTime @default(now())- updatedAt DateTime @updatedAt-- program Program @relation(fields: [programId], references: [id])-- @@index([programId])-}-model ProgramInvite {id String @id @default(cuid())programId String