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.

Start cleaning up program settings

Tim Wilsonf93e82b227eb
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.tsx
index b859569179..4c64686de3 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
@@ -14,9 +14,9 @@ export default async function ProgramSettingsPage({
// Add suspense loader
return (
- <PageContent title="Settings">
+ <PageContent title="Program Settings">
<MaxWidthWrapper>
- <div className="my-8 grid gap-8">
+ <div className="grid grid-cols-1 gap-8">
<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.tsx
index d8eb104c3d..9fef0cb9fb 100644
--- 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.tsx
@@ -1,6 +1,7 @@
"use client";
import { Button } from "@dub/ui";
+import { PropsWithChildren } from "react";
const commissionTypes = [
{
@@ -22,79 +23,64 @@ export function ProgramSettings({ programId }: { programId: string }) {
<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 leading-none text-neutral-900">
- Summary
- </h3>
+ <div className="divide-y divide-neutral-200 px-8">
+ <ProgramSettingsSection heading="Summary">
<p className="basis-1/2 rounded-md border border-neutral-200 bg-[#f9f9f9] p-4 text-sm font-normal leading-relaxed text-neutral-900">
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 leading-none text-neutral-900">
- Commission
- </h3>
- <p className="text-sm font-normal text-neutral-600">
- Set how the partner will get rewarded
- </p>
- </div>
- <p className="basis-1/2 space-y-6">
- <div className="flex w-full gap-3">
- {commissionTypes.map((commissionType) => (
- <label
- key={commissionType.value}
- className="relative inline-flex w-full cursor-pointer flex-col gap-1 rounded-md border border-neutral-200 bg-white p-3 hover:bg-neutral-50"
- >
- <input
- type="radio"
- value={commissionType.value}
- name="commissionType"
- className="absolute right-2 top-2 h-4 w-4 cursor-pointer"
- />
- <span className="text-sm font-medium text-neutral-600">
- {commissionType.label}
- </span>
- <span className="text-xs font-normal text-neutral-600">
- {commissionType.description}
- </span>
- </label>
- ))}
- </div>
+ </ProgramSettingsSection>
- <div>
+ <ProgramSettingsSection
+ heading="Commission"
+ description="See how the affiliate will get rewarded"
+ >
+ <div className="flex w-full gap-3">
+ {commissionTypes.map((commissionType) => (
<label
- htmlFor="duration"
- className="text-sm font-medium text-neutral-800"
+ key={commissionType.value}
+ className="relative inline-flex w-full cursor-pointer flex-col gap-1 rounded-md border border-neutral-200 bg-white p-3 hover:bg-neutral-50"
>
- Duration
+ <input
+ type="radio"
+ value={commissionType.value}
+ name="commissionType"
+ className="absolute right-2 top-2 h-4 w-4 cursor-pointer"
+ />
+ <span className="text-sm font-medium text-neutral-600">
+ {commissionType.label}
+ </span>
+ <span className="text-xs font-normal text-neutral-600">
+ {commissionType.description}
+ </span>
</label>
- <div className="relative mt-2 rounded-md shadow-sm">
- <select
- className="block w-full rounded-md border-neutral-300 text-neutral-900 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
- required
- >
- <option value="checking">Checking</option>
- <option value="savings">Savings</option>
- </select>
- </div>
- </div>
- </p>
- </div>
+ ))}
+ </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 leading-none text-neutral-900">
- Payout
- </h3>
- <p className="text-sm font-normal text-neutral-600">
- Set how much the partner will get rewarded
- </p>
+ <div className="mt-6">
+ <label
+ htmlFor="duration"
+ className="text-sm font-medium text-neutral-800"
+ >
+ Duration
+ </label>
+ <div className="relative mt-2 rounded-md shadow-sm">
+ <select
+ className="block w-full rounded-md border-neutral-300 text-neutral-900 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
+ required
+ >
+ <option value="checking">Checking</option>
+ <option value="savings">Savings</option>
+ </select>
+ </div>
</div>
- <p className="basis-1/2 space-y-6">
+ </ProgramSettingsSection>
+
+ <ProgramSettingsSection
+ heading="Payout"
+ description="Set how much the affiliate will get rewarded"
+ >
+ <div className="flex flex-col gap-6">
<div>
<label
htmlFor="duration"
@@ -147,8 +133,8 @@ export function ProgramSettings({ programId }: { programId: string }) {
Minimum payout is $100
</p>
</div>
- </p>
- </div>
+ </div>
+ </ProgramSettingsSection>
</div>
<div className="flex items-center justify-end rounded-b-lg border-t border-neutral-200 bg-neutral-50 px-8 py-5">
@@ -159,3 +145,21 @@ export function ProgramSettings({ programId }: { programId: string }) {
</div>
);
}
+
+function ProgramSettingsSection({
+ heading,
+ description,
+ children,
+}: PropsWithChildren<{ heading: string; description?: string }>) {
+ return (
+ <div className="grid grid-cols-1 gap-2 py-8 sm:grid-cols-2">
+ <div className="flex flex-col gap-1">
+ <h3 className="font-medium leading-none text-neutral-900">{heading}</h3>
+ {description && (
+ <p className="text-sm font-normal text-neutral-600">{description}</p>
+ )}
+ </div>
+ <div>{children}</div>
+ </div>
+ );
+}