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.

Open the lead form builder from the Submitted Leads page

Rafi2a03219464a6
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/leads/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/leads/page.tsx
index fdc6ea49bb..62767d911f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/leads/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/leads/page.tsx
@@ -1,5 +1,6 @@
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
+import { EditLeadFormButton } from "@/ui/submitted-leads/form-builder/edit-lead-form-button";
import { SubmittedLeadTable } from "@/ui/submitted-leads/submitted-lead-table";
export default function SubmittedLeadsPage() {
@@ -10,6 +11,7 @@ export default function SubmittedLeadsPage() {
title:
"Review and manage leads submitted by your partners. [Learn more](https://dub.co/help/article/submitted-leads).",
}}
+ controls={<EditLeadFormButton />}
>
<PageWidthWrapper className="flex flex-col gap-3 pb-10">
<SubmittedLeadTable />
diff --git a/apps/web/ui/submitted-leads/form-builder/edit-lead-form-button.tsx b/apps/web/ui/submitted-leads/form-builder/edit-lead-form-button.tsx
new file mode 100644
index 0000000000..ed3fd71913
--- /dev/null
+++ b/apps/web/ui/submitted-leads/form-builder/edit-lead-form-button.tsx
@@ -0,0 +1,32 @@
+"use client";
+
+import { clientAccessCheck } from "@/lib/client-access-check";
+import useWorkspace from "@/lib/swr/use-workspace";
+import { Button } from "@dub/ui";
+import { Sliders } from "@dub/ui/icons";
+import { useEditLeadFormSheet } from "./edit-lead-form-sheet";
+
+export function EditLeadFormButton() {
+ const { role } = useWorkspace();
+ const { editLeadFormSheet, setIsOpen } = useEditLeadFormSheet();
+
+ const permissionsError = clientAccessCheck({
+ action: "groups.write",
+ role,
+ }).error;
+
+ return (
+ <>
+ {editLeadFormSheet}
+ <Button
+ type="button"
+ variant="secondary"
+ onClick={() => setIsOpen(true)}
+ className="h-8 w-auto px-1.5 sm:h-9 sm:px-2.5"
+ icon={<Sliders className="size-4 text-neutral-800" />}
+ disabledTooltip={permissionsError || undefined}
+ aria-label="Edit submitted lead form"
+ />
+ </>
+ );
+}