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.

move guide url copy button

Steven Tey97e4d3ce0e9e
diff --git a/apps/web/ui/guides/guide-list.tsx b/apps/web/ui/guides/guide-list.tsx
index 8fbe9da175..cfaf395c61 100644
--- a/apps/web/ui/guides/guide-list.tsx
+++ b/apps/web/ui/guides/guide-list.tsx
@@ -8,13 +8,12 @@ import {
ProgramSheetAccordionItem,
ProgramSheetAccordionTrigger,
} from "@/ui/partners/program-sheet-accordion";
-import { Button, Copy, useCopyToClipboard } from "@dub/ui";
+import { Button, useCopyToClipboard } from "@dub/ui";
import { cn } from "@dub/utils";
import { Check } from "lucide-react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useState } from "react";
-import { toast } from "sonner";
import {
guides,
IntegrationGuide,
@@ -172,20 +171,6 @@ export function GuideList({ showConnectLaterButton = true }: GuideListProps) {
!showConnectLaterButton && "justify-center",
)}
>
- <Button
- text="Share with a developer"
- className="h-8 w-fit rounded-lg"
- variant="outline"
- icon={
- copied ? <Check className="size-4" /> : <Copy className="size-4" />
- }
- type="button"
- onClick={() => {
- copyToClipboard("https://dub.co/docs/partners/quickstart");
- toast.success("Developer link copied.");
- }}
- />
-
{showConnectLaterButton && (
<Link href={`/${workspaceSlug}/program/new/overview`}>
<Button
diff --git a/apps/web/ui/guides/guide.tsx b/apps/web/ui/guides/guide.tsx
index 4be41b29d1..f69b8380cd 100644
--- a/apps/web/ui/guides/guide.tsx
+++ b/apps/web/ui/guides/guide.tsx
@@ -1,9 +1,17 @@
"use client";
-import { buttonVariants } from "@dub/ui";
+import {
+ Button,
+ buttonVariants,
+ Check,
+ ChevronLeft,
+ Copy,
+ useCopyToClipboard,
+} from "@dub/ui";
import { cn } from "@dub/utils";
import Link from "next/link";
import { useParams, usePathname } from "next/navigation";
+import { toast } from "sonner";
import { guides, IntegrationType } from "./integrations";
import { Markdown } from "./markdown";
@@ -21,6 +29,8 @@ export function Guide({ markdown }: { markdown: string }) {
const selectedGuide = guides.find((g) => g.key === guideKey)!;
+ const [copiedGuideUrl, copyGuideUrl] = useCopyToClipboard();
+
const Icon = selectedGuide.icon;
return (
@@ -30,17 +40,32 @@ export function Guide({ markdown }: { markdown: string }) {
<div className="flex items-center justify-between">
<Icon className="size-8" />
- <Link
- href={pathname.replace(`/${guideKey}`, "")}
- className={cn(
- buttonVariants({
- variant: "secondary",
- }),
- "flex h-8 w-fit items-center justify-center rounded-lg border border-neutral-200 px-3 text-sm",
- )}
- >
- Select another method
- </Link>
+ <div className="flex items-center gap-2">
+ <Link href={pathname.replace(`/${guideKey}`, "")}>
+ <Button
+ text="Select another method"
+ variant="secondary"
+ className="h-8 w-fit px-3"
+ icon={<ChevronLeft className="size-3.5" />}
+ />
+ </Link>
+ <Button
+ text="Copy guide link"
+ variant="secondary"
+ className="h-8 w-fit px-3"
+ icon={
+ copiedGuideUrl ? (
+ <Check className="size-3.5" />
+ ) : (
+ <Copy className="size-3.5" />
+ )
+ }
+ onClick={() => {
+ copyGuideUrl(pathname);
+ toast.success("Copied to clipboard");
+ }}
+ />
+ </div>
</div>
<div className="flex flex-col">
diff --git a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
index 0210d480e4..90532223d7 100644
--- a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
@@ -1,5 +1,6 @@
"use client";
+import { getPlanCapabilities } from "@/lib/plan-capabilities";
import useCustomersCount from "@/lib/swr/use-customers-count";
import useWorkspace from "@/lib/swr/use-workspace";
import { useRouterStuff } from "@dub/ui";
@@ -395,7 +396,8 @@ export function AppSidebarNav({
const pathname = usePathname();
const { getQueryString } = useRouterStuff();
const { data: session } = useSession();
- const { defaultProgramId, conversionEnabled } = useWorkspace();
+ const { plan, defaultProgramId } = useWorkspace();
+ const { canTrackConversions } = getPlanCapabilities(plan);
const currentArea = useMemo(() => {
return pathname.startsWith("/account/settings")
@@ -412,7 +414,7 @@ export function AppSidebarNav({
});
const { data: customersCount } = useCustomersCount({
- enabled: conversionEnabled === true,
+ enabled: canTrackConversions === true,
});
return (
@@ -430,7 +432,7 @@ export function AppSidebarNav({
showNews: pathname.startsWith(`/${slug}/program`) ? false : true,
defaultProgramId: defaultProgramId || undefined,
applicationsCount,
- showConversionGuides: conversionEnabled && customersCount === 0,
+ showConversionGuides: canTrackConversions && customersCount === 0,
}}
toolContent={toolContent}
newsContent={newsContent}
diff --git a/apps/web/ui/layout/sidebar/sidebar-nav.tsx b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
index 8107522828..4ed94d0263 100644
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@ -177,8 +177,6 @@ export function SidebarNav<T extends Record<any, any>>({
<Link
href={`/${data.slug}/tracking-guide`}
className="flex h-8 items-center gap-3 rounded-lg bg-neutral-900/10 px-2.5 py-2 text-sm font-medium text-neutral-700 hover:bg-neutral-900/20"
- target="_blank"
- rel="noopener noreferrer"
>
<BookOpen className="size-4" />
View connection guides
@@ -352,7 +350,7 @@ function NavItem({ item }: { item: NavItemType | NavSubItemType }) {
onPointerEnter={() => setHovered(true)}
onPointerLeave={() => setHovered(false)}
className={cn(
- "text-content-default group flex items-center justify-between rounded-lg h-8 p-2 text-sm leading-none transition-[background-color,color,font-weight] duration-75",
+ "text-content-default group flex h-8 items-center justify-between rounded-lg p-2 text-sm leading-none transition-[background-color,color,font-weight] duration-75",
"outline-none focus-visible:ring-2 focus-visible:ring-black/50",
isActive && !items
? "bg-blue-100/50 font-medium text-blue-600 hover:bg-blue-100/80 active:bg-blue-100"