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.

Add Lead Details and Comments tabs to the partner lead sheet

Rafi619c9deea097
diff --git a/apps/web/ui/submitted-leads/partner-profile-submitted-lead-sheet.tsx b/apps/web/ui/submitted-leads/partner-profile-submitted-lead-sheet.tsx
index c290a50cbc..231ce0a36d 100644
--- a/apps/web/ui/submitted-leads/partner-profile-submitted-lead-sheet.tsx
+++ b/apps/web/ui/submitted-leads/partner-profile-submitted-lead-sheet.tsx
@@ -1,15 +1,20 @@
+import { usePartnerSubmittedLeadComments } from "@/lib/swr/use-partner-submitted-lead-comments";
import { PartnerProfileSubmittedLead } from "@/lib/zod/schemas/partner-profile";
import { SubmittedLeadActivitySectionPartner } from "@/ui/activity-logs/submitted-lead-activity-section-partner";
import { X } from "@/ui/shared/icons";
+import { SheetTabs, formatTabBadgeCount } from "@/ui/shared/sheet-tabs";
import {
Button,
ChevronLeft,
ChevronRight,
+ Msg,
Sheet,
+ UserPlus,
useKeyboardShortcut,
useRouterStuff,
} from "@dub/ui";
-import { Dispatch, SetStateAction } from "react";
+import { Dispatch, SetStateAction, useState } from "react";
+import { PartnerSubmittedLeadComments } from "./partner-submitted-lead-comments";
import { SubmittedLeadContactDetails } from "./submitted-lead-contact-details";
import { SubmittedLeadDetails } from "./submitted-lead-details";
@@ -25,6 +30,13 @@ function PartnerProfileSubmittedLeadSheetContent({
onPrevious,
onNext,
}: Omit<PartnerProfileSubmittedLeadSheetProps, "setIsOpen">) {
+ const [currentTabId, setCurrentTabId] = useState("details");
+
+ const { comments } = usePartnerSubmittedLeadComments(
+ { leadId: lead.id },
+ { keepPreviousData: true },
+ );
+
// right arrow key onNext
useKeyboardShortcut(
"ArrowRight",
@@ -85,8 +97,28 @@ function PartnerProfileSubmittedLeadSheetContent({
<div className="@3xl/sheet:grid-cols-[minmax(440px,1fr)_minmax(0,360px)] scrollbar-hide grid min-h-0 grow grid-cols-1 gap-x-6 gap-y-2 overflow-y-auto p-4 sm:gap-y-4 sm:p-6">
{/* Left side - Lead details */}
<div className="flex flex-col gap-6">
- <div className="border-border-subtle overflow-hidden rounded-xl border bg-white p-4">
- <SubmittedLeadDetails lead={{ formData: lead.formData }} />
+ <div className="border-border-subtle overflow-hidden rounded-xl border bg-neutral-100">
+ <SheetTabs
+ tabs={[
+ { id: "details", label: "Lead Details", icon: UserPlus },
+ {
+ id: "comments",
+ label: "Comments",
+ icon: Msg,
+ badge: formatTabBadgeCount(comments?.length),
+ },
+ ]}
+ currentTabId={currentTabId}
+ setCurrentTabId={setCurrentTabId}
+ />
+ <div className="border-border-subtle -mx-px -mb-px rounded-xl border bg-white p-4">
+ {currentTabId === "details" && (
+ <SubmittedLeadDetails lead={{ formData: lead.formData }} />
+ )}
+ {currentTabId === "comments" && (
+ <PartnerSubmittedLeadComments leadId={lead.id} />
+ )}
+ </div>
</div>
<SubmittedLeadActivitySectionPartner leadId={lead.id} />
</div>