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.

improve create commission sheet

Steven Teyaf912f0820b2
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/create-commission-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/create-commission-sheet.tsx
index c5913f26b8..b69f0470ed 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/create-commission-sheet.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/create-commission-sheet.tsx
@@ -283,6 +283,11 @@ function CreateCommissionSheetContent(props: CreateCommissionSheetProps) {
setSelectedLinkId={(id) =>
setValue("linkId", id, { shouldDirty: true })
}
+ disabledTooltip={
+ !partnerId
+ ? "You need to select a partner first before you can select a link"
+ : undefined
+ }
/>
</div>
</div>
diff --git a/apps/web/ui/partners/partner-link-selector.tsx b/apps/web/ui/partners/partner-link-selector.tsx
index 15ce6f1161..e8e4b60807 100644
--- a/apps/web/ui/partners/partner-link-selector.tsx
+++ b/apps/web/ui/partners/partner-link-selector.tsx
@@ -5,7 +5,7 @@ import { LinkProps } from "@/lib/types";
import { Combobox, LinkLogo, Tooltip } from "@dub/ui";
import { ArrowTurnRight2 } from "@dub/ui/icons";
import { cn, getApexDomain, linkConstructor } from "@dub/utils";
-import { useMemo, useState } from "react";
+import { ReactNode, useMemo, useState } from "react";
import { useDebounce } from "use-debounce";
const getLinkOption = (link: LinkProps) => ({
@@ -30,6 +30,7 @@ export function PartnerLinkSelector({
onCreate,
error,
optional = false,
+ disabledTooltip,
}: {
selectedLinkId: string | null;
setSelectedLinkId: (id: string) => void;
@@ -38,6 +39,7 @@ export function PartnerLinkSelector({
onCreate?: (search: string) => Promise<boolean>;
error?: boolean;
optional?: boolean;
+ disabledTooltip?: string | ReactNode;
}) {
const [search, setSearch] = useState("");
const [debouncedSearch] = useDebounce(search, 500);
@@ -100,6 +102,7 @@ export function PartnerLinkSelector({
error &&
"border-red-500 focus:border-red-500 focus:ring-red-500 data-[state=open]:ring-red-500 data-[state=open]:border-red-500",
),
+ disabledTooltip,
}}
shouldFilter={false}
onCreate={onCreate}