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.

small fixes to PartnerLinkModal

Steven Tey8e5d061625bf
diff --git a/apps/web/lib/zod/schemas/partner-profile.ts b/apps/web/lib/zod/schemas/partner-profile.ts
index 3b8ba4210b..12008fae20 100644
--- a/apps/web/lib/zod/schemas/partner-profile.ts
+++ b/apps/web/lib/zod/schemas/partner-profile.ts
@@ -86,6 +86,7 @@ export const PartnerProfileLinkSchema = LinkSchema.pick({
comments: true,
}).extend({
createdAt: z.string().or(z.date()),
+ partnerGroupDefaultLinkId: z.string().nullish(),
});
export const PartnerProfileCustomerSchema = CustomerEnrichedSchema.pick({
diff --git a/apps/web/ui/modals/partner-link-modal.tsx b/apps/web/ui/modals/partner-link-modal.tsx
index d10ca42953..a16888b2b8 100644
--- a/apps/web/ui/modals/partner-link-modal.tsx
+++ b/apps/web/ui/modals/partner-link-modal.tsx
@@ -175,8 +175,12 @@ function PartnerLinkModalContent({
const [isLoading, setIsLoading] = useState(false);
const [isExactMode, setIsExactMode] = useState(false);
- const shortLinkDomain = programEnrollment?.program?.domain ?? "dub.sh";
- const additionalLinks = programEnrollment?.group?.additionalLinks ?? [];
+ const { shortLinkDomain, additionalLinks } = useMemo(() => {
+ return {
+ shortLinkDomain: programEnrollment?.program?.domain ?? "dub.sh",
+ additionalLinks: programEnrollment?.group?.additionalLinks ?? [],
+ };
+ }, [programEnrollment]);
const destinationDomains = useMemo(
() => additionalLinks.map((link) => getApexDomain(link.url)),
@@ -232,10 +236,14 @@ function PartnerLinkModalContent({
[isLoading, link, isDirty, destinationDomains],
);
- // If there is only one destination domain and we are in exact mode, hide the destination URL input
+ // we hide the destination URL input if:
+ // 1. the link is a partner group default link
+ // 2. there is only one destination domain and we are in exact mode
const hideDestinationUrl = useMemo(
- () => destinationDomains.length === 1 && isExactMode,
- [destinationDomains.length, isExactMode],
+ () =>
+ link?.partnerGroupDefaultLinkId ||
+ (destinationDomains.length === 1 && isExactMode),
+ [destinationDomains.length, isExactMode, link?.partnerGroupDefaultLinkId],
);
const shortLink = useMemo(