The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Improve program onboarding form
Steven Tey26e2f74c9436
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/form.tsx b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/form.tsxindex 21ec198e13..608bb40eb7 100644--- a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/form.tsx+++ b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/form.tsx@@ -87,7 +87,7 @@ export function Form() {}setValue("logo", destinationUrl, { shouldDirty: true });- toast.success(`${file.name} uploaded!`);+ toast.success("Program logo uploaded!");} catch (e) {toast.error("Failed to upload logo");} finally {@@ -95,14 +95,23 @@ export function Form() {}};- const buttonDisabled =- isSubmitting || isPending || !name || !url || !domain || !logo;+ const isLoading = isSubmitting || isPending || hasSubmitted;++ const disabledTooltip = !name+ ? "Please enter a company name."+ : !logo+ ? "Please upload a logo."+ : !domain+ ? "Please select a program domain."+ : !url+ ? "Please enter a website URL."+ : undefined;return (<form onSubmit={handleSubmit(onSubmit)} className="space-y-10"><div><label className="block text-sm font-medium text-neutral-800">- Company name+ Company name <span className="text-red-800">*</span></label><p className="mt-1 text-sm text-neutral-600">The name of your company@@ -117,7 +126,7 @@ export function Form() {<div><label className="block text-sm font-medium text-neutral-800">- Logo+ Logo <span className="text-red-800">*</span></label><p className="mb-4 mt-1 text-sm text-neutral-600">A square logo that will be used in various parts of your program@@ -169,8 +178,8 @@ export function Form() {<Buttontext="Continue"className="w-full"- loading={isSubmitting || isPending || hasSubmitted}- disabled={buttonDisabled}+ loading={isLoading}+ disabledTooltip={!isLoading ? disabledTooltip : undefined}type="submit"/></form>diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/rewards/form.tsx b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/rewards/form.tsxindex 64e46facc8..7446f84cf9 100644--- a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/rewards/form.tsx+++ b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/rewards/form.tsx@@ -406,7 +406,7 @@ export function Form() {<div className="flex items-center justify-between gap-3"><label className="text-sm font-medium text-neutral-800">{type === "percentage" ? "Percentage" : "Amount"} per{" "}- {defaultRewardType}+ {defaultRewardType} <span className="text-red-800">*</span></label><RewardQualityFieldIndicatorevent={defaultRewardType as EventType}diff --git a/apps/web/ui/partners/program-link-configuration.tsx b/apps/web/ui/partners/program-link-configuration.tsxindex a663c914c0..dac204de31 100644--- a/apps/web/ui/partners/program-link-configuration.tsx+++ b/apps/web/ui/partners/program-link-configuration.tsx@@ -63,7 +63,7 @@ export function ProgramLinkConfiguration({<div className="space-y-2"><label className="block text-sm font-medium text-neutral-800">- Website URL+ Website URL <span className="text-red-800">*</span></label><Inputvalue={url || ""}@@ -144,9 +144,9 @@ function DomainOnboarding({ domain, onDomainChange }: DomainProps) {useDomains();const trialActive = isWorkspaceBillingTrialActive(trialEndsAt);- const [state, setState] = useState<"idle" | "select">(- domain ? "select" : "idle",- );+ // null = derive from domain (so a domain restored from workspace store shows as selected)+ const [state, setState] = useState<"idle" | "select" | null>(null);+ const resolvedState = state ?? (domain ? "select" : "idle");const [showSubdomainModal, setShowSubdomainModal] = useState(false);const { AddEditDomainModal, setShowAddEditDomainModal } =@@ -237,11 +237,11 @@ function DomainOnboarding({ domain, onDomainChange }: DomainProps) {<div className="mb-2 flex items-center justify-between"><div className="flex items-center gap-x-2"><label className="block text-sm font-medium text-neutral-800">- Program domain+ Program domain <span className="text-red-800">*</span></label><InfoTooltip content="A connected domain or sub-domain is required to create a program. [Learn more](https://dub.co/help/article/choosing-a-custom-domain)" /></div>- {state === "select" && (+ {resolvedState === "select" && (<buttontype="button"onClick={() => setState("idle")}@@ -258,7 +258,7 @@ function DomainOnboarding({ domain, onDomainChange }: DomainProps) {><div className="p-1"><AnimatePresence initial={false} mode="popLayout">- {state === "idle" && (+ {resolvedState === "idle" && (<motion.divkey="idle"initial={{ opacity: 0, y: -10 }}@@ -328,7 +328,7 @@ function DomainOnboarding({ domain, onDomainChange }: DomainProps) {</motion.div>)}- {state === "select" && (+ {resolvedState === "select" && (<motion.divkey="select"initial={{ opacity: 0, y: 10 }}