The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
program settings page
Kiran Kcc0d307a73b8
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/overview/overview.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/overview/overview.tsxindex c0bc65446b..970461b854 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/overview/overview.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/overview/overview.tsx@@ -4,6 +4,9 @@ import { Program } from "@prisma/client";import { notFound } from "next/navigation";export async function ProgramOverview({ programId }: { programId: string }) {+ // TODO:+ // Check program is owned by the partner+const program = await prisma.program.findUnique({where: {id: programId,diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/delete-program.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/delete-program.tsxnew file mode 100644index 0000000000..a85939ac1c--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/delete-program.tsx@@ -0,0 +1,26 @@+"use client";++import { Button } from "@dub/ui";++export function DeleteProgram({ programId }: { programId: string }) {+ // TODO:+ // Delete program++ return (+ <div className="rounded-lg border border-gray-200 bg-white">+ <div className="flex flex-col gap-1 p-8">+ <h2 className="text-xl font-medium text-gray-900">Delete program</h2>+ <p className="text-sm font-normal text-gray-600">+ Permanently delete your affiliate program, and all of your data. This+ action cannot be undone - please proceed with caution.+ </p>+ </div>+ <div className="border-t border-gray-200" />+ <div className="flex items-center justify-end bg-gray-50 px-8 py-5">+ <div>+ <Button text="Delete program" variant="danger" className="h-8" />+ </div>+ </div>+ </div>+ );+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/page.tsxindex f6c53c153a..75d41ad885 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/page.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/page.tsx@@ -1,4 +1,20 @@+import { DeleteProgram } from "./delete-program";+import { ProgramSettings } from "./settings";-export default function ProgramSettings() {- return <>Settings</>;+export default async function ProgramSettingsPage({+ params,+}: {+ params: { slug: string; programId: string };+}) {+ const { programId } = params;++ // TODO:+ // Add suspense loader++ return (+ <div className="mt-8 space-y-10">+ <ProgramSettings programId={programId} />+ <DeleteProgram programId={programId} />+ </div>+ );}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/settings.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/settings.tsxnew file mode 100644index 0000000000..e7e5142e5f--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/settings.tsx@@ -0,0 +1,121 @@+"use client";++import { Button } from "@dub/ui";++export function ProgramSettings({ programId }: { programId: string }) {+ return (+ <div className="rounded-lg border border-gray-200 bg-white">+ <div className="flex items-center border-b border-neutral-200 p-6">+ <h2 className="text-xl font-medium text-neutral-900">Program</h2>+ </div>++ <div className="space-y-8 divide-y divide-neutral-200 p-8">+ <div className="flex flex-col gap-2 sm:flex-row">+ <h3 className="basis-1/2 font-medium text-gray-900">Summary</h3>+ <p className="basis-1/2 rounded-md border border-neutral-200 bg-[#f9f9f9] p-4 text-sm font-normal leading-relaxed text-neutral-600">+ Earn $10.00 for each conversion, and again for every conversion of+ the customers lifetime.+ </p>+ </div>++ <div className="flex flex-col gap-2 pt-8 sm:flex-row">+ <div className="flex basis-1/2 flex-col gap-1">+ <h3 className="font-medium text-gray-900">Commission</h3>+ <p className="text-sm text-gray-600">+ Set how the affiliate will get rewarded+ </p>+ </div>+ <p className="basis-1/2">+ <div>+ <label htmlFor="duration" className="flex items-center space-x-2">+ <h2 className="text-sm font-medium text-gray-600">Duration</h2>+ </label>+ <div className="relative mt-2 rounded-md shadow-sm">+ <select+ className="block w-full rounded-md border-gray-300 text-gray-900 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ required+ >+ <option value="checking">Checking</option>+ <option value="savings">Savings</option>+ </select>+ </div>+ </div>+ </p>+ </div>++ <div className="flex flex-col gap-2 pt-8 sm:flex-row">+ <div className="flex basis-1/2 flex-col gap-1">+ <h3 className="font-medium text-gray-900">Payout</h3>+ <p className="text-sm text-gray-500">+ Set how much the affiliate will get rewarded+ </p>+ </div>+ <p className="basis-1/2 space-y-6">+ <div>+ <label+ htmlFor="payoutModel"+ className="flex items-center space-x-2"+ >+ <h2 className="text-sm font-medium text-gray-600">+ Payout model+ </h2>+ </label>+ <div className="relative mt-2 rounded-md shadow-sm">+ <select+ className="block w-full rounded-md border-gray-300 text-gray-900 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ required+ >+ <option value="flat">Flat</option>+ <option value="percentage">Percentage</option>+ </select>+ </div>+ </div>++ <div>+ <label+ htmlFor="payoutAmount"+ className="flex items-center space-x-2"+ >+ <h2 className="text-sm font-medium text-gray-600">Amount</h2>+ </label>+ <div className="relative mt-2 rounded-md shadow-sm">+ <input+ className="block w-full rounded-md border-gray-300 text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ required+ autoComplete="off"+ />+ </div>+ </div>++ <div>+ <label+ htmlFor="minimumAmount"+ className="flex items-center space-x-2"+ >+ <h2 className="text-sm font-medium text-gray-600">+ Minimum payout+ </h2>+ </label>+ <div className="relative mt-2 rounded-md shadow-sm">+ <input+ className="block w-full rounded-md border-gray-300 text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ required+ autoComplete="off"+ />+ </div>+ <p className="mt-2 text-sm text-gray-500">+ Minimum payout is $100+ </p>+ </div>+ </p>+ </div>+ </div>++ <div className="flex items-center justify-end bg-gray-50 px-8 py-5">+ <div>+ <Button text="Save changes" className="h-8" />+ </div>+ </div>+ </div>+ );+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/tracking.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/tracking.tsxnew file mode 100644index 0000000000..e69de29bb2